landusemix package

Submodules

landusemix.indices module

This module contains a class that calculates land use mix indices.

class landusemix.indices.LandUseMixIndices(land_use_areas)[source]

Bases: object

A class that calculates land use mix indices.

land_use_areas

A dictionary containing land use areas.

Type:

dict

entropy_index()[source]

Calculates the entropy index.

herfindahl_hirschman_index()[source]

Calculates the Herfindahl-Hirschman index.

entropy_index()[source]

Calculates the entropy index.

Returns:

The entropy index value.

Return type:

float

herfindahl_hirschman_index()[source]

Calculates the Herfindahl-Hirschman index.

Returns:

The Herfindahl-Hirschman index value.

Return type:

float

landusemix.utils module

Utility functions for reading and loading data files.

landusemix.utils.convert_dataframe_to_dict(dataframe)[source]

Convert a DataFrame to a Python dictionary.

Parameters: dataframe (pandas.DataFrame): The DataFrame to be converted.

Returns: dict: The DataFrame converted to a Python dictionary.

landusemix.utils.load_csv(filepath)[source]

Load a CSV file into a DataFrame.

Parameters: filepath (str): The path to the CSV file.

Returns: pandas.DataFrame: The loaded DataFrame.

landusemix.utils.load_geojson(filepath)[source]

Load a GeoJSON file into a GeoDataFrame.

Parameters: filepath (str): The path to the GeoJSON file.

Returns: geopandas.GeoDataFrame: The loaded GeoDataFrame.

landusemix.utils.load_raster(filepath)[source]

Load a raster file into a GeoDataFrame.

Parameters: filepath (str): The path to the raster file.

Returns: numpy.ndarray: The loaded raster data.

landusemix.utils.load_sample_csv()[source]

Load the included sample CSV file.

Returns: pandas.DataFrame: The loaded sample DataFrame.

landusemix.utils.load_sample_geojson()[source]

Load the included sample GeoJSON file.

Returns: geopandas.GeoDataFrame: The loaded sample GeoDataFrame.

landusemix.utils.load_sample_raster()[source]

Load the included sample raster file.

Returns: numpy.ndarray: The loaded sample raster data.

landusemix.utils.load_sample_shapefile()[source]

Load the included sample Shapefile.

Returns: geopandas.GeoDataFrame: The loaded sample GeoDataFrame.

landusemix.utils.load_shapefile(filepath)[source]

Load a Shapefile into a GeoDataFrame.

Parameters: filepath (str): The path to the Shapefile.

Returns: geopandas.GeoDataFrame: The loaded GeoDataFrame.

landusemix.utils.read_json(filepath)[source]

Read a JSON file and return a Python dictionary.

Parameters: filepath (str): The path to the JSON file.

Returns: dict: The contents of the JSON file as a Python dictionary.

Module contents