[ncl-talk] ncl plot getting killed

Komal Shukla komalshukla1992 at gmail.com
Wed Nov 28 02:48:25 MST 2018


Hi

I am trying to add a variable from netcdf files, and make an average plot.
My scripts is mentioned below, but the process gets killed. Maybe because
of memory.

Can you please suggest a "efficient" way of writing this? Please help.

Script ----------
begin
a = addfile("../wrfout_d01_2012-05-01_00:00:00.nc","r")

 it        = 0     ; first time step
  hgt       = wrf_user_getvar(a,"HGT_M",it)    ; Terrain elevation
  hgt at lat2d = wrf_user_getvar(a,"XLAT",it)   ; latitude/longitude
  hgt at lon2d = wrf_user_getvar(a,"XLONG",it)  ; required for plotting

  wks = gsn_open_wks("png","try1")

    FILES = systemfunc ("ls ../wrfout_d01_2012-05*") ; file paths

 numFILES = dimsizes(FILES)
 aa    = addfiles (FILES+".nc", "r")     ;add multiple files
;;;;;;;;;;;;

no = aa[:]->no
no_avg=dim_avg_n(no,0)
no2 = aa[:]->no2
no2_avg=dim_avg_n(no2,0)
oli = aa[:]->oli
oli_avg=dim_avg_n(oli,0)
csl = aa[:]->csl
csl_avg=dim_avg_n(csl,0)
olt = aa[:]->olt
olt_avg=dim_avg_n(olt,0)
xyl = aa[:]->xyl
xyl_avg=dim_avg_n(xyl,0)
ald = aa[:]->ald
ald_avg=dim_avg_n(ald,0)
hc8 = aa[:]->hc8
hc8_avg=dim_avg_n(hc8,0)
hcho = aa[:]->hcho
hcho_avg=dim_avg_n(hcho,0)
ol2 = aa[:]->ol2
ol2_avg=dim_avg_n(ol2,0)
tol = aa[:]->tol
tol_avg=dim_avg_n(tol,0)
hc5= aa[:]->hc5
hc5_avg=dim_avg_n(hc5,0)
hc3= aa[:]->hc3
hc3_avg=dim_avg_n(hc3,0)
ket= aa[:]->ket
ket_avg=dim_avg_n(ket,0)

Mpan_avg=no_avg+no2_avg+oli_avg+csl_avg+olt_avg+xyl_avg+ald_avg+hc8_avg+hcho_avg+ol2_avg+tol_avg+hc5_avg+hc3_avg+ket_avg
Mpan_avg=Mpan_avg*1000
Mpan_avg2D=Mpan_avg(0,:,:)
Mpan_avg2D at lat2d = wrf_user_getvar(a,"XLAT",it)   ; latitude/longitude
Mpan_avg2D at lon2d = wrf_user_getvar(a,"XLONG",it)  ; required for plotting
--some plotting options here--
contour = gsn_csm_contour_map(wks,Mpan_avg2D,res)
draw(contour)
  frame(wks)

Thanks
Kim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181128/e326d14e/attachment.html>


More information about the ncl-talk mailing list