[ncl-talk] write variable in do loop

Ancy Thomas ancyt.thomas at gmail.com
Wed Sep 9 22:26:39 MDT 2015


Could anyone please help for this query.



On Wed, Sep 9, 2015 at 6:04 PM, Ancy Thomas <ancyt.thomas at gmail.com> wrote:

> Hello all,
> Greetings!
>
> 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?
>
>
> ;;***************Pressure levels **********
>  plevs = (/ 925., 850., 700., 600., 500., 300., 200./)   ; pressure levels
> to plot
>  nlevels         = dimsizes(plevs)     ; number of pressure levels
>
> ; writing data into netcdf format
>     system("rm -f wrfout.nc")
>     fw = addfile("wrfout.nc", "c")
>
>
> ; writing the dimensions time, level, lat, lon
>
> ;  fw->xlev = xlev
>   fw->xlat = xlat
>   fw->xlon = xlon
>
>  do it = 0,ntimes-1               ; TIME LOOP
>
>  do level = 0,nlevels-1                 ; LOOP OVER LEVELS
> u    = wrf_user_getvar(a,"U",it)
>
> u_plane    = wrf_user_intrp3d(u,p,"h",pressure,0.,False)
>
> fw->u_plane = u_plane
>
> end do ; level loop
> end do ; time loop
>
> Kindly help to resolve the issue.
>
> Thank you,
> With regards,
> --
> Ancy Thomas,
> Computational Earth Science Group / HPC application Group
> CDAC
> Pune
>
>


--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150910/ef3ccda8/attachment.html 


More information about the ncl-talk mailing list