Submodules

class SuomiGeoData.core.Core[source]

Bases: object

Provides common functionality used throughout the SuomiGeoData package.

property default_http_headers: dict[str, str]

Returns the default http headers to be used for the web requests.

is_valid_ogr_driver(file_path: str) bool[source]

Returns whether the given path is valid to write a GeoDataFrame.

Parameters:

file_path (str) – File path to save the GeoDataFrame.

Returns:

True if the file path is valid, False otherwise.

Return type:

bool

is_valid_raster_driver(file_path: str) bool[source]

Returns whether the given path is a valid to write a raster array.

Parameters:

file_path (str) – File path to save the raster.

Returns:

True if the file path is valid, False otherwise.

Return type:

bool

raster_clipping_by_mask(input_file: str, mask_file: str, output_file: str) str[source]

Clips a raster file using a mask and returns a confirmation message.

Parameters:
  • input_file (str) – File path of the input raster.

  • mask_file (str) – Shapefile path of input mask area.

  • output_file (str) – File path to save the output raster.

Returns:

A confirmation message indicating that the raster clipping is complete.

Return type:

str

raster_merging(folder_path: str, raster_file: str, raster_ext: str = '.tif', **kwargs: Any) str[source]

Merges raster files and returns a confirmation message.

Parameters:
  • folder_path (str) – Folder path containing input raster files.

  • raster_file (str) – File path to save the output raster.

  • raster_ext (str, optional) – Extension of input raster files. Defaults to ‘.tif’ if not provided.

  • **kwargs (optional) – Additional keyword arguments for updating the dictionary of rasterio.profile attribute.

Returns:

A confirmation message indicating that the raster merging is complete.

Return type:

str

shape_clipping_by_mask(input_file: str, mask_file: str, output_file: str) str[source]

Clips a shapefile using a mask and returns a confirmation message.

Parameters:
  • input_file (str) – Shapefile path of the input GeoDataFrame.

  • mask_file (str) – Shapefile path of the mask GeoDataFrame.

  • output_file (str) – Shapefile path to save the output GeoDataFrame.

Returns:

A confirmation message indicating that the shapefile clipping is complete.

Return type:

str