Hi,
Initially I was extracting 4 variables from Eta 12 km grib files, now I'm
trying to extract 11 additional variables. I
editted the script, and it worked, but the run time went from ~1 minute to
~30 minutes per job. Here's the code -
; Set the variables to be converted to netcdf
pnames=(/"PRES","TMP","U_GRD","V_GRD","ULWRF","USWRF","DLWRF","DSWRF","SHTFL","LHTFL","WTMP","T_CDC","A_PCP","R_H","PRMSL"/)
plevels=(/"SFC","HTGL","HTGL","HTGL","SFC","SFC","SFC","SFC","SFC","SFC","SFC","EATM","SFC_acc3h","HTGL","MSL"/)
;pvalues=(/1,11,33,34,/)
ncnames=(/"press","temp","uwind","vwind","ulwrf","uswrf","dlwrf","dswrf","shtfl","lhtfl","wtmp","tcdc","apcp","rh","prmsl"/)
; Special variables of lat, lon no plevel segment
vlat= "gridlat_"+gnum
netcdf_out->lat = grib_in->\$vlat\$;
vlon= "gridlon_"+gnum
netcdf_out->lon = grib_in->\$vlon\$;
; loop looking for matching variable names
do j=0,dimsizes(ncnames)-1
vnamej=pnames(j)+"_"+gnum+"_"+plevels(j)
do i=0,nNames-1
; test for vnamej=grib_in->\$vNames(i)\$
if (vnamej.eq.vNames(i)) then
print ("Match "+j+" "+i+" "+vnamej+" "+vNames(i)+"
"+ncnames(j))
netcdf_out->\$ncnames(j)\$ = grib_in->\$vNames(i)\$
delete(grib_in->\$vNames(i)\$)
delete(netcdf_out->\$ncnames(j)\$)
end if
end do
end do
I've noticed that the script progressively takes longer to extract the
variables as it goes down the list. One of my coworkers thought that this
may be due to each variable taking additional memory. I tried to use
"delete" and "undef" to clear the variables from memory, but the script
still took a long time. Any ideas? Thanks.
Zack
_______________________________________________
ncl-talk mailing list
ncl-talk AT ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2b29 : Mon Apr 14 2003 - 15:57:43 MDT