5.2. copro.variables.nc_with_continous_datetime_timestamp

copro.variables.nc_with_continous_datetime_timestamp(extent_gdf, config, root_dir, var_name, sim_year)[source]

This function extracts a value from a netCDF-file (specified in the cfg-file) for each polygon specified in extent_gdf for a given year. In the cfg-file, it must also be specified whether the value is log-transformed or not, and which statistical method is applied.

NOTE: The key in the cfg-file must be identical to variable name in netCDF-file.

NOTE: Works only with nc-files with annual data.

Parameters
  • extent_gdf (geodataframe) – geo-dataframe containing one or more polygons with geometry information for which values are extracted

  • config (config) – parsed configuration settings of run.

  • root_dir (str) – path to location of cfg-file.

  • var_name (str) – name of variable in nc-file, must also be the same under which path to nc-file is specified in cfg-file.

  • sim_year (int) – year for which data is extracted.

Raises
  • ValueError – raised if not everything is specified in cfg-file.

  • ValueError – raised if specfied year cannot be found in years in nc-file.

  • ValueError – raised if the extracted variable at a time step does not contain data.

Returns

list containing statistical value per polygon, i.e. with same length as extent_gdf.

Return type

list