Skip to content

refactor: migrate to pyramids-gis 0.32 and cleopatra 0.17 APIs#176

Open
MAfarrag wants to merge 5 commits into
mainfrom
fix/update-deps
Open

refactor: migrate to pyramids-gis 0.32 and cleopatra 0.17 APIs#176
MAfarrag wants to merge 5 commits into
mainfrom
fix/update-deps

Conversation

@MAfarrag

Copy link
Copy Markdown
Member

What does this PR do?

Updates all calls to the pyramids-gis and cleopatra libraries to their latest APIs (0.32.0 and 0.17.0) and bumps both pins in pyproject.toml.

pyramids-gis 0.32

  • Replace the removed pyramids.multidataset.MultiDataset with pyramids.dataset.DatasetCollection (kept the Datacube alias).
  • DatasetCollection.align is no longer in-place by default; pass inplace=True in Inputs.prepare_inputs and capture the file names before in-place align/crop clear the collection's file list.
  • Dataset.dataset_like dropped the driver kwarg and requires a pyramids Dataset as source; wrap the raw gdal dataset in Parameters.
  • stats() now returns exact band statistics instead of GDAL's sampled values; updated the lumped-parameter test expectations (verified against independently computed spatial means of the valid cells).
  • Modernized the two legacy example scripts off the removed pyramids.raster.Raster API (fill, apply, align, crop).
  • Ignore GDAL .aux.xml statistics sidecar files generated during tests.

cleopatra 0.17

  • ArrayGlyph.animate iterates the first axis; move the time axis to the front in plot_distributed_results.
  • Gauges are passed as the new 3-column points array ([id, cell_row, cell_col]) instead of a DataFrame.
  • Restored Catchment.save_animation as a thin wrapper around ArrayGlyph.save_animation (it had no implementation since the plot module moved to cleopatra).
  • Updated scripts and docstrings from the old CamelCase plot kwargs to the new snake_case ones (the new API rejects unknown kwargs).

Bug fix surfaced by the upgrade

  • The no-data masks in plot_distributed_results compared FlowAccArr against the no-data value, but read_flow_acc converts no-data cells to NaN, so the masks never matched and ±3.4e38 sentinels leaked into the plots. All masks now use np.isnan.

Testing

  • Full suite: 139 passed (-m "not fig_share").
  • End-to-end check with the Coello test data: distributed run → plot_distributed_results (precipitation with gauges, soil moisture) → save_animation produced a valid GIF.
  • pre-commit hooks all pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant