afernandezody
Member
Hello,
I'm looking at the sample (wrf-python) to use lat/lon with vertical levels:
If the wrfoutut files come from a NMM simulation with rotated coordinates (map_proj = 'rotated_ll'), would it be necessary to modify the script or would it still be valid?
Thanks,
Arturo
I'm looking at the sample (wrf-python) to use lat/lon with vertical levels:
from __future__ import print_function, division
from netCDF4 import Dataset
from wrf import getvar, vertcross, CoordPair
ncfile = Dataset("wrfout_d01_2016-10-07_00_00_00")
# Get the geopotential height (m) and pressure (hPa).
z = getvar(ncfile, "z")
p = getvar(ncfile, "pressure")
lats = getvar(ncfile, "lat")
lons = getvar(ncfile, "lon")
# Making the same horizontal line, but with lats/lons
start_lat = lats[(lats.shape[-2]-1)//2, 0]
end_lat = lats[(lats.shape[-2]-1)//2, -1]
start_lon = lons[(lats.shape[-2]-1)//2, 0]
end_lon = lons[(lats.shape[-2]-1)//2, -1]
# Pressure using start_point and end_point. These were obtained using
start_point = CoordPair(lat=start_lat, lon=start_lon)
end_point = CoordPair(lat=end_lat, lon=end_lon)
# Specify vertical levels
levels = [1000., 2000., 3000.]
# Calculate the cross section
p_vert = vertcross(p, z, wrfin=ncfile, levels=levels, start_point=start_point, end_point=end_point, latlon=True)
print(p_vert)
If the wrfoutut files come from a NMM simulation with rotated coordinates (map_proj = 'rotated_ll'), would it be necessary to modify the script or would it still be valid?
Thanks,
Arturo