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

Edit bands into indexes of DEM class #340

Merged
merged 4 commits into from
Mar 2, 2023

Conversation

liuh886
Copy link
Contributor

@liuh886 liuh886 commented Mar 2, 2023

Edit a few lines of the DEM class in xdem/dem.py, from

[86] # self.nbands can be None when data is not loaded through the Raster class
[87] if self.nbands is not None and self.nbands > 1:
[88]     raise ValueError("DEM rasters should be composed of one band only")

to

[86] # self.indexes can be None when data is not loaded through the Raster class
[87] if self.indexes is not None and len(self.indexes) > 1:
[88]     raise ValueError("DEM rasters should be composed of one band only")

so that it fixed #339

EDIT from @rhugonnet:
Resolves #338 as well

@liuh886 liuh886 changed the title bands_into_indexes Edit bands into indexes of DEM class Mar 2, 2023
@rhugonnet rhugonnet marked this pull request as ready for review March 2, 2023 19:34
@rhugonnet rhugonnet mentioned this pull request Mar 2, 2023
@rhugonnet
Copy link
Member

Thanks! Added a new test to ensure this doesn't happen again.
And for the record: actually good to test on indexes and not count (which was the equivalent of nbands), in case a single band is implicitly loaded by GeoUtils on opening (new big PR coming soon).

@rhugonnet rhugonnet merged commit f40e897 into GlacioHack:main Mar 2, 2023
@liuh886 liuh886 deleted the bands_into_indexes branch March 2, 2023 21:07
liuh886 added a commit to liuh886/xdem_snow that referenced this pull request Mar 2, 2023
Edit bands into indexes of DEM class (GlacioHack#340)
liuh886 added a commit to liuh886/xdem_snow that referenced this pull request Mar 2, 2023
Edit bands into indexes of DEM class (GlacioHack#340)
@adehecq
Copy link
Member

adehecq commented Mar 15, 2023

Thanks for the edits !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 need change 'bands' into 'indexes' in DEM class Small text corrections
3 participants