所需的可视化绘图类型,决定了你在WRF后处理中的计算步骤。 1D点线图:ll_to_xy interpline 2D填色图:interplevel 3D剖面图:vinterp vertcross 绘图、美化 色标、XY轴、标签的设置等等。
从DataArray中提取 numpy 数组 如果你需要将 xarray.DataArray 转换为 numpy.ndarray, wrf-python中的 wrf.to_np 函数可以帮助你完成这一操作。尽管 xarray.DataArray 对象已经包含了 xarray.DataArray.values 属性用以提取 numpy 数组,但是用于编译扩展时仍会存在问题。因为 xarray 会将缺失值填充为 NaN,当用于编...
print(f"Longitude range: {min_lon} to {max_lon}") # 绘制等高线图,将经纬度作为 x 和 y 轴,确保地理位置正确 plt.figure(figsize=(10, 8)) contourf = plt.contourf(to_np(lons), to_np(lats), to_np(pressure_2d), cmap='coolwarm', levels=10) # 设置经纬度范围与 WRF 模型一致 plt.xlim...
colors import from_levels_and_colors from netCDF4 import Dataset from xarray import DataArray from wrf import getvar, interplevel, vertcross,vinterp, ALL_TIMES, CoordPair, xy_to_ll, ll_to_xy, to_np, get_cartopy, latlon_coords, cartopy_xlim, cartopy_ylim from matplotlib.animation import...
from wrf import getvar, interplevel, vertcross,vinterp, ALL_TIMES, CoordPair, xy_to_ll, ll_to_xy, to_np, get_cartopy, latlon_coords, cartopy_xlim, cartopy_ylim from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER ...
getvar, interplevel, vertcross,vinterp, ALL_TIMES, CoordPair, xy_to_ll, ll_to_xy, to_np, get_cartopy, latlon_coords, cartopy_xlim, cartopy_ylim 11from matplotlib.animation import FuncAnimation 12from IPython.display import HTML 13import os 14import warnings 15warnings.filterwarnings('ignore...
Lat/Lon <-> XY Routines wrf-python includes a set of routines for converting back and forth between latitude,longitude space and x,y space. The methods are :meth:`wrf.xy_to_ll`, :meth:`wrf.xy_to_ll_proj`, :meth:`wrf.ll_to_xy`, :meth:`wrf.ll_to_xy_proj`. The latitude, lon...