Repository navigation
pysteps 2 moves the data model to xarray and modernises the packaging and development tools.
It contains breaking changes: code written for v1 needs to be adapted.
xarray data model
Importers, motion, nowcasting, blending, and most utility functions now use an xarray.Dataset, which holds the precipitation, motion field, coordinates and metadata together.
# v1
precip, _, metadata = io.read_timeseries(fns, importer, **importer_kwargs)
precip, metadata = conversion.to_rainrate(precip, metadata)
velocity = oflow(precip)
forecast = nowcast(precip[-1], velocity, 12)
# v2
ds = io.read_timeseries(fns, importer, **importer_kwargs)
ds = conversion.to_rainrate(ds)
ds = oflow(ds)
forecast = nowcast(ds.isel(time=slice(-1, None)), 12)
precip = forecast[forecast.attrs["precip_var"]]The dataset layout is described in the [pysteps.io.importers documentation] (https://pysteps.readthedocs.io/en/stable/pysteps_reference/io.html)..)
See the example gallery for usage examples.
Other breaking changes
- NWP blending:
preprocess_nwp_datareplacescompute_store_nwp_motionandload_NWP. - Skill files: the blending skill is stored as JSON instead of pickle, for security. Existing
.pklfiles are not read (#644). - Importer plugins: importers must return a dataset, and the
postprocess_importdecorator is gone. Usepysteps-nwp-importers2.0 or later. The plugin cookiecutter template has not been updated yet. - Importer/exporters
dtype/fillnanow honored in NetCDF importer/exporter, warn-path returns None, exporter writesprecip_varattribute and a default_FillValuefor packed integer output (#666), quality arrays currently not returned by the four HDF5/SAF importers,load_datasetnow returns a 2-tuple. - Removed function:
pysteps.utils.reprojection.unstructured2regularis removed. Useunstructured2regularfrompysteps_nwp_importers.importer_dwd_nwp, which works on datasets. (#662) - Requirements: Python 3.11.5 to 3.13;
xarray,netCDF4andpandasare now required - FMI GeoTIFF importer: uses
rioxarray(#596), install this optional dependency to use it.
Packaging and development
- uv replaces the conda environment and requirements files; run
uv syncto install from a clone (#592, #629). - Publishing: releases are built and published to PyPI with uv, with signed attestations (#637, #642).
- Ruff replaces Black for formatting and also sorts imports (#592).
- Bandit Bandit security scans now run in CI (#592, #637), next to Dependabot and dependency review (#606).
- Contributing: revised guidelines, including a policy on AI-assisted work and on stale issues and PRs (#598).
Thanks to @mats-knmi, @FelixE91, @RubenImhoff, @izzyknmi, @jbelien, @alanseed, @kmuehlbauer, @sidekock, @larsbonnefoy, @ritvje, @jsvatos, @gjm174, @raashish1601, @dnerini, @ladc and to everyone who reviewed and tested the release candidates.
Full Changelog: