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

Add "equal count" hypsometric binning #39

Closed
erikmannerfelt opened this issue Mar 11, 2021 · 1 comment · Fixed by #36
Closed

Add "equal count" hypsometric binning #39

erikmannerfelt opened this issue Mar 11, 2021 · 1 comment · Fixed by #36
Labels
new-feature A new functionality / feature or request

Comments

@erikmannerfelt
Copy link
Contributor

Right now, the hypsometric approach (PR #36) only allows for equally spaced bins. An alternative to equal spacing is having bins with equal pixel counts.

Correct me if I'm wrong, but the advantage would be on glaciers with a combination of flat and steep surfaces. If a nonlinear elevation vs. elevation change relationship is assumed, flat surfaces would be under-represented in bins with equal spacing. Bins with equal pixel counts, on the other hand, would make sure that each part of the glacier is represented better.

Well, you can calculate a percentile bin, then use it in your percentile functions:
pbins = np.arange(min, max, bin_size)
bins = np.percentile(mean_dem, pbins)

Originally posted by @adehecq in #36 (comment)

@erikmannerfelt erikmannerfelt added the enhancement Feature improvement or request label Mar 11, 2021
@rhugonnet
Copy link
Member

This would probably also improve the filtering of outliers per bin (e.g., outside 5 NMAD) by ensuring the last bins in the accumulation areas are within a larger bin (few pixels are sampled at high elevations + effect of outliers in the reference DEM/wrong outlines).
For the record, this is how scikit-gstat is binning uniformly:

return np.fromiter(
        (np.nanpercentile(d, (i / n) * 100) for i in range(1, n + 1)),
        dtype=float
    )

@erikmannerfelt erikmannerfelt linked a pull request Mar 15, 2021 that will close this issue
@erikmannerfelt erikmannerfelt added new-feature A new functionality / feature or request and removed enhancement Feature improvement or request labels Jul 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature A new functionality / feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants