A collection of diagnostic and interpolation routines for use with output from the Weather Research and Forecasting (WRF-ARW) Model.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

4.9 KiB

In [ ]:
from wrf.extension import _slp
In [ ]:
from wrf import getvar
from netCDF4 import Dataset as nc
ncfile = nc("/Users/ladwig/Documents/wrf_files/wrf_vortex_multi/wrfout_d01_2005-08-28_00:00:00")
b = getvar([ncfile,ncfile,ncfile], "slp", timeidx=None)
In [ ]:
print(b)
In [ ]:
b = getvar([ncfile,ncfile,ncfile], "td", None)
In [ ]:
print(b)
In [ ]:
b = getvar([ncfile,ncfile,ncfile], "tk", None)
In [ ]:
print(b)
In [ ]:
b = getvar([ncfile,ncfile,ncfile], "rh", None)
In [ ]:
print (b)
In [ ]:
# 500 MB Heights
from wrf import getvar, interplevel

z = getvar([ncfile,ncfile,ncfile], "z", timeidx=None)
p = getvar([ncfile,ncfile,ncfile], "pressure", timeidx=None)
ht_500mb = interplevel(z, p, 500)

print(ht_500mb)
del ht_500mb, z, p
In [ ]:
# Pressure using pivot and angle
from wrf import getvar, vertcross

z = getvar(ncfile, "z", timeidx=None)
p = getvar(ncfile, "pressure", timeidx=None)
pivot_point = (z.shape[-2] / 2, z.shape[-1] / 2) 
angle = 90.0

p_vert = vertcross(p, z, pivot_point=pivot_point, angle=angle)
print(p_vert)
del p_vert

# Pressure using start_point and end_point
start_point = (z.shape[-2]/2, 0)
end_point = (z.shape[-2]/2, -1)

p_vert = vertcross(p, z, start_point=start_point, end_point=end_point)
print(p_vert)
del p_vert, p, z
In [ ]:
# T2 using pivot and angle
from wrf import interpline, getvar

t2 = getvar([ncfile,ncfile,ncfile], "T2", timeidx=None)
pivot_point = (t2.shape[-2] / 2, t2.shape[-1] / 2) 
angle = 90.0

t2_line = interpline(t2, pivot_point=pivot_point, angle=angle)
print(t2_line)

del t2_line

# T2 using start_point and end_point
start_point = (t2.shape[-2]/2, 0)
end_point = (t2.shape[-2]/2, -1)

t2_line = interpline(t2, start_point=start_point, end_point=end_point)
print(t2_line)

del t2_line, t2
In [ ]:
from wrf import getvar
from netCDF4 import Dataset as nc
lambertnc = nc("/Users/ladwig/Documents/wrf_files/wrfout_d01_2010-06-13_21:00:00")
uvmet = getvar([lambertnc,lambertnc], "uvmet", timeidx=None)
print (uvmet)
In [ ]: