GlacioHack / xdem

Analysis of digital elevation models (DEMs)
https://xdem.readthedocs.io/
MIT License
123 stars 37 forks source link

area_or_point and get_mask - adapt changes to geouilts #519 and #501 #496

Closed liuh886 closed 3 months ago

liuh886 commented 3 months ago

Two bugs spotted with the latest updates of geoultils

1. TypeError: DEM.from_array() got an unexpected keyword argument 'area_or_point'

Where

geoultis.raster line 1363

Reason

raster.from_array has appended metadata area_or_point, however, as the subclass, DEM has an override method from_array. When the self is a DEM instance, self.from_array do not accept argument area_or_point unless the override method accepts it as well.

Corrections

If a subclass overrides a method from its parent class, the overriding method should have the same signature (i.e., the same number and names of parameters) as the method in the parent class. The same error has happened before #416 .

For the same reason, self.tags should be update as well.

File changes

DEM.from_array

2. ImportError: unable import get_mask from geoutils.raster

Where

Volumne.py line 12

Reason

'get_mask' has been a new method under the Raster class.

Corrections

Change get_mask into get_mask_from_array

File changes

volumn.py

rhugonnet commented 3 months ago

Fixed in #480, see https://github.com/GlacioHack/xdem/pull/497#issuecomment-2019296137