From b0be70c52eb32258ac7ff5fd2953e1dab2f76ce2 Mon Sep 17 00:00:00 2001 From: Hazem-IEG Date: Mon, 4 Mar 2024 17:59:35 +0100 Subject: [PATCH 1/3] update default pypsa-earth commit --- pypsa-earth | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pypsa-earth b/pypsa-earth index 35ada5e9..283668a1 160000 --- a/pypsa-earth +++ b/pypsa-earth @@ -1 +1 @@ -Subproject commit 35ada5e949a82985af7e9ef3adb9931323bdc9c7 +Subproject commit 283668a1c0be438ae0feb910c92ea72e92069c95 From 0e50a0900007e51d506d42ac88e96281fadc3d9b Mon Sep 17 00:00:00 2001 From: Hazem-IEG Date: Mon, 4 Mar 2024 18:05:51 +0100 Subject: [PATCH 2/3] update pypsa-earth.config to fit the updated submodule --- config.pypsa-earth.yaml | 49 ++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/config.pypsa-earth.yaml b/config.pypsa-earth.yaml index fdcb279c..c7c90999 100644 --- a/config.pypsa-earth.yaml +++ b/config.pypsa-earth.yaml @@ -16,7 +16,7 @@ enable: retrieve_databundle: true # Recommended 'true', for the first run. Otherwise data might be missing. retrieve_cost_data: true # true: retrieves cost data from technology data and saves in resources/costs.csv, false: uses cost data in data/costs.csv download_osm_data: true # If 'true', OpenStreetMap data will be downloaded for the above given countries - build_natura_raster: true # If True, than an exclusion raster will be build + build_natura_raster: false # If True, than an exclusion raster will be build build_cutout: false # If "build_cutout" : true, then environmental data is extracted according to `snapshots` date range and `countries` # requires cds API key https://cds.climate.copernicus.eu/api-how-to @@ -90,7 +90,6 @@ build_shape_options: out_logging: true # When true, logging is printed to console year: 2020 # reference year used to derive shapes, info on population and info on GDP nprocesses: 3 # number of processes to be used in build_shapes - nchunks: 3 # number of data chuncks for build_shapes. If not specified or smaller than nprocesses, specified as nprocesses worldpop_method: "standard" # "standard" pulls from web 1kmx1km raster, "api" pulls from API 100mx100m raster, false (not "false") no pop addition to shape which is useful when generating only cutout gdp_method: "standard" # "standard" pulls from web 1x1km raster, false (not "false") no gdp addition to shape which useful when generating only cutout contended_flag: "set_by_country" # "set_by_country" assigns the contended areas to the countries according to the GADM database, "drop" drops these contended areas from the model @@ -292,9 +291,10 @@ renewable: extendable: true hydro: cutout: cutout-2013-era5 + hydrobasins_level: 6 resource: method: hydro - hydrobasins: data/hydrobasins/hybas_world_lev06_v1c.shp + hydrobasins: data/hydrobasins/hybas_world.shp flowspeed: 1.0 # m/s # weight_with_height: false # show_progress: true @@ -324,7 +324,7 @@ costs: investment: 0 lifetime: 25 CO2 intensity: 0 - discount rate: 0.15 + discount rate: 0.071 marginal_cost: # EUR/MWh solar: 0.01 onwind: 0.015 @@ -340,18 +340,37 @@ costs: monte_carlo: + # Description: Specify Monte Carlo sampling options for uncertainty analysis. + # Define the option list for Monte Carlo sampling. + # Make sure add_to_snakefile is set to true to enable Monte-Carlo options: - add_to_snakefile: false - samples: 7 # number of optimizations - sampling_strategy: "chaospy" # "pydoe2", "chaospy", "scipy", packages that are supported - pypsa_standard: - # User can add here flexibly more features for the Monte-Carlo sampling. - # Given as "key: value" format - # Key: add below the pypsa object for the monte_carlo sampling, "network" is only allowed for filtering! - # Value: currently supported format [l_bound, u_bound] or empty [], represent multiplication factors for the object - loads_t.p_set: [0.9, 1.1] - # generators_t.p_max_pu.loc[:, n.generators.carrier == "wind"]: [0.9, 1.1] - # generators_t.p_max_pu.loc[:, n.generators.carrier == "solar"]: [0.9, 1.1] + add_to_snakefile: false # When set to true, enables Monte Carlo sampling + samples: 9 # number of optimizations. Note that number of samples when using scipy has to be the square of a prime number + sampling_strategy: "chaospy" # "pydoe2", "chaospy", "scipy", packages that are supported + seed: 42 # set seedling for reproducibilty + # Uncertanties on any PyPSA object are specified by declaring the specific PyPSA object under the key 'uncertainties'. + # For each PyPSA object, the 'type' and 'args' keys represent the type of distribution and its argument, respectively. + # Supported distributions types are uniform, normal, lognormal, triangle, beta and gamma. + # The arguments of the distribution are passed using the key 'args' as follows, tailored by distribution type + # normal: [mean, std], lognormal: [mean, std], uniform: [lower_bound, upper_bound], + # triangle: [mid_point (between 0 - 1)], beta: [alpha, beta], gamma: [shape, scale] + # More info on the distributions are documented in the Chaospy reference guide... + # https://chaospy.readthedocs.io/en/master/reference/distribution/index.html + # An abstract example is as follows: + # {pypsa network object, e.g. "loads_t.p_set"}: + # type: {any supported distribution among the previous: "uniform", "normal", ...} + # args: {arguments passed as a list depending on the distribution, see the above and more at https://pypsa.readthedocs.io/} + uncertainties: + loads_t.p_set: + type: uniform + args: [0, 1] + generators_t.p_max_pu.loc[:, n.generators.carrier == "onwind"]: + type: lognormal + args: [1.5] + generators_t.p_max_pu.loc[:, n.generators.carrier == "solar"]: + type: beta + args: [0.5, 2] + solving: From 23d1164d729a5e966cf25958b2e096e7a036ea40 Mon Sep 17 00:00:00 2001 From: Hazem-IEG Date: Mon, 4 Mar 2024 18:25:04 +0100 Subject: [PATCH 3/3] remove deprecated n_chunks prarameter from prepare_gas_network --- scripts/prepare_gas_network.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/prepare_gas_network.py b/scripts/prepare_gas_network.py index fe85c65f..de0e20a9 100644 --- a/scripts/prepare_gas_network.py +++ b/scripts/prepare_gas_network.py @@ -480,7 +480,6 @@ def gadm( out_logging=False, year=2020, nprocesses=None, - nchunks=None, ): if out_logging: logger.info("Stage 4/4: Creation GADM GeoDataFrame") @@ -545,7 +544,6 @@ def load_bus_region(onshore_path, pipelines): contended_flag = config_pypsa_earth["build_shape_options"]["contended_flag"] geo_crs = config_pypsa_earth["crs"]["geo_crs"] distance_crs = config_pypsa_earth["crs"]["distance_crs"] - nchunks = config_pypsa_earth["build_shape_options"]["nchunks"] bus_regions_onshore = gadm( countries_list, @@ -556,7 +554,6 @@ def load_bus_region(onshore_path, pipelines): out_logging, year, nprocesses=nprocesses, - nchunks=nchunks, ) # bus_regions_onshore = bus_regions_onshore.reset_index()