Skip to content

Misc Raster Utilities

King, Jonathan M requested to merge ghsc/users/jking/pfdf:misc into main

This merge adds a few utilities for working with raster datasets

  1. Data/NoData mask properties, and
  2. Raster.from_points, which builds a raster from a set of point features, and
  3. Raster(..., isbool=True), which indicates that a loaded raster should be treated as a boolean array

Closes #76 (closed), #77 (closed)

Notes for Reviewer

The key changes are in the raster.py module, as follows:

  • Lines 279-285: Added properties for data/nodata masks
  • Lines 539-542: Added code to optionally convert raster to boolean array
  • The docstrings of init, from_file, from_rasterio, from_pysheds, and from_array are updated to explain the "isbool" option
  • Lines 1018-1113: Added the from_points method

The new from_points command is modelled on the existing from_polygons command. I generalized the backend to support both commands, so the diffs will look large, but the only real change is the addition of the _validate_point function (lines 858-881).

Edited by King, Jonathan M

Merge request reports