Hello.
Would anyone know how to retrieve interpolated WRF variables at a
pressure level "over time" or "all at once" for a WRF output file that
has many timesteps?
I have 4 hourly data for a month.
Since pressure level is a diagnostic in the WRF data, I can only use
the "wrf_user_getvar" function
http://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_user_getvar.shtml
to retrieve a WRF variable at a pressure-level for all time. This
function is set up to retrieve a variable for only a single moment in
time.
You have to resort to using a "do loop", making it inefficient.
Specifically, I am trying to grab V-winds at 700 mb and create a
hovmoller diagram over time.
Would anyone have a suggestion here?
To get around this, I tried outputting this data as a general netCDF
file with (time, lat, lon) attributes according to example 1 here
http://www.ncl.ucar.edu/Applications/o-netcdf.shtml
so that I could call it in in another script and use regular NCL
plotting functions such as gsn_csm_hov. Unfortunately I still have to
use a "do loop" for the wrf_user_getvar function.
This doesn't work. I am not creating a file that contains the data for
every time step.
I cannot tell tell if my errors are a limitation of using WRF's
wrf_user_getvar function.
If anyone could offer a suggestion here, I would greatly appreciate it.
-Erik
***My new netcdf file is named V700-WRF-R2.nc. It should have 30
timesteps (one for every day in September):
Erik_at_noble:/Volumes/Data_and_Models/ncl_scripts:ncdump -h V700-WRF-R2.nc
netcdf V700-WRF-R2 {
dimensions:
time = UNLIMITED ; // (0 currently)
lat = 109 ;
lon = 139 ;
variables:
float V700(lat, lon) ;
V700:long_name = "V" ;
V700:description = "v Velocity" ;
V700:units = "m/s" ;
V700:_FillValue = -999999.f ;
V700:PlotLevelID = "700 hPa" ;
}
Erik_at_noble:/Volumes/Data_and_Models/ncl_scripts:
***Code;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This creates a .nc file from WRF interpolated pressure-level data
for general plots
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
begin
; The WRF ARW input file.
; This needs to have a ".nc" appended, so just do it.
diri1 ="/Volumes/Data_and_Models/Model-Output/Athena/"
ifile1 ="WRF-SOP3_Athena_3_1_2.nc"
a=addfile(diri1+ifile1,"r")
ncdf = addfile("V700-WRF-R2.nc" ,"c") ; open output netCDF filei
; make time and UNLIMITED dimension ; recommended for most
applications
filedimdef(ncdf,"time",-1,True)
; What times and how many time steps are in the data set?
times = wrf_user_list_times(a) ; get times in the file
ntimes = dimsizes(times) ; number of times in the file
do it = 248, ntimes-1, 8 ; 248 = beginning of September; every 8 =
24hour interval
print("Working on time: " + times(it) )
; variables
v = wrf_user_getvar(a, "va",it) ; V at Mass points
p = wrf_user_getvar(a, "pressure",it) ; pressure is our vertical
coordinate
pressure = 700.
v_plane = wrf_user_intrp3d( v,p,"h",pressure,0.,False)
v_plane!0 = "lat"
v_plane!1 = "lon"
v_plane_at_long_name = "V" ; assign attributes
v_plane_at_units = "m/s"
ncdf->V700=v_plane ; out to netcdf file
end do
printVarSummary( v )
printVarSummary( v_plane )
end
;;;;;
Due to space-reasons, errors are attached.
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Nov 08 2007 - 23:40:27 MST
This archive was generated by hypermail 2.2.0 : Mon Nov 12 2007 - 09:17:55 MST