Utility Modules#

powerplantmatching.utils Module#

Utility functions for checking data completeness and supporting other functions

Functions#

atleast_1d(*arys)

Convert inputs to arrays with at least one dimension.

breakdown_matches(df)

Function to inspect grouped and matched entries of a matched dataframe.

config_filter(df, config)

Convenience function to filter data source according to the config.yaml file.

convert_alpha2_to_country(df)

convert_country_to_alpha2(df)

convert_to_short_name(df)

correct_manually(df, name[, config])

Update powerplant data based on stored corrections in powerplantmatching/data/in/manual_corrections.csv.

country_alpha2(country)

Convenience function for converting country name into alpha 2 codes

fill_geoposition(df[, use_saved_locations, ...])

Fill missing 'lat' and 'lon' values.

fun(f, q_in, q_out)

Helper function for multiprocessing in classes/functions

get_config([filename])

Import the default configuration file and update custom settings.

get_name(df)

Helper function to associate dataframe with a name.

get_obj_if_Acc(obj)

get_raw_file(name[, update, config, ...])

liteval(node_or_string)

Evaluate an expression node or a string containing only a Python expression.

lookup(df[, keys, by, exclude, unit])

Returns a lookup table of the dataframe df with rounded numbers.

parmap(f, arg_list[, config])

Parallel mapping function.

parse_Geoposition(location[, zipcode, ...])

Nominatim request for the Geoposition of a specific location in a country.

parse_string_to_dict(df, cols)

Convenience function to convert string of dict to dict type for specified columns.

read_csv_if_string(df)

Convenience function to import powerplant data source if a string is given.

restore_blocks(df[, mode, config])

Restore blocks of powerplants from a matched dataframe.

select_by_projectID(df, projectID[, ...])

Convenience function to select data by its projectID

set_column_name(df, name)

Helper function to associate dataframe with a name.

set_uncommon_fueltypes_to_other(df[, ...])

Replace uncommon fueltype specifications as by 'Other'.

to_categorical_columns(df)

Helper function to set datatype of columns 'Fueltype', 'Country', 'Set', 'File', 'Technology' to categorical.

to_dict_if_string(s)

Convenience function to ensure dict-like output

to_list_if_other(obj)

Convenience function to ensure list-like output

update_saved_matches_for_(name)

Update your saved matched for a single source.

powerplantmatching.export Module#

Functions#

cget(*args, **kw)

deprecated([deprecated_in, removed_in, ...])

Decorate a function to signify its deprecation

fueltype_to_abbrev()

Return the fueltype-specific abbreviation.

get_obj_if_Acc(obj)

map_bus(df, buses)

Assign a 'bus' column to the dataframe based on a list of coordinates.

map_country_bus(df, buses)

Assign a 'bus' column based on a list of coordinates and countries.

set_denmark_region_id(df)

Used to set the Region column to DKE/DKW (East/West) for electricity models based on lat,lon-coordinates and a heuristic for unknowns.

set_known_retire_years(df)

Integrate known retire years, e.g. for German nuclear plants with fixed decommissioning dates.

store_open_dataset()

timestype_to_life()

Returns the timestype-specific technical lifetime.

to_TIMES([df, use_scaled_capacity, baseyear])

Transform a given dataset into the TIMES format and export as .xlsx.

to_pypsa_names(df)

Rename the columns of the powerplant data according to the convention in PyPSA.

to_pypsa_network(df, network[, buslist])

Export a powerplant dataframe to a pypsa.Network(), specify specific buses to allocate the plants (buslist).

powerplantmatching.heuristics Module#

Functions to modify and adjust power plant datasets

Functions#

PLZ_to_LatLon_map()

aggregate_VRE_by_commissioning_year(df[, ...])

Aggregate the vast number of VRE (e.g. vom data.OPSD_VRE()) units to one specific (Fueltype + Technology) cohorte per commissioning year.

aggregate_VRE_by_commyear(df[, config])

deprecated([deprecated_in, removed_in, ...])

Decorate a function to signify its deprecation

derive_vintage_cohorts_from_statistics(df[, ...])

This function assumes an age-distribution for given capacity statistics and returns a df, containing how much of capacity has been built for every year.

extend_by_VRE(df[, config, base_year, ...])

Extends a given reduced dataframe by externally given VREs.

extend_by_non_matched(df, extend_by[, ...])

Returns the matched dataframe with additional entries of non-matched powerplants of a reliable source.

fill_missing_commissioning_years(df)

Fills the empty commissioning years with averages.

fill_missing_commyears(df)

fill_missing_decommissioning_years(df[, config])

Function which sets/fills a column 'DateOut' with roughly estimated values for decommissioning years, based on the estimated lifetimes per Fueltype given in the config and corresponding commissioning years.

fill_missing_decommyears(df[, config])

fill_missing_duration(df)

get_config([filename])

Import the default configuration file and update custom settings.

get_obj_if_Acc(obj)

gross_to_net_factors([reference, aggfunc, ...])

isin(df, matched[, label])

Checks if a given dataframe is included in a matched dataframe.

iteritems(d, **kw)

Return an iterator over the (key, value) pairs of a dictionary.

lookup(df[, keys, by, exclude, unit])

Returns a lookup table of the dataframe df with rounded numbers.

remove_oversea_areas(df[, lat, lon])

Remove plants outside continental Europe such as the Canarian Islands etc.

rescale_capacities_to_country_totals(df[, ...])

Returns a extra column 'Scaled Capacity' with an up or down scaled capacity in order to match the statistics of the ENTSOe country totals.

scale_to_net_capacities(df[, is_gross, ...])

set_denmark_region_id(df)

Used to set the Region column to DKE/DKW (East/West) for electricity models based on lat,lon-coordinates and a heuristic for unknowns.

set_known_retire_years(df)

Integrate known retire years, e.g. for German nuclear plants with fixed decommissioning dates.

powerplantmatching.plot Module#

Functions#

boxplot_gross_to_net([axes_style])

boxplot_matchcount(df)

Makes a boxplot for the capacities grouped by the number of matches.

country_totals_hbar(dfs[, keys, ...])

cycler(*args, **kwargs)

Create a ~cycler.Cycler object much like cycler.cycler(), but includes input validation.

draw_basemap([resolution, ax, ...])

factor_comparison(dfs[, keys, figsize])

fueltype_and_country_totals_bar(dfs[, keys, ...])

fueltype_stats(df)

fueltype_totals_bar(dfs[, keys, figsize, ...])

gather_nrows_ncols(x[, orientation])

Derives [nrows, ncols] based on x plots, so that a subplot looks nicely.

get_config([filename])

Import the default configuration file and update custom settings.

get_obj_if_Acc(obj)

lookup(df[, keys, by, exclude, unit])

Returns a lookup table of the dataframe df with rounded numbers.

make_handler_map_to_scale_circles_as_in(ax)

make_legend_circles_for(sizes[, scale])

powerplant_map(df[, scale, alpha, ...])

set_uncommon_fueltypes_to_other(df[, ...])

Replace uncommon fueltype specifications as by 'Other'.

to_list_if_other(obj)

Convenience function to ensure list-like output