Skip to content

Optimize Raster Reader Memory Usage for Hazard Module #1262

@spjuhel

Description

@spjuhel

The current raster readers for the hazard module require building centroids for every point across the total extent of the raster. For high-resolution rasters, this leads to excessive memory requirements.

The construction requires building a Centroid grid for every point of the raster (even for no-data points)

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
(Add an option to?) Sub-select the dataset to coordinates which are not always NaN (also 0?)
This approach would save substantial RAM and computation time.

Specifically:

  1. add optional attributes to HazardXarrayReader (e.g. ignore_novalue_coords (default True) and ignore_zero_intensity_coords (default False)
  2. based on these attributes, sub-select the data in the get_hazard_kwargs() method, to generate Centroids only for the corresponding coordinates.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context

  • This is related to the refactoring of the centroids (GeoDataFrame)
  • This issue affects both read raster and potentially write raster methods? (a priori not)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions