ecoscope.io.raster#

Module Contents#

ecoscope.io.raster.logger#
class ecoscope.io.raster.RasterExtent(x_min=33.0, x_max=37.0, y_min=2.0, y_max=-2.0)[source]#
__repr__()[source]#

Return repr(self).

classmethod create_from_origin(pixel_size=0.5, x_min=0.0, y_min=0.0, num_rows=100, num_columns=100)[source]#
class ecoscope.io.raster.RasterProfile(pixel_size=1000.0, pixel_dtype=rio.float64, crs='EPSG:8857', nodata_value=0.0, band_count=1, raster_extent=None)[source]#

Bases: collections.UserDict

A class for holding raster properties At present this class is only valid for non-rotated rasters with a north-up orientation and square sized pixels defined by the E-W pixel size

_recompute_transform_(key)[source]#

Recomputes the affine transformation matrix when the pixel_size or raster_extent value is updated.

__getattr__(name)[source]#
__setattr__(name, value)[source]#

Implement setattr(self, name, value).

__setitem__(key, item)[source]#
class ecoscope.io.raster.RasterPy[source]#
classmethod write(ndarray, fp, columns, rows, band_count, driver='GTiff', dtype=rio.float64, crs=None, transform=None, nodata=None, sharing=False, indexes=1, **kwargs)[source]#
classmethod read(fp, driver=None, **kwargs)[source]#
classmethod read_write(fp, driver=None, **kwargs)[source]#
ecoscope.io.raster.reduce_region(gdf, raster_path_list, reduce_func)[source]#

A function to apply the reduce_func to the values of the pixels within each of the rasters for every shape within the input geopandas dataframe ‘geometry’ column :param gdf: geopandas dataframe. The geometry column will be used to mask the areas of the input raster to be used in the reduction :param raster_path_list: a list of raster files on disc to analyse :param reduce_func: a single-value function to apply to the values of the input raster :return: dataframe with a column of reduce values for each raster and a row for each region

ecoscope.io.raster.raster_to_gdf(raster_path)[source]#