Add WRF diagnostics accessor plugin#238
Open
decadeneo wants to merge 3 commits intoxarray-contrib:mainfrom
Open
Add WRF diagnostics accessor plugin#238decadeneo wants to merge 3 commits intoxarray-contrib:mainfrom
decadeneo wants to merge 3 commits intoxarray-contrib:mainfrom
Conversation
Add xwrf_diagnostics.py module with comprehensive diagnostic calculations including thermodynamic, dynamic, and surface variables using wrf-python APIs. The accessor is automatically registered via __init__.py import.
for more information, see https://pre-commit.ci
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request: Add WRF Diagnostics Accessor Plugin
Summary
This PR adds a comprehensive WRF diagnostics accessor plugin that bridges xwrf/xarray with wrf-python's raw computational APIs, providing seamless integration for calculating diagnostic variables from WRF model output.
Features
ds.wrf_diag.*)Available Diagnostics
Thermodynamic Variables
slp()- Sea level pressurerh()- Relative humiditytk()/tc()- Temperature (Kelvin/Celsius)eth()- Equivalent potential temperaturetd()- Dewpoint temperaturepw()- Precipitable waterDynamic Variables
avo()- Absolute vorticityomega()- Omega (vertical pressure velocity)udhel()- Updraft helicityAdvanced Diagnostics
dbz()- Radar reflectivitycape_2d()- CAPE, CIN, LCL, LFCcloudfrac()- Low/mid/high cloud fractionsctt()- Cloud top temperatureSurface Variables (2m and 10m)
t2()/t2c()- 2m temperature (K/°C)rh2()- 2m relative humiditytd2()- 2m dewpoint temperatureq2()- 2m specific humiditypsfc()- Surface pressureu10()/v10()- 10m U/V wind componentswspd10()- 10m wind speedwdir10()- 10m wind directionUsage Example
Changes
xwrf/xwrf_diagnostics.py- New module with WRFDiagnosticsAccessor classxwrf/__init__.py- Import xwrf_diagnostics to auto-register accessorDependencies
wrf-python >= 1.3(soft dependency, graceful warning if not installed)Testing
The plugin has been tested with WRF output files and handles:
Notes