correction_functions.py

lib.correction_functions.clean_IRENA_summary(paths, param)

This function reads the IRENA database, format the output for selected regions and computes the FLH based on the installed capacity and yearly energy production. The results are saved in CSV file.

Parameters
  • param (dict) – Dictionary of dictionaries containing list of subregions, and year.

  • paths (dict) – Dictionary of dictionaries containing the paths to the IRENA country name dictionary, and IRENA database.

Returns

The CSV file containing the summary of IRENA data for the countries within the scope is saved directly in the desired path, along with the corresponding metadata in a JSON file.

Return type

None

lib.correction_functions.clean_weather_data(p, paths, param)

This function detects data outliers in the weather input .mat files. An outlier is a data point, for which the absolute value of the difference between the yearly average value and the mean of the direct neighbors (Moore neighborhood) is higher than a user-defined threshold MERRA_correction_factor. It replaces the hourly values with the hourly values of the mean of the neighbors, and overwrites the original .mat file.

Parameters
  • paths (dict) – Dictionary including the path to the weather .mat files.

  • param (dict) – Dictionary including the threshold value MERRA_correction_factor.

Returns

The file weather .mat files are overwritten after the correction.

Return type

None

lib.correction_functions.generate_wind_correction(paths, param)

This function creates a matrix of correction factors for onshore and/or offshore wind. There are different types of correction:

  • Gradient correction: Adjusts for the hub height of the wind turbines, based on the Hellmann coefficients of each land use type. This correction applies always.

  • Resolution correction: Performs a redistribution of wind speed when increasing the resolution based on land use types, while ensuring that the average of each MERRA-2 cell at 50m is still the same. This correction is optional, and is activated if res_correction is 1. If not activated, the same value from the low resolution is repeated.

  • Topographic/Orographic correction: Takes into account the elevation of the terrain, because MERRA-2 usually underestimates the wind speed in mountains. This correction is optional, uses data from the Global Wind Atlas for all countries in the scope, and is activated only for onshore wind if topo_correction is 1

Parameters
  • paths (dict) – Dictionary of dictionaries containing the paths to the land, land use, and topography rasters, and to the output files CORR_ON and CORR_OFF.

  • param (dict) – Dictionary of dictionaries containing user-preferences regarding the wind correction, landuse, hub height, weather and desired resolutions.

Returns

The rasters for wind correction CORR_ON and/or CORR_OFF are saved directly in the user-defined paths, along with their metadata in JSON files.

Return type

None