<div dir="ltr"><div><div><div><div><div>Hello Madam !<br><br></div>Done the changes as you suggested :<br><br> do it = 0,ntimes-1               ; TIME LOOP<br>  td = wrf_user_getvar(a,&quot;td&quot;,it)<br>  p  = wrf_user_getvar(a,&quot;pressure&quot;,it)<br><br>  do level = 0,nlevels-1                 ; LOOP OVER LEVELS<br>  pressure = plevs(level)<br><br>  td_plane(level,:,:) = wrf_user_intrp3d(td,p,&quot;h&quot;,pressure,0.,False)<br><br> end do ; end of level loop<br> end do ; end of time loop<br> end do ; end of files loop<br> end<br><br></div>Still I am getting the same error:<br>fatal:Undefined identifier: (td_plane) is undefined, can&#39;t continue<br>^Mfatal:[&quot;Execute.c&quot;:8128]:Execute: Error occurred at or near line 49 in file wrf_td.ncl<br><br><br></div>Thanks,<br></div>regards,<br></div>Ancy<br><div><div><br><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 10, 2015 at 5:10 PM, Alessandra Giannini <span dir="ltr">&lt;<a href="mailto:alesall@iri.columbia.edu" target="_blank">alesall@iri.columbia.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Hi there,<br>
<br>
[it&#39;s a madam speaking, actually!]<br>
You should always reply to ncl-talk, not just to the person who responds…<br>
<br>
It would help if you explained what is not working…<br>
At any rate, what is the structure of the variable you call here:<br>
<span class=""><br>
&gt;   td = wrf_user_getvar(a,&quot;td&quot;,it)<br>
<br>
<br>
</span>if it has all the levels you need, just write it out.<br>
<br>
It may be that these two lines that define your variables need to sit outside/before the loops:<br>
<span class=""><br>
&gt;   td = wrf_user_getvar(a,&quot;td&quot;,it)<br>
&gt;   p  = wrf_user_getvar(a,&quot;pressure&quot;,it)<br>
<br>
<br>
</span>Otherwise you redefine them each time.<br>
Please think through what you want to accomplish, and the correct order of the steps to get there.<br>
<span class="im"><br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
--<br>
Alessandra Giannini<br>
IRI for Climate and Society - The Earth Institute at Columbia University<br>
P.O. Box 1000, Palisades NY 10964-8000<br>
phone/fax: +1 845 680-4473/4864 - email: <a href="mailto:alesall@iri.columbia.edu">alesall@iri.columbia.edu</a><br>
<br>
</span><div class=""><div class="h5">On Sep 10, 2015, at 6:54 AM, Ancy Thomas &lt;<a href="mailto:ancyt.thomas@gmail.com">ancyt.thomas@gmail.com</a>&gt; wrote:<br>
<br>
&gt; Hello Sir,<br>
&gt;<br>
&gt; Thanks for the response.<br>
&gt;<br>
&gt; Yes, I want to write the data variable for each level in a loop. The program is given below: How should I modify .<br>
&gt;<br>
&gt; ************************************************<br>
&gt; begin<br>
&gt; datadir = systemfunc(&quot;tail -1 fil&quot;)<br>
&gt; FILES = systemfunc (&quot;ls -1 &quot; + datadir + &quot;wrfout_d02* &quot; )<br>
&gt; numFILES = dimsizes(FILES)<br>
&gt; ;;***************Pressure levels **********<br>
&gt;  plevs = (/ 925., 850., 700., 600., 500., 300., 200./)   ; pressure levels to plot<br>
&gt;  nlevels         = dimsizes(plevs)     ; number of pressure levels<br>
&gt;<br>
&gt; do ifil = 0,numFILES-1<br>
&gt;    a = addfile(FILES(ifil)+&quot;.nc&quot;,&quot;r&quot;)<br>
&gt;<br>
&gt; ; What times and how many time steps are in the data set<br>
&gt; times  = wrf_user_list_times(a)  ; get times in the file<br>
&gt;   ntimes = dimsizes(times)       ; number of times in the file<br>
&gt; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br>
&gt;<br>
&gt; ;Read in constant variables<br>
&gt;       xlat  = wrf_user_getvar(a, &quot;XLAT&quot;,0)<br>
&gt;       xlon  = wrf_user_getvar(a, &quot;XLONG&quot;,0)<br>
&gt;       hght   = wrf_user_getvar(a, &quot;HGT&quot;,0)<br>
&gt;<br>
&gt; ; writing data into netcdf format<br>
&gt;     system(&quot;rm -f <a href="http://wrfout.nc" rel="noreferrer" target="_blank">wrfout.nc</a>&quot;)<br>
&gt;     fw = addfile(&quot;<a href="http://wrfout.nc" rel="noreferrer" target="_blank">wrfout.nc</a>&quot;, &quot;c&quot;)<br>
&gt;<br>
&gt; ; writing the dimensions time, level, lat, lon<br>
&gt;   fw-&gt;xlat = xlat<br>
&gt;   fw-&gt;xlon = xlon<br>
&gt;<br>
&gt; ;;*************************<br>
&gt;   do it = 0,ntimes-1               ; TIME LOOP<br>
&gt;<br>
&gt;   do level = 0,nlevels-1                 ; LOOP OVER LEVELS<br>
&gt;<br>
&gt;   pressure = plevs(level)<br>
&gt;<br>
&gt;   td = wrf_user_getvar(a,&quot;td&quot;,it)<br>
&gt;   p  = wrf_user_getvar(a,&quot;pressure&quot;,it)<br>
&gt;<br>
&gt;   td_plane(level,:,:) = wrf_user_intrp3d(td,p,&quot;h&quot;,pressure,0.,False)<br>
&gt;<br>
&gt;  end do ; end of level loop<br>
&gt;  end do ; end of time loop<br>
&gt;  end do ; end of files loop<br>
&gt;  end<br>
&gt;<br>
&gt;<br>
&gt; Thanks,<br>
&gt; Best regards,<br>
&gt; Ancy<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Thu, Sep 10, 2015 at 4:04 PM, Alessandra Giannini &lt;<a href="mailto:alesall@iri.columbia.edu">alesall@iri.columbia.edu</a>&gt; wrote:<br>
&gt;<br>
&gt; Hi there,<br>
&gt;<br>
&gt; I am not familiar with the &quot;wrf&quot; commands you use, but you are asking it to overwrite levels with this line:<br>
&gt;<br>
&gt; &gt; fw-&gt;u_plane = u_plane<br>
&gt;<br>
&gt;<br>
&gt; Do you need to write the levels out separately, meaning do you need a do-loop to begin with?<br>
&gt; If you have all the data in a variable, it may be preferable to select the time and levels you want to write out with coordinate selection, and write out all in one go.<br>
&gt;<br>
&gt; warm regards<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Alessandra Giannini<br>
&gt; IRI for Climate and Society - The Earth Institute at Columbia University<br>
&gt; P.O. Box 1000, Palisades NY 10964-8000<br>
&gt; phone/fax: +1 845 680-4473/4864 - email: <a href="mailto:alesall@iri.columbia.edu">alesall@iri.columbia.edu</a><br>
&gt;<br>
&gt; On Sep 10, 2015, at 12:26 AM, Ancy Thomas &lt;<a href="mailto:ancyt.thomas@gmail.com">ancyt.thomas@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; &gt; Could anyone please help for this query.<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; On Wed, Sep 9, 2015 at 6:04 PM, Ancy Thomas &lt;<a href="mailto:ancyt.thomas@gmail.com">ancyt.thomas@gmail.com</a>&gt; wrote:<br>
&gt; &gt; Hello all,<br>
&gt; &gt; Greetings!<br>
&gt; &gt;<br>
&gt; &gt; I want to write a variable in do loop. But it is writing the data only for the last level(200hpa), ie; data is getting over written for each level. How to save the u_plane data as array?<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; ;;***************Pressure levels **********<br>
&gt; &gt;  plevs = (/ 925., 850., 700., 600., 500., 300., 200./)   ; pressure levels to plot<br>
&gt; &gt;  nlevels         = dimsizes(plevs)     ; number of pressure levels<br>
&gt; &gt;<br>
&gt; &gt; ; writing data into netcdf format<br>
&gt; &gt;     system(&quot;rm -f <a href="http://wrfout.nc" rel="noreferrer" target="_blank">wrfout.nc</a>&quot;)<br>
&gt; &gt;     fw = addfile(&quot;<a href="http://wrfout.nc" rel="noreferrer" target="_blank">wrfout.nc</a>&quot;, &quot;c&quot;)<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; ; writing the dimensions time, level, lat, lon<br>
&gt; &gt;<br>
&gt; &gt; ;  fw-&gt;xlev = xlev<br>
&gt; &gt;   fw-&gt;xlat = xlat<br>
&gt; &gt;   fw-&gt;xlon = xlon<br>
&gt; &gt;<br>
&gt; &gt;  do it = 0,ntimes-1               ; TIME LOOP<br>
&gt; &gt;<br>
&gt; &gt;  do level = 0,nlevels-1                 ; LOOP OVER LEVELS<br>
&gt; &gt; u    = wrf_user_getvar(a,&quot;U&quot;,it)<br>
&gt; &gt;<br>
&gt; &gt; u_plane    = wrf_user_intrp3d(u,p,&quot;h&quot;,pressure,0.,False)<br>
&gt; &gt;<br>
&gt; &gt; fw-&gt;u_plane = u_plane<br>
&gt; &gt;<br>
&gt; &gt; end do ; level loop<br>
&gt; &gt; end do ; time loop<br>
&gt; &gt;<br>
&gt; &gt; Kindly help to resolve the issue.<br>
&gt; &gt;<br>
&gt; &gt; Thank you,<br>
&gt; &gt; With regards,<br>
&gt; &gt; --<br>
&gt; &gt; Ancy Thomas,<br>
&gt; &gt; Computational Earth Science Group / HPC application Group<br>
&gt; &gt; CDAC<br>
&gt; &gt; Pune<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; --<br>
&gt; &gt;<br>
&gt; &gt; _______________________________________________<br>
&gt; &gt; ncl-talk mailing list<br>
&gt; &gt; <a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
&gt; &gt; List instructions, subscriber options, unsubscribe:<br>
&gt; &gt; <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
<br>
</div></div></blockquote></div><br><br clear="all"><br><div class="gmail_signature"><div dir="ltr"><br></div></div>
</div></div></div></div></div></div>