Open ChrisFairless opened 2 years ago
Yes, sounds like a good idea, but make sure not to produce redundant code. Maybe add a helper function mask_from_extent
(maybe as a method of Centroids
) that implements the following lines:
https://github.com/CLIMADA-project/climada_python/blob/1ec4ecfcc936f4628f8190db8698d078d0d3213e/climada/hazard/centroids/centr.py#L967-L974
Then use the sel_cen
mask both in Centroids.select
and in Hazard.select
.
I’m trying to subset a Hazard object to a subset of its centroids given by a bounding box. It feels like there should be a method to do this, since all the ingredients are there in the code.
I suggest adding a new
extent
parameter to theHazard.select
method that mirrors the functionality of the same parameter inCentroids.select
. This will only be a few extra lines of code, sinceHazard.select
already subsets by centroids when it gets areg_id
parameter.I'm happy to implement this.