widgets = [ pgb.widgets.Percentage(), ' ', pgb.widgets.SimpleProgress(format='(%s)' % pgb.widgets.SimpleProgress.DEFAULT_FORMAT), ' ', pgb.widgets.Bar(), ' ', pgb.widgets.Timer(), ' ', pgb.widgets.ETA() ] progressbar = pgb.ProgressBar(prefix='Compute GIS potentials: ', widgets=widgets, max_value=len(countries)) if not os.path.isdir(snakemake.output.exclusion): os.makedirs(snakemake.output.exclusion) matrix = vstack([calculate_potential(i, save_map=os.path.join(snakemake.output.exclusion, countries[i])) for i in progressbar(regions.index)]) areamatrix = matrix * spdiag(vlanduse._cutout_cell_areas(cutout).ravel()) areamatrix.data[areamatrix.data < 1.] = 0 # ignore weather cells where only less than 1 km^2 can be installed areamatrix.eliminate_zeros() resource = config['resource'] func = getattr(cutout, resource.pop('method')) correction_factor = config.get('correction_factor', 1.) capacity_factor = func(capacity_factor=True, show_progress='Compute capacity factors: ', **resource).stack(spatial=('y', 'x')) flh_uncorr = capacity_factor * 8760 flh_corr = correction_factor * flh_uncorr if snakemake.wildcards.technology == 'solar': pietzcker = pd.read_excel(snakemake.input.pietzker, sheet_name="PV on all area", skiprows=2, header=[0,1]).iloc[1:177] p_area1_50 = pietzcker['Usable Area at given FLh in 1-50km distance to settlement '].dropna(axis=1) p_area1_50.columns = p_area1_50.columns.str.split(' ').str[0]
#The selection of CORINE Land Cover [1] types that are allowed for wind and solar are based on [2] p.42 / p.28 # #[1] https://www.eea.europa.eu/ds_resolveuid/C9RK15EA06 # #[2] Scholz, Y. (2012). Renewable energy based electricity supply at low costs: development of the REMix model and application for Europe. lc_scholz_onshore = [12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 31, 32] lc_scholz_solar = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 26, 31, 32] lc_onshore = lc_scholz_onshore lc_offshore = [44, 255] lc_solar = lc_scholz_solar #### $A_{RC}$: Raster cell area reatlas_cell_areas=vlanduse._cutout_cell_areas(cutout) #### $f_{LU}$: factor usable land area (via land use type and natura reserves) @cachable def get_landuse(cutout, lc, natura=True): return vlanduse.corine_for_cutout(cutout, lc, natura=natura) onshore_landuse = get_landuse(cutout, lc_onshore, natura=True) offshore_landuse = get_landuse(cutout, lc_offshore, natura=True) solar_landuse = get_landuse(cutout, lc_solar, natura=True) #### $G_s^{max inst}$ in units of MW/km$^2$ # ScholzPhD [2] # Tab. 4.3.1: Area-specific installable capacity for on/offshore wind = 10MW/km^2
widgets = [ pgb.widgets.Percentage(), ' ', pgb.widgets.SimpleProgress( format='(%s)' % pgb.widgets.SimpleProgress.DEFAULT_FORMAT), ' ', pgb.widgets.Bar(), ' ', pgb.widgets.Timer(), ' ', pgb.widgets.ETA() ] progressbar = pgb.ProgressBar(prefix='Compute GIS potentials: ', widgets=widgets, max_value=len(regions)) matrix = vstack( list(progressbar(pool.imap(calculate_potential, regions.index)))) potentials = config['capacity_per_sqkm'] * vlanduse._cutout_cell_areas( cutout) potmatrix = matrix * spdiag(potentials.ravel()) potmatrix.data[ potmatrix.data < 1.] = 0 # ignore weather cells where only less than 1 MW can be installed potmatrix.eliminate_zeros() resource = config['resource'] func = getattr(cutout, resource.pop('method')) correction_factor = config.get('correction_factor', 1.) if correction_factor != 1.: logger.warning( 'correction_factor is set as {}'.format(correction_factor)) capacity_factor = correction_factor * func( capacity_factor=True, show_progress='Compute capacity factors: ',
import os import atlite import xarray as xr import pandas as pd from vresutils import landuse as vlanduse config = snakemake.config['renewable'][snakemake.wildcards.technology] cutout = atlite.Cutout(config['cutout'], cutout_dir=os.path.dirname(snakemake.input.cutout)) total_capacity = config['capacity_per_sqm'] * vlanduse._cutout_cell_areas( cutout) potentials = xr.DataArray( total_capacity * vlanduse.corine_for_cutout(cutout, fn=snakemake.input.corine, natura_fn=snakemake.input.natura, **config['corine']), [cutout.meta.indexes['y'], cutout.meta.indexes['x']]) if 'height_cutoff' in config: potentials.values[(cutout.meta['height'] < -config['height_cutoff']).transpose( *potentials.dims)] = 0. potentials.to_netcdf(snakemake.output[0])