From cd87051c038ba61422136b521e9845d90b61fe6c Mon Sep 17 00:00:00 2001 From: Emmanuel Bolarinwa Date: Wed, 4 Dec 2024 19:07:43 +0100 Subject: [PATCH 1/3] updated hydrobasin path --- scripts/build_renewable_profiles.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/build_renewable_profiles.py b/scripts/build_renewable_profiles.py index 0a6bff8b1..8c16bce09 100644 --- a/scripts/build_renewable_profiles.py +++ b/scripts/build_renewable_profiles.py @@ -538,7 +538,9 @@ def create_scaling_factor( # filter plants for hydro if snakemake.wildcards.technology.startswith("hydro"): country_shapes = gpd.read_file(paths.country_shapes) - hydrobasins = gpd.read_file(os.path.join(BASE_DIR, resource["hydrobasins"])) + hydrobasins_path = os.path.join(BASE_DIR, resource["hydrobasins"]) + resource["hydrobasins"] = hydrobasins_path + hydrobasins = gpd.read_file(hydrobasins_path) ppls = load_powerplants(snakemake.input.powerplants) hydro_ppls = ppls[ppls.carrier == "hydro"] From c12ce1add1ffbaafba4ff92dd2c821d00a6d73d5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 11:01:02 +0100 Subject: [PATCH 2/3] docs(contributor): contrib-readme-action has updated readme (#1230) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- README.md | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index ab89b2909..851540909 100644 --- a/README.md +++ b/README.md @@ -268,6 +268,15 @@ The documentation is available here: [documentation](https://pypsa-earth.readthe Koen Van Greevenbroek + + + Eddy-JV +
+ Eddy Jalbout +
+ + + hazemakhalek @@ -275,8 +284,6 @@ The documentation is available here: [documentation](https://pypsa-earth.readthe Hazem - - energyLS @@ -298,13 +305,6 @@ The documentation is available here: [documentation](https://pypsa-earth.readthe Yerbol Akhmetov - - - DeniseGiub -
- DeniseGiub -
- GbotemiB @@ -313,10 +313,10 @@ The documentation is available here: [documentation](https://pypsa-earth.readthe - - Eddy-JV + + DeniseGiub
- Eddy Jalbout + DeniseGiub
@@ -409,6 +409,13 @@ The documentation is available here: [documentation](https://pypsa-earth.readthe + + + arizeosalac +
+ zeosalac +
+ asolavi @@ -444,6 +451,8 @@ The documentation is available here: [documentation](https://pypsa-earth.readthe Stephen J Lee + + rsparks3 @@ -451,8 +460,6 @@ The documentation is available here: [documentation](https://pypsa-earth.readthe Ryan - - ollie-bell @@ -488,6 +495,8 @@ The documentation is available here: [documentation](https://pypsa-earth.readthe Pietro Monticone + + Netotse @@ -495,8 +504,6 @@ The documentation is available here: [documentation](https://pypsa-earth.readthe Null - - kma33 @@ -532,6 +539,8 @@ The documentation is available here: [documentation](https://pypsa-earth.readthe EmreYorat + + AndreCNF @@ -539,8 +548,6 @@ The documentation is available here: [documentation](https://pypsa-earth.readthe André Cristóvão Neves Ferreira - - AlexanderMeisinger From 5d02b2920e1839f3c325093d53a728936351f4c2 Mon Sep 17 00:00:00 2001 From: Ekaterina Date: Mon, 9 Dec 2024 19:24:01 +0100 Subject: [PATCH 3/3] Remove vresutil (#1220) * Implement annuity locally * Fix refuse * Remove vresutils dependency * Add a description of old implementation * Update environment * Remove redundand transformation * Drop testing comments * Add a release note --- doc/release_notes.rst | 2 ++ envs/environment.yaml | 1 - scripts/_helpers.py | 16 +++++++++++++++- scripts/build_population_layouts.py | 8 +++----- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/doc/release_notes.rst b/doc/release_notes.rst index d8777d57f..88c91ed19 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -37,6 +37,8 @@ E.g. if a new rule becomes available describe how to use it `make test` and in o * Remove elec-based H2 and battery technologies before addition in `prepare_sector_network.py` script and fix bus names for links that models H2 repuspose network `PR #1198 `__ +* Drop vrestil depenedncy `PR #1220 `__ + **Minor Changes and bug-fixing** * The default configuration for `electricity:estimate_renewable_capacities:year` was updated from 2020 to 2023. `PR #1106 `__ diff --git a/envs/environment.yaml b/envs/environment.yaml index 5cf7cd46e..fd285a27e 100644 --- a/envs/environment.yaml +++ b/envs/environment.yaml @@ -86,7 +86,6 @@ dependencies: - pip: - earth-osm>=2.2 # until conda release it out for earth-osm - git+https://github.com/davide-f/google-drive-downloader@master # google drive with fix for virus scan - - git+https://github.com/FRESNA/vresutils@master # until new pip release > 0.3.1 (strictly) - tsam>=1.1.0 - chaospy # lastest version only available on pip - fake_useragent diff --git a/scripts/_helpers.py b/scripts/_helpers.py index 5beacdcf6..36cf0d95c 100644 --- a/scripts/_helpers.py +++ b/scripts/_helpers.py @@ -24,7 +24,6 @@ from fake_useragent import UserAgent from pypsa.components import component_attrs, components from shapely.geometry import Point -from vresutils.costdata import annuity logger = logging.getLogger(__name__) @@ -923,6 +922,21 @@ def get_last_commit_message(path): # PYPSA-EARTH-SEC +def annuity(n, r): + """ + Calculate the annuity factor for an asset with lifetime n years and. + + discount rate of r, e.g. annuity(20, 0.05) * 20 = 1.6 + """ + + if isinstance(r, pd.Series): + return pd.Series(1 / n, index=r.index).where( + r == 0, r / (1.0 - 1.0 / (1.0 + r) ** n) + ) + elif r > 0: + return r / (1.0 - 1.0 / (1.0 + r) ** n) + else: + return 1 / n def prepare_costs( diff --git a/scripts/build_population_layouts.py b/scripts/build_population_layouts.py index fbf5bcae3..d39816da5 100644 --- a/scripts/build_population_layouts.py +++ b/scripts/build_population_layouts.py @@ -14,7 +14,6 @@ import pandas as pd import xarray as xr from _helpers import read_csv_nafix -from vresutils import shapes as vshapes if __name__ == "__main__": if "snakemake" not in globals(): @@ -31,7 +30,7 @@ ) # os.path.abspath(snakemake.config["atlite"]["cutout"]) cutout = atlite.Cutout(cutout_path) - grid_cells = cutout.grid.geometry.to_list() + grid_cells = cutout.grid.geometry # nuts3 has columns country, gdp, pop, geometry nuts3 = gpd.read_file(snakemake.input.nuts3_shapes).set_index("GADM_ID") @@ -75,9 +74,8 @@ pop_cells = pd.Series(I.dot(nuts3["pop"])) gdp_cells = pd.Series(I.dot(nuts3["gdp"])) - # in km^2 - with mp.Pool(processes=snakemake.threads) as pool: - cell_areas = pd.Series(pool.map(vshapes.area, grid_cells)) / 1e6 + area_crs = snakemake.config["crs"]["area_crs"] + cell_areas = grid_cells.to_crs(area_crs).area / 1e6 # pop per km^2 density_cells_pop = pop_cells / cell_areas