Re: problem of WRAPIT

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu Jan 28 2010 - 08:49:59 MST

Yuhua,

As Rick pointed out offline, it's a bit difficult to debug your
program without being able to run your script.

I took some test wrf_cape_2d NCL code that I have, and modified it
slightly to call your DCAPECALC3D2 subroutine, and it worked fine. I
did get an error about my data not being in the correct range, but it
did make it into the subroutine.

You should look at every input parameter to this subroutine carefully
to make sure it's the correct size. Put some more debug print
statements, as Rick suggested, throughout your code and script.

You could even try a dummy DCAPECALC3D2 subroutine with the same
calling arguments, to make sure it's not the routine itself that's a
problem.

--Mary

On Jan 27, 2010, at 8:40 AM, Yuhua Yang wrote:

> Hi,
>
> Thanks Mary and Rick for your kindness help. I have narrowed my
> data, but it's still too large as an attachment,sorry.My data is
> coming from WRFV2.2.
>
> The ex.ncl ad ex.f works well in my machine, I got the correct
> result.
>
> I have try one test that I call wrf_cape_2d and DCAPECALC3D2 in
> the same ncl script (actually,these two functions are coming from
> the same fortran code rip_cape.f), the wrf_cape_2d works well but
> the DCAPECALC3D2 failed just after the calling, the command
> "print*,'vvvvvvvvv'" just after constant specified in rip_cape.so
> (line 581) doesn't work too, though I use the same data.
>
> So, Maybe I should use some option when WRAPIT rip_cape.f?
>
> Following is the information when I doing the ncl test
> _________________________________________________________________
> [yangyh@gateway ncl]$ ncl cptp.ncl
> Copyright (C) 1995-2009 - All Rights Reserved
> University Corporation for Atmospheric Research
> NCAR Command Language Version 5.1.0
> The use of this software is governed by a License Agreement.
> See http://www.ncl.ucar.edu/ for more details.
> (0) DX,DY = 9000 9000
> (0) Working on time: 2010012505 3
> (0) llz=34
> (1) llz=264
> (2) llz=264
> (0) llz=34
> (1) llz=264
> (2) llz=264
> (0) llz=34
> (1) llz=264
> (2) llz=264
> (0) llz=34
> (1) llz=264
> (2) llz=264
> (0) llt=264
> (1) llt=264
> (0) ll=34
> (1) ll=264
> (2) ll=264
> (0) ll==34
> (1) ll==264
> (2) ll==264
> (0) wrf_cape_2d begin ****************
> (0) wrf_cape_2d end ****************
> (0) UUUUUU UUU
> Segmentation fault
> ________________________________________________________________
>
> Thanks again!!
>
> Yuhua
> ----- Original Message -----
> From: Rick Brownrigg
> To: Yuhua Yang
> Cc: Mary Haley
> Sent: Wednesday, January 27, 2010 12:38 AM
> Subject: Re: problem of WRAPIT
>
>
> Yuhua,
>
> I can't see from the static sources that anything is wrong in your
> call to DCAPECALC3D2 from ncl. About the only thing I can suggest
> is to instrument the fortran code itself with write statements to
> dump key variables to see if what's being passed in from NCL is
> what you expect. You might also use write statements as waypoint
> markers, to narrow in on where in the code the SEGV is occurring.
>
> Rick
>
> On Jan 26, 2010, at 7:07 AM, Mary Haley wrote:
>
>> Yuhua,
>>
>> In just looking at your program, it looks like you are calling the
>> Fortran routine correctly. You appear to be passing in the arrays
>> correctly, you're using the right types, and you have the right
>> order of arguments. It also appears that you renamed all the
>> functions in rip_cape.f, which is very important so it doesn't
>> clash with existing functions already built into NCL.
>>
>> Maybe Rick will see something I don't!
>>
>> I'm unable to run your code because it depends on other NCL
>> scripts and a data file I don't have.
>>
>> Can you narrow this program way down so that we can run it? The
>> best thing to do would be to write all the variables that this
>> function depends on to a temporary NetCDF file, and then all I'll
>> need to run this script is this file.
>>
>> Here's how you might write the data to a NetCDF file:
>>
>> fout = addfile("mary.nc","c")
>> fout->prs = prs
>> fout->tmk = tmk
>> fout->qvp = qvp
>>
>> etc.
>>
>> Do this for prs, tmk, qvp, zz, hgtt, and psfcd.
>>
>> Then, I'll just be able to read in this file, and call your
>> function below:
>>
>> DCAPECALC3D2::DCAPECALC3D2
>> (prs,tmk,qvp,zz,hgtt,psfcd,cape,cin,mii,mjj,mkzh,0,1,filin)
>>
>> THanks,
>>
>> --Mary
>>
>> On Jan 25, 2010, at 11:06 PM, Yuhua Yang wrote:
>>
>>> Thanks Mary and Rick for your help very much!
>>>
>>> Now there are no problem on WRAPIT the rip_sub.f, but another
>>> problem coming. I got "Segmentation fault" when I calling the
>>> rip_sub.so, I have check my ncl script carefully but I can't find
>>> where s the error. I'm using the wrfout of WRFV2.2, and following
>>> is the information:
>>> ____________________________________________________________________
>>> _____
>>> [yangyh@gateway ncl]$ ncl cptp.ncl
>>> Copyright (C) 1995-2009 - All Rights Reserved
>>> University Corporation for Atmospheric Research
>>> NCAR Command Language Version 5.1.0
>>> The use of this software is governed by a License Agreement.
>>> See http://www.ncl.ucar.edu/ for more details.
>>> (0) DX,DY = 9000 9000
>>> (0) Working on time: 2010012505 3
>>> (0) llz=34
>>> (1) llz=264
>>> (2) llz=264
>>> (0) llz=34
>>> (1) llz=264
>>> (2) llz=264
>>> (0) llz=34
>>> (1) llz=264
>>> (2) llz=264
>>> (0) llz=34
>>> (1) llz=264
>>> (2) llz=264
>>> (0) llt=264
>>> (1) llt=264
>>> (0) ll=34
>>> (1) ll=264
>>> (2) ll=264
>>> (0) ll==34
>>> (1) ll==264
>>> (2) ll==264
>>> (0) UUUUUU UUU
>>> Segmentation fault
>>> ____________________________________________________________________
>>> ________________________
>>>
>>> Could you please check the attachment cptp.ncl for me?
>>>
>>> By the way,following is the purpose of Why I using rip_sub.f :
>>> The "wrf_cape_2d" works well on my machine, but I'd like to
>>> get the temperature of Equilibrium level,which doesn't output by
>>> wrf_cape_2d, so I have to call the rip_sub.f in order to get
>>> extra information. Does the function wrf_cape_2d is coming from
>>> rip_cape.f?
>>>
>>> Thanks again!!
>>>
>>> Yuhua
>>>
>>>
>>> ----- Original Message -----
>>> From: Mary Haley
>>> To: Rick Brownrigg
>>> Cc: Yuhua Yang ; ncl-talk@ucar.edu
>>> Sent: Tuesday, January 26, 2010 1:10 AM
>>> Subject: Re: problem of WRAPIT
>>>
>>> Thanks for catching this Rick! I was not aware of this restriction.
>>>
>>> I've added this to the "special considerations" section of the
>>> WRAPIT documentation, which is a good document to read if you are
>>> having problems with WRAPIT:
>>>
>>> http://www.ncl.ucar.edu/Document/Tools/WRAPIT.shtml
>>>
>>> --Mary
>>>
>>> On Jan 25, 2010, at 9:43 AM, Rick Brownrigg wrote:
>>>
>>>> Hi,
>>>>
>>>> The root of this error is that you declare the types of your two
>>>> embedded functions as:
>>>>
>>>> FUNCTION TONPSADIABAT(THTE,PRS,...
>>>> DOUBLE PRECISION TONPSADIABAT
>>>> ...
>>>>
>>>> FUNCTION VIRTUAL(TEMP,RATMIX)
>>>> DOUBLE PRECISION VIRTUAL
>>>> ...
>>>>
>>>> While this is legitimate fortran code, its causing an error in
>>>> the WRAPIT parsing code. Try declaring the types of the
>>>> functions with one statement, as:
>>>>
>>>> DOUBLE PRECISION FUNCTION TONPSADIABAT(THTE,PRS,...
>>>> ...
>>>> DOUBLE PRECISION FUNCTION VIRTUAL(TEMP,RATMIX)
>>>>
>>>>
>>>> Rick
>>>>
>>>>
>>>> On Jan 25, 2010, at 3:12 AM, Yuhua Yang wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> When I WRAPIT the attachment file(rip_cape.f) which coming
>>>>> from Mary, I got the following problem:
>>>>> ______________________________________________________
>>>>> WRAPIT rip_cape.f
>>>>>
>>>>> WRAPIT Version: 090115
>>>>> A syntax error occurred while parsing: TONPSADIABAT
>>>>> COMPILING rip_cape.f
>>>>> LINKING
>>>>> END WRAPIT
>>>>> ________________________________________________________
>>>>>
>>>>> The rip_cape.so file is created, but when I try to call the
>>>>> routine by my NCL script , I get the warning:
>>>>> Could not find Init() in external file ./rip_cape.so, file not
>>>>> loaded .
>>>>>
>>>>> the enviroment of my machine is linux,64-bit.
>>>>>
>>>>> Could you give me some hint to solve this problem? Thanks very
>>>>> much!
>>>>>
>>>>> Yuhua
>>>>>
>>>>>
>>>>> <rip_cape.f>
>>>>> _______________________________________________
>>>>> ncl-talk mailing list
>>>>> List instructions, subscriber options, unsubscribe:
>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>> <cptp.ncl><rip_cape.f><psadilookup.dat>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> <cptp.ncl>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jan 28 08:50:18 2010

This archive was generated by hypermail 2.1.8 : Mon Feb 01 2010 - 08:05:34 MST