<div dir="ltr"><div>No progress this side !<br></div><div><br></div><div>Included the suggested changes:<br><br> nlat = dimsizes(xlat)<br> nlon = dimsizes(xlon)<br><br>;;*************************<br> do it = 0,ntimes-1 ; TIME LOOP<br><br> td = wrf_user_getvar(a,"td",it)<br> p = wrf_user_getvar(a,"pressure",it)<br><br> td_plane = new((/nlevels,nlat,nlon/),typeof(td))<br><br> do level = 0,nlevels-1 ; LOOP OVER LEVELS<br> pressure = plevs(level)<br><br> td_plane(level,:,:) = wrf_user_intrp3d(td,p,"h",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><div class="gmail_extra">Error: <br>fatal:_NclBuildArray: each element of a literal array must have the same dimension sizes, at least one item doesn't<br>^Mfatal:["Execute.c":8128]:Execute: Error occurred at or near line 49 in file wrf_td.ncl<br><br></div><div class="gmail_extra">Thanks,<br></div><div class="gmail_extra">Ancy<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 10, 2015 at 5:47 PM, Alessandra Giannini <span dir="ltr"><<a href="mailto:alesall@iri.columbia.edu" target="_blank">alesall@iri.columbia.edu</a>></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>
All right… Making progress!<br>
<br>
What you need to do is define the variable td_plane BEFORE the loop, using the new command:<br>
<br>
<<a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/new.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/Document/Functions/Built-in/new.shtml</a>><br>
<br>
Something like:<br>
<br>
td_plane = new((/nlevels,nlat, nlon/),typeof(td))<br>
<div class=""><div class="h5"><br>
<br>
<br>
<br>
<br>
<br>
<br>
On Sep 10, 2015, at 8:02 AM, Ancy Thomas <<a href="mailto:ancyt.thomas@gmail.com">ancyt.thomas@gmail.com</a>> wrote:<br>
<br>
> Hello Madam !<br>
><br>
> Done the changes as you suggested :<br>
><br>
> do it = 0,ntimes-1 ; TIME LOOP<br>
> td = wrf_user_getvar(a,"td",it)<br>
> p = wrf_user_getvar(a,"pressure",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,"h",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>
> Still I am getting the same error:<br>
> fatal:Undefined identifier: (td_plane) is undefined, can't continue<br>
> ^Mfatal:["Execute.c":8128]:Execute: Error occurred at or near line 49 in file wrf_td.ncl<br>
><br>
><br>
> Thanks,<br>
> regards,<br>
> Ancy<br>
><br>
><br>
> On Thu, Sep 10, 2015 at 5:10 PM, Alessandra Giannini <<a href="mailto:alesall@iri.columbia.edu">alesall@iri.columbia.edu</a>> wrote:<br>
><br>
> Hi there,<br>
><br>
> [it'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>
><br>
> > td = wrf_user_getvar(a,"td",it)<br>
><br>
><br>
> 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>
><br>
> > td = wrf_user_getvar(a,"td",it)<br>
> > p = wrf_user_getvar(a,"pressure",it)<br>
><br>
><br>
> 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>
><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>
> On Sep 10, 2015, at 6:54 AM, Ancy Thomas <<a href="mailto:ancyt.thomas@gmail.com">ancyt.thomas@gmail.com</a>> wrote:<br>
><br>
> > Hello Sir,<br>
> ><br>
> > Thanks for the response.<br>
> ><br>
> > Yes, I want to write the data variable for each level in a loop. The program is given below: How should I modify .<br>
> ><br>
> > ************************************************<br>
> > begin<br>
> > datadir = systemfunc("tail -1 fil")<br>
> > FILES = systemfunc ("ls -1 " + datadir + "wrfout_d02* " )<br>
> > numFILES = dimsizes(FILES)<br>
> > ;;***************Pressure levels **********<br>
> > plevs = (/ 925., 850., 700., 600., 500., 300., 200./) ; pressure levels to plot<br>
> > nlevels = dimsizes(plevs) ; number of pressure levels<br>
> ><br>
> > do ifil = 0,numFILES-1<br>
> > a = addfile(FILES(ifil)+".nc","r")<br>
> ><br>
> > ; What times and how many time steps are in the data set<br>
> > times = wrf_user_list_times(a) ; get times in the file<br>
> > ntimes = dimsizes(times) ; number of times in the file<br>
> > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br>
> ><br>
> > ;Read in constant variables<br>
> > xlat = wrf_user_getvar(a, "XLAT",0)<br>
> > xlon = wrf_user_getvar(a, "XLONG",0)<br>
> > hght = wrf_user_getvar(a, "HGT",0)<br>
> ><br>
> > ; writing data into netcdf format<br>
> > system("rm -f <a href="http://wrfout.nc" rel="noreferrer" target="_blank">wrfout.nc</a>")<br>
> > fw = addfile("<a href="http://wrfout.nc" rel="noreferrer" target="_blank">wrfout.nc</a>", "c")<br>
> ><br>
> > ; writing the dimensions time, level, lat, lon<br>
> > fw->xlat = xlat<br>
> > fw->xlon = xlon<br>
> ><br>
> > ;;*************************<br>
> > do it = 0,ntimes-1 ; TIME LOOP<br>
> ><br>
> > do level = 0,nlevels-1 ; LOOP OVER LEVELS<br>
> ><br>
> > pressure = plevs(level)<br>
> ><br>
> > td = wrf_user_getvar(a,"td",it)<br>
> > p = wrf_user_getvar(a,"pressure",it)<br>
> ><br>
> > td_plane(level,:,:) = wrf_user_intrp3d(td,p,"h",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>
> ><br>
> > Thanks,<br>
> > Best regards,<br>
> > Ancy<br>
> ><br>
> ><br>
> ><br>
> > On Thu, Sep 10, 2015 at 4:04 PM, Alessandra Giannini <<a href="mailto:alesall@iri.columbia.edu">alesall@iri.columbia.edu</a>> wrote:<br>
> ><br>
> > Hi there,<br>
> ><br>
> > I am not familiar with the "wrf" commands you use, but you are asking it to overwrite levels with this line:<br>
> ><br>
> > > fw->u_plane = u_plane<br>
> ><br>
> ><br>
> > Do you need to write the levels out separately, meaning do you need a do-loop to begin with?<br>
> > 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>
> ><br>
> > warm regards<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>
> > On Sep 10, 2015, at 12:26 AM, Ancy Thomas <<a href="mailto:ancyt.thomas@gmail.com">ancyt.thomas@gmail.com</a>> wrote:<br>
> ><br>
> > > Could anyone please help for this query.<br>
> > ><br>
> > ><br>
> > ><br>
> > > On Wed, Sep 9, 2015 at 6:04 PM, Ancy Thomas <<a href="mailto:ancyt.thomas@gmail.com">ancyt.thomas@gmail.com</a>> wrote:<br>
> > > Hello all,<br>
> > > Greetings!<br>
> > ><br>
> > > 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>
> > ><br>
> > ><br>
> > > ;;***************Pressure levels **********<br>
> > > plevs = (/ 925., 850., 700., 600., 500., 300., 200./) ; pressure levels to plot<br>
> > > nlevels = dimsizes(plevs) ; number of pressure levels<br>
> > ><br>
> > > ; writing data into netcdf format<br>
> > > system("rm -f <a href="http://wrfout.nc" rel="noreferrer" target="_blank">wrfout.nc</a>")<br>
> > > fw = addfile("<a href="http://wrfout.nc" rel="noreferrer" target="_blank">wrfout.nc</a>", "c")<br>
> > ><br>
> > ><br>
> > > ; writing the dimensions time, level, lat, lon<br>
> > ><br>
> > > ; fw->xlev = xlev<br>
> > > fw->xlat = xlat<br>
> > > fw->xlon = xlon<br>
> > ><br>
> > > do it = 0,ntimes-1 ; TIME LOOP<br>
> > ><br>
> > > do level = 0,nlevels-1 ; LOOP OVER LEVELS<br>
> > > u = wrf_user_getvar(a,"U",it)<br>
> > ><br>
> > > u_plane = wrf_user_intrp3d(u,p,"h",pressure,0.,False)<br>
> > ><br>
> > > fw->u_plane = u_plane<br>
> > ><br>
> > > end do ; level loop<br>
> > > end do ; time loop<br>
> > ><br>
> > > Kindly help to resolve the issue.<br>
> > ><br>
> > > Thank you,<br>
> > > With regards,<br>
> > > --<br>
> > > Ancy Thomas,<br>
> > > Computational Earth Science Group / HPC application Group<br>
> > > CDAC<br>
> > > Pune<br>
> > ><br>
> > ><br>
> > ><br>
> > ><br>
> > > --<br>
> > ><br>
> > > _______________________________________________<br>
> > > ncl-talk mailing list<br>
> > > <a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
> > > List instructions, subscriber options, unsubscribe:<br>
> > > <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
><br>
><br>
><br>
><br>
><br>
<br>
</div></div></blockquote></div><br><div class="gmail_signature"><div dir="ltr"><br></div></div>
</div></div>