wrf-python是NCAR投入python怀抱的重要节点,但是已经很久不更新了,上次更新约莫是2019年。
当然对于处理wrf文件完全是足够的,多样的诊断量,丰富的插值与绘图函数,简易的接口都是优点。

更新内容属于是比较实用,比如支持更高版本的python以及支持mac等等
我个人当然是希望支持更多的诊断量减少我们的工作量
近期会更新一些关于xwrf(批量处理wrf工具)的小文章,敬请期待。
xWRF 提供了一个轻量级接口,用于在 Xarray 中使用天气研究和预报 (WRF) 模型输出。xwrf 的主要目标是以更方便用户的方式从 wrf-python 包中复制关键功能,并提供与 Pangeo 软件堆栈其余部分的无缝集成。
项目地址是https://xwrf.readthedocs.io/en/latest/index.html
个人实际体验下来还是wrfpython更加顺手,一句getvar()走天下,毕竟xwrf主打轻量化,基本上就提供一个读取接口,剩下的诊断量计算,插值等等只能求助于其他python库了。
如果你有超大量级的文件需要读取与处理,xwrf可以更方便与dask集成,这可能是一个xwrf的就业方向。
下面是github上大佬总结的wrf-python与xwrf的差异
诊断量方面
wrf-python key | Description | Status Relative to MetPy |
|---|---|---|
avo | Absolute Vorticity | Implemented: mpcalc.absolute_vorticity |
eth/theta_e | Equivalent Potential Temperature | Implemented: mpcalc.equivalent_potential_temperature |
cape_2d | 2D CAPE (MCAPE/MCIN/LCL/LFC) | Implemented for single-profile only: mpcalc.cape_cin |
cape_3d | 3D CAPE and CIN | Implemented for single-profile only: mpcalc.cape_cin |
ctt | Cloud Top Temperature | No equivalent (though, unclear how to make a useful generalized formulation) |
cloudfrac | Cloud Fraction | No equivalent (though, unclear how to make a useful generalized formulation) |
dbz | Reflectivity | Use directly from output |
mdbz | Maximum Reflectivity | Use .max('bottom_top') on reflectivity DataArray |
geopt/geopotential | Geopotential for the Mass Grid | Field needing WRF-specific processing |
geopt_stag | Geopotential for the Vertically Staggered Grid | Field needing WRF-specific processing |
helicity | Storm Relative Helicity | Implemented for single-profile only: mpcalc.storm_relative_helicity |
lat | Latitude | Use directly from output |
lon | Longitude | Use directly from output |
omg/omega | Omega | Implemented: mpcalc.vertical_velocity_pressure |
p/pres | "Full Model Pressure (in specified units)" | Field needing WRF-specific processing |
pressure | Full Model Pressure (hPa) | Field needing WRF-specific processing |
pvo | Potential Vorticity | Implemented: mpcalc.potential_vorticity_baroclinic |
pw | Precipitable Water | Implemented for single-profile only: mpcalc.precipitable_water |
rh | Relative Humidity | Implemented: mpcalc.relative_humidity_from_mixing_ratio |
rh2 | 2m Relative Humidity | Implemented: mpcalc.relative_humidity_from_mixing_ratio |
slp | Sea Level Pressure | Open PR Pending: Unidata/MetPy#1700 |
T2 | 2m Temperature | Field needing WRF-specific processing |
ter | Model Terrain Height | Field needing WRF-specific processing |
td2 | 2m Dew Point Temperature | Implemented, but multiple functions possibly needed depending on exact source fields (hopefully will be made easier with Unidata/MetPy#2070) |
td | Dew Point Temperature | Implemented, but multiple functions possibly needed depending on exact source fields (hopefully will be made easier with Unidata/MetPy#2070) |
tc | Temperature in Celsius | Use .metpy.convert_units('degC') or .pint.to('degC') on temperature DataArray |
th/theta | Potential Temperature | Implemented: mpcalc.potential_temperature |
temp | Temperature (in specified units) | Field needing WRF-specific processing |
tk | Temperature in Kelvin | Field needing WRF-specific processing |
times | Times in the File or Sequence | Field needing WRF-specific processing |
xtimes | "XTIME Coordinate (if applicable)" | Field needing WRF-specific processing |
tv | Virtual Temperature | Implemented: mpcalc.virtual_temperature |
twb | Wet Bulb Temperature | Implemented for single-profile only: mpcalc.wet_bulb_temperature |
updraft_helicity | Updraft Helicity | Open Issue: Unidata/MetPy#2213 |
ua | U-component of Wind on Mass Points | Field needing WRF-specific processing |
va | V-component of Wind on Mass Points | Field needing WRF-specific processing |
wa | W-component of Wind on Mass Points | Field needing WRF-specific processing |
uvmet10 | "10 m U and V Components of Wind Rotated to Earth Coordinates" | Field needing WRF-specific processing (also, PyProj/cartopy vector transforms could use some helpers with xarray) |
uvmet | "U and V Components of Wind Rotated to Earth Coordinates" | Field needing WRF-specific processing (also, PyProj/cartopy vector transforms could use some helpers with xarray) |
wspd_wdir | "Wind Speed and Direction (wind_from_direction) in Grid Coordinates" | Implemented: mpcalc.wind_speed and mpcalc.wind_direction |
wspd_wdir10 | "10m Wind Speed and Direction (wind_from_direction) in Grid Coordinates" | Implemented: mpcalc.wind_speed and mpcalc.wind_direction |
uvmet_wspd_wdir | "Wind Speed and Direction (wind_from_direction) Rotated to Earth Coordinates" | Partially implemented: mpcalc.wind_speed and mpcalc.wind_direction (PyProj/cartopy vector transforms could use some helpers with xarray) |
uvmet10_wspd_wdir | "10m Wind Speed and Direction (wind_from_direction) Rotated to Earth Coordinates" | Partially implemented: mpcalc.wind_speed and mpcalc.wind_direction (PyProj/cartopy vector transforms could use some helpers with xarray) |
z/height | Model Height for Mass Grid | Field needing WRF-specific processing |
height_agl | Model Height for Mass Grid (AGL) | Field needing WRF-specific processing |
zstag | Model Height for Vertically Staggered Grid | Field needing WRF-specific processing |
插值方面
Doable, but too complecated...should be a job for xgcm还是坐等有结合两者优点的新的wrf处理库出现吧,或者NCAR的大手发力一下把xwrf兼容进去。