Version 1.0 of the MetPy collection of tools in Python for reading, visualizing, and performing calculations with weather data was released on December 22, 2020. MetPy provides tested, reusable Python components suitable to a wide array of tasks common in meteorological and atmospheric science applications, including scripted data visualization and analysis. In adding this functionality, MetPy aims to mesh well with the broader scientific Python ecosystem — widely used projects including Numpy, Scipy, Matplotlib, xarray, and others.
While pre-1.0 versions of MetPy have been in broad use for several years — some 61 academic papers cite or mention using MetPy — version 1.0 marks the development team's commitment to keep the package's public API stable through a series of 1.x version releases. (The project uses semantic versioning, which means that any backward-incompatible changes to the API would require a change of major version.)
The MetPy team has made a series of 1.0 release candidate versions over the past year. Those who have been using the release candidates will find few surprises in the official 1.0 release, as the main focus of the development team has been on eliminating deprecated functionality from the API and ensuring the xarray and units functionality were working as desired. For those who have been keeping an eye on MetPy development but may have been hesitant to invest too much in using software in a 0.x version, the following are the main highlights of the releases leading up to version 1.0:
- Improved support for xarray
The biggest change in MetPy 1.0 is expanded support for xarray DataArray instances as input to MetPy calculation functions. MetPy calculations can now return a DataArray when given such as input, and can also take advantage of the metadata available on a DataArray (such as coordinate information) in order to simplify code. The changes let MetPy to use the Pint library for unit support alongside xarray in a seamless, unified way.
- Declarative plotting interface
MetPy provides a simplified (and GEMPAK-like) plotting syntax to reduce barriers to importing and plotting data.
- Function API changes
Changes have been made to unify and clarify MetPy’s API to be more consistent throughout, including changes to the names of their positional arguments to make parameter names consistent among functions.
- Improvements to meteorological calculations
A number of standard meteorological calculations have been added or enhanced, including the lifted index, Richardson number, web bulb temperature, and CAPE/CIN calculations. Citations and sources for the constant values used in calculations have also been greatly improved.
- Improved documentation
MetPy user and developer documentation has been overhauled, and the gallery of example code has been reorganized and expanded.
For those who have been working with pre-1.0 versions of MetPy, take a look at the MetPy 1.0 Upgrade Guide to fully understand any changes you may need to make to your existing code.
Unidata's Ryan May, MetPy lead developer, described the MetPy version 1.0 as part
of the 11th Symposium on Advances in Modeling and Analysis Using Python at the
2021 American Meteorological Society annual meeting. A recording of Ryan's
presentation is available online:
MetPy: What's Next after 1.0
Comparison with GEMPAK
One of the goals of the MetPy project is to help the academic community modernize its software toolset by bringing the best features of GEMPAK into the world of scientific Python. This process is by no means complete in MetPy 1.0, but a significant portion of GEMPAK's meteorological calculations are replicated (either as part of MetPy or by other standard scientific Python libraries). If you're familiar with GEMPAK, you may be interested in the GEMPAK Comparison Guide.
In addition, MetPy provides a “declarative” plotting interface, aimed at giving GEMPAK users ways to use MetPy that feel familiar. The declarative syntax is designed to aid in simple data exploration and analysis needs by simplifying the plotting context of typical Python code. For an overview, see the MetPy Declarative Syntax Tutorial.
In addition to the MetPy online documentation mentioned above, Unidata publishes the weekly MetPy Mondays series, featuring short (usually video) tutorials on a variety of MetPy- and Python-related topics.
Other support resources include:
- Stack Overflow: Ask a question using the “metpy” tag. This is the highly preferred option as it allows the community to benefit from answers to the questions, forming a readily-searched knowledge base. It’s also likely to result in the quickest response, as not only are the MetPy developers watching, but community members can also chime in if they know the answer.
- GitHub Discussions: Ask your question and have a discussion with members of MetPy’s community. This is also a forum likely to result in a quicker response.
- Unidata Python Support e-mail: Send an e-mail to Unidata’s Python support e-mail address.
- Gitter: text-based chat with the developers; sign in using GitHub or Twitter.
- MetPy on Twitter
- Unidata Python User’s Mailing List
While the MetPy project is led by Unidata developers, it is a broad-based effort involving many in the academic atmospheric science community. As of January 2021, a total of 161 individuals have contributed to the project, with 53 making code contributions that have been integrated into the release.
While the development team appreciates all of these contributions and is deeply grateful for such broad community support, with this milestone release the primary Unidata MetPy developers (Ryan May and Drew Camron) would like to offer a special acknowledgement to contributors Dr. Kevin Goebbert of Valpariso University and Jon Thielen of Iowa State University. Dr. Goebbert has worked very closely with the Unidata developers to ensure MetPy's usefulness as a classroom tool, and was instrumental in designing the GEMPAK-like declarative plotting interface. Mr. Thielen is currently a PhD candidate and was a Unidata Summer Intern in 2018; he volunteered the bulk of the work of integrating the xarray and pint libraries into MetPy, among many other contributions. Their contributions to the project are of enormous benefit to the entire MetPy community.
If you're interested in contributing, take a look at the MetPy Contributors Guide. You don't need to be a developer to contribute — your ideas, problem reports, and documentation enhancement suggestions are all valuable additions to the MetPy effort.
How to get MetPy
Take a look at the new Install Guide for installation instructions. Let us know using any of the above-listed support channels if you're having trouble.