$ show NCAR/wrf-python
wrf-python is a specialized Python library for computing over 30 diagnostic meteorological variables from WRF-ARW (Weather Research and Forecasting) model output. It provides a high-level `getvar()` interface that dispatches to Fortran and C computational kernels wrapped via f2py, with OpenMP parallelization for performance. The library handles NetCDF input, staggered grids, map projections, moving nests, and supports multiple plotting backends (Cartopy, Basemap, PyNGL). It is built with scikit-build-core and CMake, requires a Fortran compiler, and includes extensive unit tests comparing results against NCL reference data. The architecture follows a consistent decorator pattern for argument handling, iteration over leftmost dimensions, type casting, and metadata injection, making it a production-grade tool for atmospheric research and operational meteorology.
The LLM identified 2 files worth highlighting for reuse:
A small, self-contained data class representing a geographic or grid coordinate pair (x,y or lat,lon). Supports arithmetic operators (addition, subtraction, multiplication, division), equality, hashing, and iteration. Easily extractable into any project needing 2D coordinate arithmetic. Demonstrates clean Python data modelling with minimal dependencies (no internal wrf imports).
A thread-local LRU-like cache implementation for storing previously extracted variables. Provides `cache_item()` and `get_cached_item()` functions with configurable maximum size. Uses `threading.local` for thread safety. Could be extracted as a lightweight caching utility for any Python application that wants a per-thread, size-limited store of computed results.