Inheritance to DEMs and beyond

Inheritance to DEMs and beyond#

Inheritance is practical to naturally pass down parent methods and attributes to child classes.

Many subtypes of Rasters geospatial data exist that require additional attributes and methods, yet might benefit from methods implemented in GeoUtils.

Overview of Raster inheritance#

Current Raster inheritance extends into other packages, such as xDEM for analyzing digital elevation models. Within GeoUtils, inheritance extends only to Mask that implements overloaded methods specific to binary raster masks, as shown in the diagram below.

Inheritance diagram of geoutils.raster.raster

Note

The DEM class re-implements all methods of gdalDEM (and more) to derive topographic attributes (hillshade, slope, aspect, etc), coded directly in Python for scalability and tested to yield the exact same results. Among others, it also adds a vcrs property to consistently manage vertical referencing (ellipsoid, geoids).

If you are DEM-enthusiastic, check-out our sister package xDEM for digital elevation models.

And beyond#

Many types of geospatial data can be viewed as a subclass of Rasters, which have more attributes and require their own methods: spectral images, velocity fields, phase difference maps, etc…

If you are interested to build your own subclass of Raster, you can take example of the structure of xdem.DEM. Then, just add any of your own attributes and methods, and overload parent methods if necessary! Don’t hesitate to reach out on our GitHub if you have a subclassing project.