metobs_toolkit.Dataset.get_landcover#

Dataset.get_landcover(buffers=[100], aggregate=True, overwrite=True, gee_map='worldcover')[source]#

Extract landcover for all stations.

Extract the landcover fractions in a buffer with a specific radius for all stations. If an aggregation scheme is define, one can choose to aggregate the landcoverclasses.

The landcover fractions will be added to the Dataset.metadf if overwrite is True. Presented as seperate columns where each column represent the landcovertype and corresponding buffer.

Parameters:
  • buffers (num, optional) – The list of buffer radia in dataset units (meters for ESA worldcover) . The default is 100.

  • aggregate (bool, optional) – If True, the classes will be aggregated with the corresponding aggregation scheme. The default is True.

  • overwrite (bool, optional) – If True, the Datset.metadf will be updated with the generated landcoverfractions. The default is True.

  • gee_map (str, optional) – The name of the dataset to use. This name should be present in the settings.gee[‘gee_dataset_info’]. If aggregat is True, an aggregation scheme should included as well. The default is ‘worldcover’

Returns:

frac_df – A Dataframe with index: name, buffer_radius and the columns are the fractions.

Return type:

pandas.DataFrame

Examples

import metobs_toolkit

# Import data into a Dataset
dataset = metobs_toolkit.Dataset()
dataset.update_settings(
                        input_data_file=metobs_toolkit.demo_datafile,
                        input_metadata_file=metobs_toolkit.demo_metadatafile,
                        template_file=metobs_toolkit.demo_template,
                        )
dataset.import_data_from_file()

# Get the landcover fractions for multiple buffers, for all stations
lc_frac_series = dataset.get_landcover(buffers=[50, 100, 250, 500],
                                       aggregate=False)

# in addition to the returned dataframe, the metadf attribute is updated aswell
print(dataset.metadf)