Skip to content

pysteps 2.0.0

Latest

Choose a tag to compare

@ladc ladc released this 04 Dec 16:56
· 3 commits to main since this release
2faec93

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_data replaces compute_store_nwp_motion and load_NWP.
  • Skill files: the blending skill is stored as JSON instead of pickle, for security. Existing .pkl files are not read (#644).
  • Importer plugins: importers must return a dataset, and the postprocess_import decorator is gone. Use pysteps-nwp-importers 2.0 or later. The plugin cookiecutter template has not been updated yet.
  • Importer/exporters dtype/fillna now honored in NetCDF importer/exporter, warn-path returns None, exporter writes precip_var attribute and a default _FillValue for packed integer output (#666), quality arrays currently not returned by the four HDF5/SAF importers, load_dataset now returns a 2-tuple.
  • Removed function: pysteps.utils.reprojection.unstructured2regular is removed. Use unstructured2regular from pysteps_nwp_importers.importer_dwd_nwp, which works on datasets. (#662)
  • Requirements: Python 3.11.5 to 3.13; xarray, netCDF4 and pandas are 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 sync to 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:

v1.21.6...2.0.0