Modules

Convert

convert.convert.convert(indir, outdir, proj, band_info, startdate, enddate, outfile=None)
convert.raster_to_vector.raster_to_vector(infile, proj, band_info, startdate, enddate, outfile=None)

Convert raster to vector file with geopandas

Parameters:
  • infile (str) – Input file location as string

  • band_info (int) – Band number

  • startdate (str) – Start date

  • enddate (str) –

    End date outfile : str, optional

    Output file location as string

Returns:

all_gdf – Converted vectors geodataframe

Return type:

geopandas.GeoDataFrame

Filter

filter.filter_area.filter_area(iml, min_area=0.05)

Filter vectors in GeoDataframe object by a defined area

Parameters:
  • iml (geopandas.GeoDataframe) – Vector object to filter by area

  • min_area (int, optional) – Threshold area (sq km) to filter by

Returns:

iml – Filtered vector object

Return type:

geopandas.GeoDataframe

filter.filter_margin.filter_margin(iml, margin_buffer)

Filter vectors by polygon (such as a margin buffer) using a spatial join

Parameters:
  • iml (geopandas.GeoDataframe) – Vector object to filter by area

  • margin_buffer (geopandas.GeoSeries) – Vector shape which will be used to filter

Returns:

iml – Filtered vector object

Return type:

geopandas.GeoDataframe

filter.filter_vectors.filter_vectors(indir, outdir, margin_buff)

Merge

merge.merge_vectors.merge_vectors(feature_list, method_list, collection_list, start_date_list, end_date_list, proj='EPSG:3413')

Compile features from multiple processings into one geodataframe

Parameters:
  • feature_list (list) – List of shapely features

  • method_list (list) – List of strings denoting processing method

  • collection_list (list) – List of strings denoting dataset collection

  • date_list (list) – List of start and end date for processing

Returns:

all_gdf – Compiled goedataframe

Return type:

geopandas.GeoDataFrame

Metadata

metadata.add_metadata.add_metadata(iml, names, outfile)
metadata.assign_certainty.assign_certainty(gdf, search_names, scores, source='all_src')

Assign certainty score to geodataframe based on sources

Parameters:
  • gdf (pandas.GeoDataFrame) – Vectors to assign ncertainty to

  • search_names (str) – Names of sources to count and determine certainty

  • scores (list) – List of scores of certainty

  • sources (str) – Column name of sources information

metadata.assign_id.assign_id(gdf, col_name='unique_id')

Assign unique identification numbers to non-overlapping geometries in geodataframe

Parameters:
  • gdf (pandas.GeoDataFrame) – Vectors to assign identification numbers to

  • col_name (str) – Column name to assign ID from

Returns:

gdf – Vectors with assigned IDs

Return type:

pandas.GeoDataFrame

metadata.assign_region.assign_names(gdf, gdf_names, distance=500.0)

Assign placenames to geodataframe geometries based on names in another geodataframe point geometries

Parameters:
  • gdf (pandas.GeoDataFrame) – Vectors to assign uncertainty to

  • gdf_names (pandas.GeoDataFrame) – Vector geodataframe with placenames

  • distance (int) – Distance threshold between a given vector and a placename

Returns:

gdf – Vectors with assigned IDs

Return type:

pandas.GeoDataFrame

metadata.assign_sources.assign_sources(gdf, col_names=['unique_id', 'source'])

Assign source metadata to geodataframe, based on unique lake id and individual source information

Parameters:
  • gdf (geopandas.GeoDataFrame) – Vectors to assign sources to

  • col_names (list) – Column names to assign sources from

Returns:

gdf – Vectors with assigned sources

Return type:

geopandas.GeoDataFrame

metadata.metadata.add_metadata(iml, names, outfile)

stats

stats.basin_stats.basin_stats(infile1, infile2, infile3, outtxt)

Calculate basin statistics on a lake inventory file

Parameters:
  • infile1 (str) – File path to lake geodataframe

  • infile2 (str) – File path to basin (as polygons) geodataframe

  • infile2 – File path to basin (as lines) geodataframe

  • outfile (str) – Outputted file name for general statistics

stats.general_stats.general_stats(geofile, outfile)

Calculate general statistics on a lake inventory file

Parameters:
  • geofile (gpd.str) – File path to lake dataframe

  • outfile (str) – Outputted file name for general statistics

stats.method_stats.method_stats(infile1, infile2, outfile)

Calculate general statistics on a lake inventory file

Parameters:
  • infile1 (str) – File path to lake geodataframe

  • infile2 (str) – File path to basin (as polygons) geodataframe

  • outfile (str) – Outputted file name for general statistics

stats.reformat.aggregate(geofile, col_name='LakeID')

Generate areal statistics for aggregated geodataframe. Aggregation is determined from a given column name

Parameters:
  • geofile (gpd.GeoDataFrame) – Dataframe to perform aggregation statistics on

  • col_name (str, optional) – Column name to aggregate dataframe by. The default is “LakeID”

Returns:

agg_geofile – Aggregated dataframe with updated areal statistics

Return type:

gpd.GeoDataFrame

stats.reformat.centroids(geofile)

Generate centroids for geodataframe

Parameters:

geofile (gpd.GeoDataFrame) – Dataframe to obtain centroids for

Returns:

geofile – Dataframe with centroid information

Return type:

gpd.GeoDataFrame

test

class test.test.TestGrIML(methodName='runTest')

Bases: TestCase

Unittest for the GrIML post-processing workflow

test_convert()

Test vector to raster conversion

test_filter()

Test vector filtering

test_merge()

Test vector merging

test_metadata()

Test metadata population