[ncl-talk] write variable in do loop

Ancy Thomas ancyt.thomas at gmail.com
Wed Sep 9 06:34:23 MDT 2015


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/20150909/facc3789/attachment.html 


More information about the ncl-talk mailing list