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

Mary Haley haley at ucar.edu
Thu Jan 5 17:50:41 MST 2017


Ying,

Your w_bin array is 100 x 61. Since you didn't provide any X/Y coordinates
for this data, NCL will draw the plot with the Y axis ranging from 0 to 99
and the X axis ranging from 0 to 60.

You set:

res at trXMaxF = 61

which is out of the range of the actual X axis, so that's why you got the "X
coordinates out of data range" error. This may have also been the cause of
the second warning as well.

You also set:

  res at trYMinF            = 0.0   ; Limits for Y axis. percentage from 0 to
100.
  res at trYMaxF            = 1.0

Your Y axis is going from 0 to 99, so if you set it to go from 0 to 1, you
are only seeing a very small subset of your data, and actually, this may
have caused the second warning.

I suggest first plotting your data without setting *any* trX/YMin/MaxF
resources.  Then, when you see what the X and Y axis looks like, you can
decide what values you want to set these resources to.

--Mary


On Thu, Jan 5, 2017 at 3:31 PM, Ying Song <ysong4 at slu.edu> wrote:

> 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
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170105/4fd82782/attachment.html 


More information about the ncl-talk mailing list