[ncl-talk] Convective Temp Calculation
Brandon Sullivan
btsullivan91 at gmail.com
Tue Mar 24 08:54:53 MDT 2015
This is what I put in this am into my sounding.ncl file
;Add convective temperature
ctemp = 0.0 ; init some value
p2 = (new_p_mb)*100 ; convert to Pa
new_tk = new_tc + 273.15 ; convert to K
tk2 = new_tk
qv2 = qv/1000
levels = new_z
CONV::sndganalncl(levels,tk2,p2,qv2,u,v,ctemp)
Still not working.. If you're wondering why I had to make some new vars.
like that, it's because it didn't like me passing it things with _ for some
reason?
fatal:Number of elements of dimension (0) of argument (0) is (38) in
function (sndganalncl), expected (1) elements
Brandon Sullivan
On Mon, Mar 23, 2015 at 11:08 PM, Brandon Sullivan <btsullivan91 at gmail.com>
wrote:
> Dennis, thanks! I'm 99% there.. WRAPIT worked fine and I was able to get
> the soundings to run and generate.. I had to work a little bit with my
> variables to line up with my sounding file.. I think I have some bad math
> somewhere as all my convective temps are pretty off? Or 0.. I'm unsure
> which variable r is referencing here, when looking through the code. I
> assume mixing ratio? I've converted it to kg/kg also, but no avail.
>
> Last step, I hope!
>
>
>
> Brandon Sullivan
>
> On Mon, Mar 23, 2015 at 9:00 PM, Dennis Shea <shea at ucar.edu> wrote:
>
>> [1]
>> The *only* delimieter pair that should be in the code is the 1st pair. As
>> noted in the documentation, only the subroutines/functions called from NCL
>> should have the delimeters,
>>
>> [2]
>> I think you have 'dos' caharacters embedded in 'test.f'
>> Perhaps from the editor you used.?
>>
>> [3]
>> After removing the extra delimiters
>>
>> %> dos2unix test.f
>>
>> [4]
>> %> WRAPIT test.f
>>
>> Actually, I'm just attaching what I dd.
>>
>>
>>
>>
>>
>> On Mon, Mar 23, 2015 at 3:21 PM, Brandon Sullivan <btsullivan91 at gmail.com
>> > wrote:
>>
>>> Dennis, thanks.
>>>
>>> I added that.. Added the NCLFORTSTART/NCLEND to it, etc.. Then, I just
>>> continued to get a ton of other functions that were undefined... So, I went
>>> through and added them all one by one until finally I got no more errors..
>>> I basically have the whole sstats.f file in there..
>>>
>>> Now, I get this error - warning:Could not find Init() in external file
>>> /home/Soundings/Extra/test.so, file not loaded
>>> warning:error at line 17 in file testsounding.ncl
>>>
>>> I do get a syntax error when running WRAPIT now, too.
>>>
>>> I sincerely appreciate your continued help... New test.f attached.
>>>
>>>
>>>
>>> Brandon Sullivan
>>>
>>> On Mon, Mar 23, 2015 at 3:34 PM, Dennis Shea <shea at ucar.edu> wrote:
>>>
>>>> The .so is particular to the compiler you are using. So, it is not
>>>> generic.
>>>>
>>>> --
>>>> The error message is coming from the fortran code
>>>>
>>>> /home/Soundings/Extra/test.so: undefined symbol: theta_wetb_
>>>>
>>>> ^^^^^^^^^^^
>>>>
>>>> If you search for 'theta_wetb' in your test code, it is used but it is
>>>> not part of test,f
>>>>
>>>> Extract that from 'sstats.f' and include with your test.f
>>>>
>>>> ---
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> * function theta_wetb(thetae_K)c..c.. Eqn below was
>>>> gotten from polynomial fit to data inc.. Smithsonian
>>>> Meteorological Tables showing Theta-ec.. and Theta-wc..
>>>> real*8 c(0:6), d(0:6) data c/-1.00922292e-10, -1.47945344e-8,
>>>> -1.7303757e-6 + ,-0.00012709, 1.15849867e-6,
>>>> -3.518296861e-9 + ,3.5741522e-12/ data d/0.00000000,
>>>> -3.5223513e-10, -5.7250807e-8 + ,-5.83975422e-6, 4.72445163e-8,
>>>> -1.13402845e-10 + ,8.729580402e-14/
>>>> x=min(475.0,thetae_K) if( x .le. 335.5 ) then
>>>> answer = c(0)+x*(c(1)+x*(c(2)+x*(c(3)+x*(c(4)+x*(c(5)+ +
>>>> x*c(6) ))))) else answer =
>>>> d(0)+x*(d(1)+x*(d(2)+x*(d(3)+x*(d(4)+x*(d(5)+ + x*d(6)
>>>> ))))) endif theta_wetb = answer + 273.15 return end---*
>>>> The NCL project does have python versions called: pyNGL and pyNIO
>>>> *. *
>>>> Likely, they will have new (significantly updated) versions out in the
>>>> near future.
>>>> No promises but, perhaps, mid-to-late April 2015.
>>>>
>>>> http://www.pyngl.ucar.edu/
>>>>
>>>>
>>>> On Mon, Mar 23, 2015 at 11:30 AM, Brandon Sullivan <
>>>> btsullivan91 at gmail.com> wrote:
>>>>
>>>>> I have attached my test.so file just in case it helps... Sorry I seem
>>>>> so lost here, I am a python person!
>>>>>
>>>>> Brandon Sullivan
>>>>>
>>>>> On Mon, Mar 23, 2015 at 11:36 AM, Brandon Sullivan <
>>>>> btsullivan91 at gmail.com> wrote:
>>>>>
>>>>>> Using the test.f file that Dennis provided, I was able to run wrapit
>>>>>> successfully with no errors.
>>>>>>
>>>>>> I also went in and added this to my sounding file... With the
>>>>>> external command (it was in there before, just somewhere in the middle), to
>>>>>> the top with the load commands.
>>>>>>
>>>>>> "external CONV "./test.so"
>>>>>> ctemp = 0.0 ; create a 'space' for the returned temperature
>>>>>> CONV:: sndganalncl(nlevs,t,p,r,u,v,ctemp)"
>>>>>>
>>>>>> I still get these errors, however.
>>>>>>
>>>>>> warning:An error occurred loading the external file
>>>>>> /home/Soundings/Extra/test.so, file not loaded
>>>>>> /home/Soundings/Extra/test.so: undefined symbol: theta_wetb_
>>>>>> warning:error at line 17 in file testsounding.ncl
>>>>>>
>>>>>> Also, now this syntax error -
>>>>>>
>>>>>> fatal:syntax error: line 472 in file testsounding.ncl before or near :
>>>>>> CONV:
>>>>>> ----^
>>>>>>
>>>>>> New files attached
>>>>>>
>>>>>> Thanks so much...
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Brandon Sullivan
>>>>>>
>>>>>> On Mon, Mar 23, 2015 at 11:16 AM, Dennis Shea <shea at ucar.edu> wrote:
>>>>>>
>>>>>>> but betHello,
>>>>>>>
>>>>>>> At: https://www.ncl.ucar.edu/Document/Manuals/
>>>>>>>
>>>>>>> Please read section 7 of the Mini-Language manual
>>>>>>> ===
>>>>>>> A more detailed description s at:
>>>>>>>
>>>>>>> https://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclExtend.shtml
>>>>>>> ===
>>>>>>> Also of interest: The DKRZ has created two NCL tutorials that may be
>>>>>>> of interest.
>>>>>>> These are much broader.
>>>>>>> ===
>>>>>>>
>>>>>>> That said .....
>>>>>>> [1]
>>>>>>> You have a f77 subroutine [ test.f ]. I do not see the required
>>>>>>> delimeters
>>>>>>>
>>>>>>> C NCLFORTSTART
>>>>>>> ...
>>>>>>> C NCLEND
>>>>>>>
>>>>>>> These indicate to NCL's f77 parser what information is being passed
>>>>>>> back-and-forth between two separate languages.
>>>>>>> That is why your code gets the 'A syntax error occurred while
>>>>>>> parsing:" message,
>>>>>>>
>>>>>>> [2]
>>>>>>> To use 'external' code (f77, f90, C, C++) you must indicate that via
>>>>>>>
>>>>>>> external TEST "./,,,so" ; the shared object
>>>>>>>
>>>>>>> You did not do this.
>>>>>>>
>>>>>>> [3]
>>>>>>> Included in your argument passing, you have
>>>>>>> flminsou,frmaxsou,fbminsou,ftmaxsou
>>>>>>> Are these used? NCL does not care but if they are not used, but why
>>>>>>> are you passing them?
>>>>>>>
>>>>>>> [4]
>>>>>>> You want 'conv_temp' but you are not passing it back to NCL for
>>>>>>> plotting.
>>>>>>> In your NCL script ....
>>>>>>>
>>>>>>>
>>>>>>> external CONV "./test.so"
>>>>>>>
>>>>>>> ctemp = 0.0 ; create a 'space' for the returned temperature
>>>>>>> CONV:: sndganalncl(nlevs,t,p,r,u,v,ctemp)
>>>>>>>
>>>>>>> [5]
>>>>>>> I have done some mods for your f77 code. That should get you started.
>>>>>>>
>>>>>>> WRAPIT test.f
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Sun, Mar 22, 2015 at 8:43 PM, Brandon Sullivan <
>>>>>>> btsullivan91 at gmail.com> wrote:
>>>>>>>
>>>>>>>> Hello all,
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> I am trying to use “sstats.f” that I found here -
>>>>>>>> http://www.ncl.ucar.edu/Support/talk_archives/2010/att-2526/sstats.f
>>>>>>>>
>>>>>>>>
>>>>>>>> I pulled out the code I want and made test.f (attached)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> I am trying to use the convective temperature function from there
>>>>>>>> and plot it on my soundings (testsounding.ncl)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> I try to run WRAPIT and it says this
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> “root at ubuntu:/home/Soundings/Extra# WRAPIT test.f
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> WRAPIT Version: 120209
>>>>>>>>
>>>>>>>> A syntax error occurred while parsing:
>>>>>>>>
>>>>>>>> COMPILING test.f
>>>>>>>>
>>>>>>>> LINKING
>>>>>>>>
>>>>>>>> END WRAPIT”
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Then, when running my sounding script it says
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Copyright (C) 1995-2015 - All Rights Reserved
>>>>>>>>
>>>>>>>> University Corporation for Atmospheric Research
>>>>>>>>
>>>>>>>> NCAR Command Language Version 6.3.0
>>>>>>>>
>>>>>>>> The use of this software is governed by a License Agreement.
>>>>>>>>
>>>>>>>> See http://www.ncl.ucar.edu/ for more details.
>>>>>>>>
>>>>>>>> warning:An error occurred loading the external file
>>>>>>>> /home/Soundings/Extra/test.so, file not loaded
>>>>>>>>
>>>>>>>> /home/Soundings/Extra/test.so: undefined symbol: theta_wetb_
>>>>>>>>
>>>>>>>> warning:error at line 50 in file testsounding.ncl
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Am I going about this wrong? Is there something in the code I am
>>>>>>>> missing? I have also tried –m64 when running WRAPIT.. Thanks so much in
>>>>>>>> advance!
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Brandon
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> ncl-talk mailing list
>>>>>>>> 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/20150324/ab0e61f8/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testsounding.ncl
Type: application/octet-stream
Size: 23256 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150324/ab0e61f8/attachment.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ctemp.f
Type: application/octet-stream
Size: 13446 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150324/ab0e61f8/attachment-0001.obj
More information about the ncl-talk
mailing list