Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Support more than one restoration polygon #34

Open
szwiep opened this issue Dec 12, 2023 · 1 comment
Open

ENH: Support more than one restoration polygon #34

szwiep opened this issue Dec 12, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request high priority This is important

Comments

@szwiep
Copy link
Contributor

szwiep commented Dec 12, 2023

Feature Description

The tool should support the processing of more than one polygon at a time. Users can currently iterate over a set of polygons, building a new RestorationArea object for each polygon, but this does not take advantage of the multi-dimensional broadcasting built into xarray.

Supporting multiple polygons was pushed off because each polygon needs to have a disturbance and restoration start date set, which complicated the potential solution at the start of the project. With more things in place now in the tool now, it should be possible to figure out a way to allow multiple polygons.

Potential Solution

TDB.

@szwiep szwiep changed the title Support more than one restoration polygon ENH: Support more than one restoration polygon Jan 11, 2024
@szwiep szwiep added enhancement New feature or request high priority This is important labels Jan 11, 2024
@szwiep
Copy link
Contributor Author

szwiep commented Mar 25, 2024

  • Simplest approach would create a RestorationArea for each polygon, then pass each RA to the metric functions. Individual polygon results would then be concatenated and returned to user. This would be slow and basically just an encapsulation of the logic that users are currently expected to employ to compute over multiple polygons.
  • More complex idea? Pass whole dataframe to RestorationArea then clip to each polygon and stack the arrays along a new "polygon" dim. Then pass the 5D array to the metric functions, and have them broadcast results over the band and polygon dimensions.
    • Difficulties?
      • Need to find a way to assign disturbance/reference years to each polygon dim without exploding the size of data. Maybe just a dataframe in the RestorationArea instance that maps polygon dim key to years?
      • To avoid exploding the size of the array by stacking (i.e do not stack many huge arrays over and over again), maybe the x/y should be removed once clipped (replaced with 0-N) so that the stacking x/y is only as large as the largest polygon being processing. Coords for each polygon could be stored in a dictionary in RestorationArea? Really not sure if this method would work for the whole ecosystem of the tool. Needs more thought.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request high priority This is important
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants