MetPy is an open-source and community-driven Python package maintained by Unidata that seeks to replace GEMPAK with a collection of tools that integrates well with the scientific Python ecosystem. Through work undertaken during the 2018 Unidata Summer Internship, cross section interpolation and related calculations have now been implemented in MetPy as of version 0.9, using xarray Datasets and DataArrays (labeled n-dimensional arrays that follow the Common Data Model) as the underlying data structure.
An overview will be provided of the work that was done in enhancing MetPy’s integration with the xarray package to prepare for cross sections. Building on past work in handling coordinate reference systems and unit array conversions, the xarray integration has been furthered through the addition of systematic coordinate identification, DataArray-compatible derivative calculations, and other calculation helpers.
This presentation will also describe the implementation of cross section interpolation and related calculations and demonstrate the new functionality with a variety of plots and interactive examples. The cross section implementation has been built in a flexible way to allow for linear or nearest neighbor interpolation to either a custom path through data or a default geodesic path between two points. While the implementation as of v0.9 depends on gridded data and is limited to these two methods of interpolation, future work will expand this to unstructured data and other methods of interpolation that are included in MetPy. The calculations related to cross sections, such as tangential and normal vector components and absolute momentum, utilize the metadata associated with the interpolation routine’s returned DataArrays to create a straightforward API. To demonstrate this new functionality in MetPy, several examples will be shown, from basic demonstrations included in MetPy’s documentation to more advanced examples showcasing high-resolution WRF simulations of a mesoscale convective system and analysis of conditional symmetric instability using moist potential vorticity.