reV.handlers.exclusions.ExclusionLayers

class ExclusionLayers(h5_file, hsds=False)[source]

Bases: object

Handler of .h5 file and techmap for Exclusion Layers

Parameters:
  • h5_file (str | list | tuple) – .h5 file containing exclusion layers and techmap, or a list of h5 files

  • hsds (bool) – Boolean flag to use h5pyd to handle .h5 ‘files’ hosted on AWS behind HSDS

Methods

close()

Close h5 instance

get_layer_crs(layer)

Get crs for a specific exclusion layer

get_layer_description(layer)

Get description for given layer

get_layer_profile(layer)

Get profile for a specific exclusion layer

get_layer_values(layer)

Get values for given layer in Geotiff format (bands, y, x)

get_nodata_value(layer)

Get the nodata value for a given layer

Attributes

chunks

Exclusion layers chunks default chunk size

crs

GeoTiff projection crs

h5

Open h5py File instance.

iarr

Get an array of 1D index values for the flattened h5 excl extent.

latitude

Latitude coordinates array

layers

Available exclusions layers

longitude

Longitude coordinates array

pixel_area

Get pixel area in km2 from the transform profile of the excl file.

profile

GeoTiff profile for exclusions

shape

Exclusion shape (latitude, longitude)

close()[source]

Close h5 instance

property h5

Open h5py File instance.

Returns:

h5 (rex.MultiFileResource | rex.Resource)

property iarr

Get an array of 1D index values for the flattened h5 excl extent.

Returns:

iarr (np.ndarray) – Uint array with same shape as exclusion extent, representing the 1D index values if the geotiff extent was flattened (with default flatten order ‘C’)

property profile

GeoTiff profile for exclusions

Returns:

profile (dict)

property crs

GeoTiff projection crs

Returns:

str

property pixel_area

Get pixel area in km2 from the transform profile of the excl file.

Returns:

area (float) – Exclusion pixel area in km2. Will return None if the appropriate transform attribute is not found.

property layers

Available exclusions layers

Returns:

layers (list)

property shape

Exclusion shape (latitude, longitude)

Returns:

shape (tuple)

property chunks

Exclusion layers chunks default chunk size

Returns:

chunks (tuple | None) – Chunk size of exclusion layers

property latitude

Latitude coordinates array

Returns:

ndarray

property longitude

Longitude coordinates array

Returns:

ndarray

get_layer_profile(layer)[source]

Get profile for a specific exclusion layer

Parameters:

layer (str) – Layer to get profile for

Returns:

profile (dict | None) – GeoTiff profile for single exclusion layer

get_layer_crs(layer)[source]

Get crs for a specific exclusion layer

Parameters:

layer (str) – Layer to get profile for

Returns:

crs (str | None) – GeoTiff projection crs

get_layer_values(layer)[source]

Get values for given layer in Geotiff format (bands, y, x)

Parameters:

layer (str) – Layer to get values for

Returns:

values (ndarray) – GeoTiff values for single exclusion layer

get_layer_description(layer)[source]

Get description for given layer

Parameters:

layer (str) – Layer to get description for

Returns:

description (str) – Description of layer

get_nodata_value(layer)[source]

Get the nodata value for a given layer

Parameters:

layer (str) – Layer to get nodata value for

Returns:

nodata (int | float | None) – nodata value for layer or None if not found