[ncl-talk] WRAPIT, error in the fortran code

Ying Song ysong4 at slu.edu
Thu Jan 5 15:31:40 MST 2017


Hello, Dennis,

Thanks for helping me fix the WRAPIT error. It works fine now! But I have a
new question here. My NCL script can not plot my output (w_bin). I use
"gsn_csm_contour" to plot the velocity frequency changes with time and
submit the job to yellowstone. The error message is:
-------------------------------
warning:ContourPlotInitialize: X coordinates out of data range: defaulting
warning:ContourPlotInitialize: Zero X coordinate span:
defaulting:[errno=1104]
----------------------------
I think my output from WRAPIT is correct. And I use "gsn_csm_contour" to
plot before. Never have this error before.
I attached my scripts and .out file of the job.
Please help me check the problem. Thank you very much!

On Mon, Jan 2, 2017 at 10:09 AM, Dennis Shea <shea at ucar.edu> wrote:

> Yes. WRAPIT does not need any 'local' fortran variables. They can be
> placed after the 'C NCLEND' delimeter
>
> Good Luck
>
> On Fri, Dec 30, 2016 at 1:59 PM, Ying Song <ysong4 at slu.edu> wrote:
>
>> Thanks for the reply!
>>
>> You are right, Dennis. The error is caused by nbin-1, it is fixed now. I
>> want to make sure I understand you correctly. You mean the local variables
>> such as bins, bcnt, and npts need to be defined in .f script but not in
>> stub file. Stub file only care about the variables pass into or out the
>> fortran subroutine?
>>
>> Also, thanks for sending the binning function information also. Let me
>> take a look!
>>
>> On Fri, Dec 30, 2016 at 2:02 PM, Dennis Shea <shea at ucar.edu> wrote:
>>
>>> Forgot: NCL has some binning functions
>>>
>>> http://www.ncl.ucar.edu/Applications/
>>>
>>> Under "Data Analysis" ... click "Binning"
>>>
>>> See the examples. They use the following functions:
>>>
>>> http://www.ncl.ucar.edu/Document/Functions/Built-in/bin_sum.shtml
>>> http://www.ncl.ucar.edu/Document/Functions/Built-in/bin_avg.shtml
>>>
>>> On Fri, Dec 30, 2016 at 12:31 PM, Dennis Shea <shea at ucar.edu> wrote:
>>>
>>>> WRAPIT is not a complete fortran-77 parser. WRAPIT  strictly looks at
>>>> the arguments being passed between NCL (written in C) and the fortran
>>>> subroutine. The types and sizes must match.
>>>>
>>>> WRAPIT does not understand fortran 'dynamic' array sizing. Also, WRAPIT
>>>> does not allow things like redefining the array extent such as: foo(-N:N).
>>>> A stub file or is one way of addressing these limitations. NOTE: the stub
>>>> file could be a valid fortran subroutine containing the NCL delimeters [ C
>>>> NCLFORTSTART and C NCLEND ] that handles assorted issues in the fortran
>>>> world.
>>>>
>>>> That sadi:
>>>>
>>>> I speculate that the issue is the 'nbin-1' id the array declarations.
>>>> Maybe, add and 'nbin1' argument where
>>>>      nbin1 = nbin-1
>>>> and make the stub file be
>>>>
>>>> C NCLFORTSTART
>>>>         subroutine wacftd(nxx,nyx,nkx,ntx,nbin,nbin1, wa,bfra)
>>>>         integer nxx,nyx,nkx,ntx,nbin, nbin1
>>>>         real wa(nxx,nyx,nkx,ntx)                    ! input variable
>>>>
>>>> c c c real bins(ntx,nbin),bcnt(ntx,nbin-1), bfra(ntx,nbin-1)
>>>>         real  bfra(ntx,nbin1)                           ! return
>>>> variable
>>>> C NCLEND
>>>> C WRAPIT will not look at the following.
>>>>        integer npts
>>>>        real bins(ntx,nbin), bcnt(ntx,nbin-1)    ! local  ... fortran
>>>> compiler handles this
>>>>
>>>>        npts = nxx*nyx*nkx
>>>>
>>>> This would have to be added to the NCL script calling the subroutine as
>>>> a shared object.
>>>> Further, variable 'bins' is not being passed to-from the NCL script. I
>>>> can an
>>>>
>>>> ---
>>>> Re: PARAMETER statements
>>>>
>>>> WRAPIT  strictly looks at the arguments being passed between NCL
>>>> (written in C) and the fortran subroutine. The types and sizes must match.
>>>>
>>>> C NCLFORTSTART
>>>>         subroutine fooo(nxx,nyx,nkx,ntx,nbin, ........wa,.....)
>>>>         integer nxx,nyx,nkx,ntx,nbin, nbin1
>>>>         real wa(nxx,nyx,nkx,ntx)                    ! input variable
>>>> C NCLEND
>>>>         integer ii, jj                           ! WRAPIT does not care
>>>> about the following
>>>>         parameter (ii=30, jj=999)     ! baecause they are not passed
>>>> into or out the subroutine
>>>>         double precision work(ii,jj)
>>>>
>>>> ---
>>>>
>>>>
>>>> You do not have to have a stub file. A minor rearrangement
>>>>
>>>>
>>>> C NCLFORTSTART
>>>>         subroutine wacftd(nxx,nyx,nkx,ntx,nbin,nbin1, wa,bfra)
>>>>         integer nxx,nyx,nkx,ntx,nbin, nbin1
>>>>         real wa(nxx,nyx,nkx,ntx)                    ! input variable
>>>>         real  bfra(ntx,nbin1)                           ! return
>>>> variable
>>>> C NCLEND
>>>>        real bins(ntx,nbin),bcnt(ntx,nbin-1)
>>>>
>>>>
>>>>
>>>> Good luck
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Fri, Dec 30, 2016 at 11:33 AM, Ying Song <ysong4 at slu.edu> wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> I am using WRAPIT in NCL to calculate velocity frequency, following
>>>>> the ex01. After running the command:
>>>>> WRAPIT cftd.stub cftd.f
>>>>> The error shows below:
>>>>> ++++++++++++++++++++
>>>>> WRAPIT Version: 120209
>>>>> A syntax error occurred while parsing: 1
>>>>> COMPILING cftd.f
>>>>> LINKING
>>>>> END WRAPIT
>>>>> ++++++++++++++++++++
>>>>> I think there are some problems in my cftd.f script but I can not find
>>>>> it. So I write this email asking for help!
>>>>>
>>>>> cftd.f and cftd.stub are attached. Thank you very much!
>>>>>
>>>>> --
>>>>> Ying Song, PhD, Post Doctoral Fellow
>>>>> Department of Earth and Atmospheric Sciences
>>>>> Saint Louis University
>>>>>
>>>>> ysong4 at slu.edu
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> ncl-talk mailing list
>>>>> ncl-talk at ucar.edu
>>>>> List instructions, subscriber options, unsubscribe:
>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>
>>>>>
>>>>
>>>
>>
>>
>> --
>> Ying Song, PhD, Post Doctoral Fellow
>> Department of Earth and Atmospheric Sciences
>> Saint Louis University
>>
>> ysong4 at slu.edu
>>
>>
>


-- 
Ying Song, PhD, Post Doctoral Fellow
Department of Earth and Atmospheric Sciences
Saint Louis University

ysong4 at slu.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170105/adef46ce/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cftd.f
Type: text/x-fortran
Size: 1290 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170105/adef46ce/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cftd.stub
Type: application/octet-stream
Size: 260 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170105/adef46ce/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plt_wrf_wa_evo_multi_test1.ncl
Type: application/octet-stream
Size: 3113 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170105/adef46ce/attachment-0001.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wa_evo_test583865.out
Type: application/octet-stream
Size: 5698 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170105/adef46ce/attachment-0002.obj 


More information about the ncl-talk mailing list