Re: WRAPIT character definition - syntax error

From: Melissa Bukovsky <Melissa.Bukovsky_at_nyahnyahspammersnyahnyah>
Date: Tue, 28 Aug 2007 10:30:02 -0500

Dennis and Mary,

character hdate(hdl) (and the like for the other character variables)
seemed to work. No complains from WRAPIT or my ncl script.

Thanks for the help!

Melissa

Dennis Shea wrote:
> Mary
>
> I think the parser used by NCL (which only understands f77)
> has a few weaknesses. For example "data" can not be used
> as an argument name. I think for character variables
> the parser used the length passed by NCL as a variable
>
> character*(*) foo
>
> The (*) is a variable. It should substitute 19.
>
> D
>
> Mary Haley wrote:
>> Melissa,
>>
>> What happens if you do something like:
>>
>> character hdate(hdl)
>>
>> Dennis is right that:
>>
>> character*(*) hdate
>>
>> should work, but perhaps in this case, the code needs to know the
>> exact string length.
>>
>> --Mary
>>
>> On Mon, 27 Aug 2007, Dennis Shea wrote:
>>
>>> [A]
>>> In NCL if
>>>
>>> hdate = "1234567890123456789" ; 1 string (19 characters)
>>>
>>> fortran:
>>>
>>> character*(*) hdate
>>>
>>> that is fine. the fortran will treat it as
>>>
>>> character*19 hdate
>>>
>>> [B]
>>> I am leaving. I may be tied up for the next few days.
>>> I am cc'ing Mary haley.
>>>
>>> Regards
>>> Dennis
>>>
>>> Melissa.Bukovsky_at_noaa.gov wrote:
>>>> That solves the WRAPIT problem, but when I try to run my ncl script, I
>>>> recieve the following:
>>>>
>>>> [mbukov_at_oliver WPS]$ ncl< nc2inter_3D.ncl
>>>> Copyright (C) 1995-2007 - All Rights Reserved
>>>> University Corporation for Atmospheric Research
>>>> NCAR Command Language Version 4.3.1
>>>> The use of this software is governed by a License Agreement.
>>>> See http://www.ncl.ucar.edu/ for more details.
>>>> fatal:Number of elements of dimension (0) of argument (1) is (19) in
>>>> function (writeinter), expected (1) elements
>>>> fatal:Execute: Error occurred at or near line 292
>>>>
>>>> this is the call to the external function:
>>>>
>>>> UTIL01::writeinter(version,hdate,xfcst,mapsource,fout,units, \
>>>> desc,xlvl,nx,ny,iproj,startloc,startlat,startlon, \
>>>> nlats,deltalon,earthradius,iswindearthrel, \
>>>> vnew(m,:,:),msl,sll,hdl,fol,ul,dl)
>>>>
>>>> hdate has 19 characters, but the external function is only expecting 1
>>>> when the characters are defined this way in the stub file (and/or
>>>> in the
>>>> fortran 90 file, I've tried both). This is the same for the other
>>>> character variables. Any other thoughts/suggestions? Melissa
>>>>
>>>>
>>>>
>>>> ----- Original Message -----
>>>> From: Dennis Shea <shea_at_ucar.edu>
>>>> Date: Monday, August 27, 2007 3:14 pm
>>>> Subject: Re: WRAPIT character definition - syntax error
>>>>> In your stub file try
>>>>>
>>>>> character*(*) mapsource
>>>>> character*(*) startloc
>>>>> character*(*) field
>>>>> character*(*) hdate
>>>>> character*(*) units
>>>>> character*(*) desc
>>>>>
>>>>>
>>>>>
>>>>> Melissa.Bukovsky_at_noaa.gov wrote:
>>>>>> Hello,
>>>>>>
>>>>>> I'm trying to use fortran with ncl to write unformated binary data,
>>>>>> however, I'm recieving the message "A syntax error occurred while
>>>>>> parsing: msl". WRAPIT does produce the .so file, but it doesn't
>>>>> work> when called from the ncl script. The problem seems to be in
>>>>> my stub
>>>>>> file (the subroutine is written in fortran 90) with the way the
>>>>>> characters are declared, but I don't see a problem. The error
>>>>> occurs> for whichever variable is at the top of the character
>>>>> declaration list.
>>>>>> Relavent parts of the code are pasted below. Can wrapit not handle
>>>>>> character declarations with an integer varible for the length? If
>>>>>> anyone sees a problem in my code that I'm missing, or can suggest
>>>>> a way
>>>>>> around this, please let me know. Thanks,
>>>>>>
>>>>>> Melissa [mbukov_at_oliver WPS]$ ./WRAPIT -gf -d writeinter_gauss.stub
>>>>>> writeinter_gauss.f90
>>>>>>
>>>>>> WRAPIT Version: 051007
>>>>>> OPERATING SYSTEM: Linux
>>>>>> FORTRAN COMPILER (f90c): gfortran
>>>>>> FORTRAN COMPILER OPTIONS (fopts): -fconvert=big-endian -fPIC -v -c
>>>>>> -fno-second-underscore
>>>>>> A syntax error occurred while parsing: msl
>>>>>> gcc -fPIC -c -I/usr/local/ncl/include WRAPIT.c
>>>>>> COMPILING writeinter_gauss.f90
>>>>>> gfortran -fconvert=big-endian -fPIC -v -c -fno-second-underscore
>>>>>> writeinter_gauss.f90
>>>>>> Using built-in specs.
>>>>>> Target: x86_64-redhat-linux
>>>>>> Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
>>>>>> --infodir=/usr/share/info --enable-shared --enable-threads=posix
>>>>>> --enable-checking=release --with-system-zlib --enable-__cxa_atexit
>>>>>> --disable-libunwind-exceptions --enable-libgcj-multifile
>>>>>> --enable-languages=c,c++,objc,obj-c++,java,fortran,ada
>>>>>> --enable-java-awt=gtk --disable-dssi
>>>>>> --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
>>>>>> --with-cpu=generic --host=x86_64-redhat-linux
>>>>>> Thread model: posix
>>>>>> gcc version 4.1.1 20070105 (Red Hat 4.1.1-51)
>>>>>> /usr/libexec/gcc/x86_64-redhat-linux/4.1.1/f951
>>>>> writeinter_gauss.f90> -quiet -dumpbase writeinter_gauss.f90 -
>>>>> mtune=generic -auxbase
>>>>>> writeinter_gauss -version -fconvert=big-endian -fPIC
>>>>>> -fno-second-underscore -I
>>>>>> /usr/lib/gcc/x86_64-redhat-linux/4.1.1/finclude -o /tmp/ccpW7Pra.s
>>>>>> GNU F95 version 4.1.1 20070105 (Red Hat 4.1.1-51) (x86_64-redhat-
>>>>> linux)> compiled by GNU C version 4.1.1 20070105 (Red Hat
>>>>> 4.1.1-51).
>>>>>> GGC heuristics: --param ggc-min-expand=100 --param ggc-min-
>>>>> heapsize=131072> as -V -Qy -o writeinter_gauss.o /tmp/ccpW7Pra.s
>>>>>> GNU assembler version 2.16.91.0.6 (x86_64-redhat-linux) using BFD
>>>>>> version 2.16.91.0.6 20060212
>>>>>> SHARED OBJECT NAME (SharedObj): writeinter_gauss.so
>>>>>> LINKER SUFFIX (ld_suffix): WRAPIT.o writeinter_gauss.o -o
>>>>>> writeinter_gauss.so
>>>>>> LINKING
>>>>>> gcc -fPIC -shared WRAPIT.o writeinter_gauss.o -o writeinter_gauss.so
>>>>>> END WRAPIT
>>>>>>
>>>>>>
>>>>>>
>>>> cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc>
>>>>
>>>> c STUB FOR writeinter_gauss.f90
>>>>> cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc>
>>>>> c
>>>>>> C NCLFORTSTART
>>>>>>
>>>>>> subroutine
>>>>> writeinter(version,hdate,xfcst,mapsource,field,units,> +
>>>>> desc,xlvl,nx,ny,iproj,startloc,startlat,startlon,
>>>>>> + nlats,deltalon,earthradius,iswind,slab,
>>>>>> + msl,sll,hdl,fol,ul,dl)
>>>>>>
>>>>>> integer version,nx,ny,iproj,nlats
>>>>>> integer msl,sll,hdl,fol,ul,dl
>>>>>>
>>>>>> real xfcst
>>>>>> real xlvl
>>>>>> real startlat,startlon,deltalon
>>>>>> real earthradius
>>>>>> real slab(nx,ny)
>>>>>>
>>>>>> logical iswind
>>>>>>
>>>>>> character *(msl) mapsource
>>>>>> character *(sll) startloc
>>>>>> character *(fol) field
>>>>>> character *(hdl) hdate
>>>>>> character *(ul) units
>>>>>> character *(dl) desc
>>>>>>
>>>>>> C NCLEND
>>>>>>
>>>>>> !writeinter_gauss.f90
>>>>>>
>>>>> !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc>
>>>>> !
>>>>>> subroutine
>>>>> writeinter(version,hdate,xfcst,mapsource,field,units,&>
>>>>> desc,xlvl,nx,ny,iproj,startloc,startlat,startlon, &
>>>>>> nlats,deltalon,earthradius,iswind,slab, &
>>>>>> msl,sll,hdl,fol,ul,dl)
>>>>>>
>>>>>> IMPLICIT NONE
>>>>>>
>>>>>> integer :: version,nx,ny,iproj,nlats
>>>>>> integer :: msl,sll,hdl,fol,ul,dl
>>>>>>
>>>>>> real :: xfcst
>>>>>> real :: xlvl
>>>>>> real :: startlat,startlon,deltalon
>>>>>> real :: earthradius
>>>>>> real, dimension(nx,ny) :: slab
>>>>>>
>>>>>> logical :: iswind
>>>>>>
>>>>>> character (len=msl) mapsource
>>>>>> character (len=sll) startloc
>>>>>> character (len=fol) field
>>>>>> character (len=hdl) hdate
>>>>>> character (len=ul) units
>>>>>> character (len=dl) desc
>>>>>>
>>>>>> character (len=8) startloc2
>>>>>> character (len=9) field2
>>>>>> character (len=24) hdate2
>>>>>> character (len=25) units2
>>>>>> character (len=32) mapsource2
>>>>>> character (len=46) desc2
>>>>>> startloc2 = startloc
>>>>>> field2 = field
>>>>>> hdate2 = hdate
>>>>>> units2 = units
>>>>>> mapsource2 = mapsource
>>>>>> desc2 = desc
>>>>>>
>>>>>> open(unit=10, file='fort.90', access='SEQUENTIAL', &
>>>>>> form='UNFORMATTED',status='NEW')
>>>>>>
>>>>>> write(unit=10) version
>>>>>> write(unit=10) hdate2,xfcst,mapsource2,field2,units2, &
>>>>>> desc2,xlvl,nx,ny,iproj
>>>>>> write(unit=10) startloc2,startlat,startlon,nlats, &
>>>>>> deltalon,earthradius
>>>>>> write(unit=10) iswind
>>>>>> write(unit=10) slab
>>>>>>
>>>>>> close(unit=10)
>>>>>>
>>>>>> return
>>>>>> end
>>>>>>
>>>>>> _______________________________________________
>>>>>> ncl-talk mailing list
>>>>>> ncl-talk_at_ucar.edu
>>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>>
>>>>>
>>>>> --
>>>>> ======================================================
>>>>> Dennis J. Shea tel: 303-497-1361 |
>>>>> P.O. Box 3000 fax: 303-497-1333 |
>>>>> Climate Analysis Section |
>>>>> Climate & Global Dynamics Div. |
>>>>> National Center for Atmospheric Research |
>>>>> Boulder, CO 80307 |
>>>>> USA email: shea 'at' ucar.edu |
>>>>> ======================================================
>>>>>
>>>>>
>>>
>>>
>

-- 
_______________________________________________________________
Melissa Bukovsky
GRA/Ph.D. Candidate
OU School of Meteorology, NWC 5234
mbukovsky_at_ou.edu
"When one admits that nothing is certain one must, I think, also
admit that some things are much more nearly certain than others."
-Bertrand Russell
"Waiting for a sign to smash the silence with a brick of
 self control." -Armstrong
"My opinions are my own and not representative of OU, CIMMS,
 NSSL, NOAA or any affiliates."
=^..^=
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Aug 28 2007 - 09:30:02 MDT

This archive was generated by hypermail 2.2.0 : Thu Aug 30 2007 - 21:26:07 MDT