[ncl-talk] Subsetting WRF output file
Jim Means
jim at weatherextreme.com
Fri Aug 17 13:29:16 MDT 2018
I'm trying to do something which I think should be relatively simple,
but I think my lack of understanding of gridded files is causing me
problems.
I'd like to take the NetCDF output file from a WRF run and just pull out
the variables I need, so that I have a smaller version of the file that
I can work with. I'm giving it to somebody to load into IDV and they
need to be able to aggregate times. I would like to be able to plot
horizontal and vertical velocity at different levels in the model, and
keep the time information so that I can see the evolution. My program
runs, but IDV tells me that there is "No gridded data" found in my
output file.
My question is what do I need to do to make this a gridded data file?
Here is some example code, I used unstagger because I thought that might
be my problem, but unstaggering didn't seem to help.
Thanks,
Jim
begin
;
;***************************************************
; Open full NetCDF file and get variable names
;***************************************************
nc_in = addfile("wrfout_d02_2018-07-22_06:00:00.nc","r")
;***************************************************
; Open output netcdf file. Remove first just in case.
;***************************************************
nc_out_fname = "testout.nc"
system("rm -f " + nc_out_fname) ; remove any pre-existing file
ncdf_out = addfile(nc_out_fname,"c")
;***************************************************
; Specify desired variables
;***************************************************
lat = nc_in->XLAT
lon = nc_in->XLONG
znu = nc_in->ZNU
u = nc_in->U
v = nc_in->V
w = nc_in->W
ua = wrf_user_unstagger(u,u at stagger)
va = wrf_user_unstagger(v,v at stagger)
wa = wrf_user_unstagger(w,w at stagger)
xtime = nc_in->XTIME
ncdf_out->LAT = lat
ncdf_out->LON = lon
ncdf_out->ZNU = znu
ncdf_out->U = ua
ncdf_out->V=va
ncdf_out->W=wa
ncdf_out->XTIME = xtime
end
--
Untitled Document
James D. Means, Ph.D.
Senior Atmospheric & Climate Scientist
California Office
Tele: 619-495-1638 | Fax: 775-636-8430
930 Tahoe Blvd., Suite 802-560
Incline Village, Nevada 89451
jim at weatherextreme.com <mailto:jim at weatherextreme.com> | vcard
<http://www.weatherextreme.com/vcards/James%20Means.vcf>
www.weatherextreme.com <http://www.weatherextreme.com/>
<http://www.weatherextreme.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180817/17aea908/attachment.html>
More information about the ncl-talk
mailing list