<div dir="ltr">Dennis and all... I have decided to take a different approach here.. As you mentioned, the other code is very sloppy, and really I haven't been able to get a good result with it. <div><br></div><div>I am trying a new method now. I will assume you are all familiar with calculating convective temperature from a sounding. What I have done now is taken a "top down" approach. I loop through and find where the saturation mixing ratio (k) - mixing ratio (sfc) becomes greater than 0.. This is effectively locating the CCL. From there I just use poisson's equation to calculate the temperature that parcel would have at the surface, thus calculating convective temperature.</div><div><br></div><div>This works pretty decent, except it's a few degrees off.. Given the data may exist on x vertical levels, there is a high likelihood that the actual CCL occurs between two points in the sounding. Thus my convective temperature is a few degrees off, because it feels the height of the CCL is different.</div><div><br></div><div>To solve this, I figure doing some sort of interpolation is the only answer, but I have struggled to do this correctly.. I have tried ispan, and wrf_interp_1d (those aren't in here now since it wasn't working) but I am not sure how to do it correctly. I need to create a new pressure array to interpolate to? I was trying to do something like ispan(101300,2000,100) to get a new pressure array in 1mb increments or something. That was probably too dramatic. </div><div><br></div><div>If this is the case, should I interpolate all my variables from the beginning? </div><div><br></div><div>Thanks so much in advance.</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature">Brandon Sullivan</div></div>
<br><div class="gmail_quote">On Wed, Mar 25, 2015 at 9:52 PM, Dennis Shea <span dir="ltr"><<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><div><div><div>I have looked. I do not see anything wrong.<br><br></div><div>(1) The code *is* 'sloppy'. <br> Please note that the sstats.f is *not* NCL supported code. <br> A poster sent it to ncl-talk for some purpose.<br></div><div> <br></div><div><br></div>(2) r is the mixing ratio (kg/kg).<br><br></div>(4) The 'conv_temp' is the minimum of the two quantities.<br></div> Maybe add this prior to returning<br><br></div> conv_temp = min(323.15,thccl * (p(1)/100000.0)**RCP)<br></div> write(6,*) conv_temp, thccl, p(1)<br><br></div>(5) ALso ... upon input ... make sure the data is what you think it should be.<br><br> logical is_lfc<br><br> write(6,*) "nlevs=",nlevs<br> do n=1,nlevs<br> write(6,*) 'n =',n,' p=',p(n),' t=',t(n),' r=',r(n)<br> end do<br><br></div>Not sure I can be much ore help.<br><br></div>Regards<span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888">D<br><div><div><div><div><br><div><div><br></div></div></div></div></div></div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 25, 2015 at 7:35 AM, Brandon Sullivan <span dir="ltr"><<a href="mailto:btsullivan91@gmail.com" target="_blank">btsullivan91@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks Dennis, I completely understand! I appreciate it very much.</div><div class="gmail_extra"><span><font color="#888888"><br clear="all"><div><div>Brandon Sullivan</div></div></font></span><div><div>
<br><div class="gmail_quote">On Wed, Mar 25, 2015 at 8:34 AM, Dennis Shea <span dir="ltr"><<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>offline<br><br></div>I work only part-time. <br><br></div>Hopefully I will have time to look today. I have some of my own job to do.<span><font color="#888888"><br><br></font></span></div><span><font color="#888888">D<br></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 24, 2015 at 4:40 PM, Brandon Sullivan <span dir="ltr"><<a href="mailto:btsullivan91@gmail.com" target="_blank">btsullivan91@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">All,<div><br></div><div>I went through and have fixed my arrays and gotten it down to this.. I just can't figure out<div><br></div><div>1) What is r? Is it water vapor mixing ratio here? I am assuming this, and using the ncl function to calculate mixing ratio.</div><div>2) What units is ctemp provided in? The code is hard to follow for me.</div><div><br></div><div>I added print functions to verify my arrays and they look good. Latest sounding file attached.</div><span><font color="#888888"><div><br></div></font></span></div></div><div class="gmail_extra"><span><font color="#888888"><br clear="all"><div><div>Brandon Sullivan</div></div></font></span><div><div>
<br><div class="gmail_quote">On Tue, Mar 24, 2015 at 9:54 AM, Brandon Sullivan <span dir="ltr"><<a href="mailto:btsullivan91@gmail.com" target="_blank">btsullivan91@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">This is what I put in this am into my sounding.ncl file<div><br></div><div><div>;Add convective temperature</div><div>ctemp = 0.0 ; init some value</div><div>p2 = (new_p_mb)*100 ; convert to Pa</div><div>new_tk = new_tc + 273.15 ; convert to K</div><div>tk2 = new_tk</div><div>qv2 = qv/1000</div><div>levels = new_z</div><div>CONV::sndganalncl(levels,tk2,p2,qv2,u,v,ctemp)</div></div><div><br></div><div>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?</div><div><br></div><div><div>fatal:Number of elements of dimension (0) of argument (0) is (38) in function (sndganalncl), expected (1) elements</div></div><span><font color="#888888"><div><br></div><div><br></div><div><br></div><div><br></div></font></span></div><div class="gmail_extra"><span><font color="#888888"><br clear="all"><div><div>Brandon Sullivan</div></div></font></span><div><div>
<br><div class="gmail_quote">On Mon, Mar 23, 2015 at 11:08 PM, Brandon Sullivan <span dir="ltr"><<a href="mailto:btsullivan91@gmail.com" target="_blank">btsullivan91@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>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.</div><div><br></div><div>Last step, I hope!</div><span><font color="#888888"><div><br></div><div><br></div></font></span></div><div class="gmail_extra"><span><font color="#888888"><br clear="all"><div><div>Brandon Sullivan</div></div></font></span><div><div>
<br><div class="gmail_quote">On Mon, Mar 23, 2015 at 9:00 PM, Dennis Shea <span dir="ltr"><<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div>[1]<br>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,<br><br>[2]<br></div>I think you have 'dos' caharacters embedded in 'test.f'<br></div>Perhaps from the editor you used.?<br><br>[3] <br></div>After removing the extra delimiters<br><br></div>%> dos2unix test.f<br><br>[4]<br></div>%> WRAPIT test.f<br><br></div>Actually, I'm just attaching what I dd.<br><br><br><div><div><div><div><br><br></div></div></div></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 23, 2015 at 3:21 PM, Brandon Sullivan <span dir="ltr"><<a href="mailto:btsullivan91@gmail.com" target="_blank">btsullivan91@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Dennis, thanks.<div><br></div><div>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..</div><div><br></div><div>Now, I get this error - warning:Could not find Init() in external file /home/Soundings/Extra/test.so, file not loaded</div><span><div>warning:error at line 17 in file testsounding.ncl</div><div><br></div></span><div>I do get a syntax error when running WRAPIT now, too.</div><div><br></div><div>I sincerely appreciate your continued help... New test.f attached.</div><span><font color="#888888"><div><br></div><div><br></div></font></span></div><div class="gmail_extra"><span><font color="#888888"><br clear="all"><div><div>Brandon Sullivan</div></div></font></span><div><div>
<br><div class="gmail_quote">On Mon, Mar 23, 2015 at 3:34 PM, Dennis Shea <span dir="ltr"><<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div>The .so is particular to the compiler you are using. So, it is not generic.<br><br>--<br></div>The error message is coming from the fortran code<br><br><span><span style="font-size:12.8px">/home/Soundings/Extra/test.so: undefined symbol: theta_wetb_<br> ^^^^^^^^^^^<br><br></span></span></div><span><span style="font-size:12.8px">If you search for 'theta_wetb' in your test code, it is used but it is not part of test,f<br><br></span></span></div><span><span style="font-size:12.8px">Extract that from 'sstats.f' and include with your test.f<br><br>---<br><b> function theta_wetb(thetae_K)<br>c..<br>c.. Eqn below was gotten from polynomial fit to data in<br>c.. Smithsonian Meteorological Tables showing Theta-e<br>c.. and Theta-w<br>c..<br> real*8 c(0:6), d(0:6)<br> data c/-1.00922292e-10, -1.47945344e-8, -1.7303757e-6<br> + ,-0.00012709, 1.15849867e-6, -3.518296861e-9<br> + ,3.5741522e-12/<br> data d/0.00000000, -3.5223513e-10, -5.7250807e-8<br> + ,-5.83975422e-6, 4.72445163e-8, -1.13402845e-10<br> + ,8.729580402e-14/<br><br> x=min(475.0,thetae_K)<br> <br> if( x .le. 335.5 ) then<br> answer = c(0)+x*(c(1)+x*(c(2)+x*(c(3)+x*(c(4)+x*(c(5)+<br> + x*c(6) )))))<br> else<br> answer = d(0)+x*(d(1)+x*(d(2)+x*(d(3)+x*(d(4)+x*(d(5)+<br> + x*d(6) )))))<br> endif<br><br> theta_wetb = answer + 273.15<br><br> return<br> end<br><br>---<br><br></b></span></span></div><span><span style="font-size:12.8px">The NCL project does have<b> </b>python versions called: pyNGL and pyNIO<b>. <br></b></span></span></div><span><span style="font-size:12.8px">Likely, they will have new (significantly updated) versions out in the near future.<br></span></span></div><span><span style="font-size:12.8px">No promises but, perhaps, mid-to-late April 2015. <br><br><a href="http://www.pyngl.ucar.edu/" target="_blank">http://www.pyngl.ucar.edu/</a><br></span></span><div><div><div><span><span style="font-size:12.8px"><br></span></span></div></div></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 23, 2015 at 11:30 AM, Brandon Sullivan <span dir="ltr"><<a href="mailto:btsullivan91@gmail.com" target="_blank">btsullivan91@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I have attached my test.so file just in case it helps... Sorry I seem so lost here, I am a python person! </div><div class="gmail_extra"><span><font color="#888888"><br clear="all"><div><div>Brandon Sullivan</div></div></font></span><div><div>
<br><div class="gmail_quote">On Mon, Mar 23, 2015 at 11:36 AM, Brandon Sullivan <span dir="ltr"><<a href="mailto:btsullivan91@gmail.com" target="_blank">btsullivan91@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Using the test.f file that Dennis provided, I was able to run wrapit successfully with no errors.</div><div><br></div><div>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. </div><span><div><br></div><div>"<span style="font-size:12.8000001907349px">external CONV "./test.so" </span><span style="font-size:12.8000001907349px"> </span></div><span style="font-size:12.8000001907349px">ctemp = 0.0 ; create a 'space' for the returned temperature</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">CONV:: sndganalncl(nlevs,t,p,r,u,v,</span><span style="font-size:12.8000001907349px">ctemp)"</span><div><span style="font-size:12.8000001907349px"><br></span></div></span><div><span style="font-size:12.8000001907349px">I still get these errors, however. </span></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span><div><span style="font-size:12.8000001907349px">warning:An error occurred loading the external file /home/Soundings/Extra/test.so, file not loaded</span></div><div><span style="font-size:12.8000001907349px">/home/Soundings/Extra/test.so: undefined symbol: theta_wetb_</span></div></span><div><span style="font-size:12.8000001907349px">warning:error at line 17 in file testsounding.ncl</span></div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">Also, now this syntax error - </div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">fatal:syntax error: line 472 in file testsounding.ncl before or near :</span></div><div><span style="font-size:12.8000001907349px">CONV:</span></div><div><span style="font-size:12.8000001907349px"> ----^</span></div><div><br></div><div>New files attached</div><div><br></div><div>Thanks so much...</div><span><font color="#888888"><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px"><br></span><div><br></div></div></font></span></div></div><div class="gmail_extra"><span><font color="#888888"><br clear="all"><div><div>Brandon Sullivan</div></div></font></span><div><div>
<br><div class="gmail_quote">On Mon, Mar 23, 2015 at 11:16 AM, Dennis Shea <span dir="ltr"><<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div> but betHello,<br><br></div><div>At: <a href="https://www.ncl.ucar.edu/Document/Manuals/" target="_blank">https://www.ncl.ucar.edu/Document/Manuals/</a><br></div><div><br></div>Please read section 7 of the Mini-Language manual<br>===<br></div><div>A more detailed description s at:<br> <a href="https://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclExtend.shtml" target="_blank">https://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclExtend.shtml</a><br>===<br></div><div>Also of interest: The DKRZ has created two NCL tutorials that may be of interest.<br></div>These are much broader.<br></div><div>===<br><br></div>That said .....<br>[1]<br>You have a f77 subroutine [ test.f ]. I do not see the required delimeters<br><br></div><div>C NCLFORTSTART<br>...<br></div><div>C NCLEND<br><br></div><div>These indicate to NCL's f77 parser what information is being passed back-and-forth between two separate languages.<br></div><div>That is why your code gets the 'A syntax error occurred while parsing:" message,<br><br>[2] <br></div><div>To use 'external' code (f77, f90, C, C++) you must indicate that via<br><br></div><div> external TEST "./,,,so" ; the shared object<br><br></div><div>You did not do this.<br></div><div><br>[3] <br></div><div>Included in your argument passing, you have<br> flminsou,frmaxsou,fbminsou,ftmaxsou<br></div><div>Are these used? NCL does not care but if they are not used, but why are you passing them?<br><br>[4]<br></div><div>You want 'conv_temp' but you are not passing it back to NCL for plotting.<br></div><div>In your NCL script ....<br></div><div><br></div><div><br></div><div>external CONV "./test.so" <br><br>ctemp = 0.0 ; create a 'space' for the returned temperature<br>CONV:: sndganalncl(nlevs,t,p,r,u,v,ctemp)<br><br>[5]<br></div><div>I have done some mods for your f77 code. That should get you started.<br><br></div><div> WRAPIT test.f<br></div><div><br></div><div> <br></div> <br><div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote"><span>On Sun, Mar 22, 2015 at 8:43 PM, Brandon Sullivan <span dir="ltr"><<a href="mailto:btsullivan91@gmail.com" target="_blank">btsullivan91@gmail.com</a>></span> wrote:<br></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div link="#0563C1" vlink="#954F72" lang="EN-US"><div><p class="MsoNormal">Hello all,<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I am trying to use “sstats.f” that I found here - <a href="http://www.ncl.ucar.edu/Support/talk_archives/2010/att-2526/sstats.f" target="_blank">http://www.ncl.ucar.edu/Support/talk_archives/2010/att-2526/sstats.f</a><u></u><u></u></p><p class="MsoNormal"><br>I pulled out the code I want and made test.f (attached)<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I am trying to use the convective temperature function from there and plot it on my soundings (testsounding.ncl)<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I try to run WRAPIT and it says this <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">“root@ubuntu:/home/Soundings/Extra# WRAPIT test.f<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">WRAPIT Version: 120209<u></u><u></u></p><p class="MsoNormal">A syntax error occurred while parsing:<u></u><u></u></p><p class="MsoNormal">COMPILING test.f<u></u><u></u></p><p class="MsoNormal">LINKING<u></u><u></u></p><p class="MsoNormal">END WRAPIT”<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Then, when running my sounding script it says <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Copyright (C) 1995-2015 - All Rights Reserved<u></u><u></u></p><p class="MsoNormal"> University Corporation for Atmospheric Research<u></u><u></u></p><p class="MsoNormal"> NCAR Command Language Version 6.3.0<u></u><u></u></p><p class="MsoNormal"> The use of this software is governed by a License Agreement.<u></u><u></u></p><p class="MsoNormal"> See <a href="http://www.ncl.ucar.edu/" target="_blank">http://www.ncl.ucar.edu/</a> for more details.<u></u><u></u></p><p class="MsoNormal">warning:An error occurred loading the external file /home/Soundings/Extra/test.so, file not loaded<u></u><u></u></p><p class="MsoNormal">/home/Soundings/Extra/test.so: undefined symbol: theta_wetb_<u></u><u></u></p><p class="MsoNormal">warning:error at line 50 in file testsounding.ncl<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">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!<span><font color="#888888"><u></u><u></u></font></span></p><span><font color="#888888"><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Brandon<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p></font></span></div></div><br></div></div><span>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></span></blockquote></div><br></div>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>