Skip to content

Commit

Permalink
Merge branch 'yerbol_main' into add_h2_production
Browse files Browse the repository at this point in the history
  • Loading branch information
yerbol-akhmetov committed Dec 10, 2024
2 parents 3bdf5ff + 5d02b29 commit f71647b
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 26 deletions.
43 changes: 25 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,15 +268,22 @@ The documentation is available here: [documentation](https://pypsa-earth.readthe
<sub><b>Koen Van Greevenbroek</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Eddy-JV">
<img src="https://avatars.githubusercontent.com/u/75539255?v=4" width="100;" alt="Eddy-JV"/>
<br />
<sub><b>Eddy Jalbout</b></sub>
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/hazemakhalek">
<img src="https://avatars.githubusercontent.com/u/87850910?v=4" width="100;" alt="hazemakhalek"/>
<br />
<sub><b>Hazem</b></sub>
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/energyLS">
<img src="https://avatars.githubusercontent.com/u/89515385?v=4" width="100;" alt="energyLS"/>
Expand All @@ -298,13 +305,6 @@ The documentation is available here: [documentation](https://pypsa-earth.readthe
<sub><b>Yerbol Akhmetov</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/DeniseGiub">
<img src="https://avatars.githubusercontent.com/u/113139589?v=4" width="100;" alt="DeniseGiub"/>
<br />
<sub><b>DeniseGiub</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/GbotemiB">
<img src="https://avatars.githubusercontent.com/u/48842684?v=4" width="100;" alt="GbotemiB"/>
Expand All @@ -313,10 +313,10 @@ The documentation is available here: [documentation](https://pypsa-earth.readthe
</a>
</td>
<td align="center">
<a href="https://github.com/Eddy-JV">
<img src="https://avatars.githubusercontent.com/u/75539255?v=4" width="100;" alt="Eddy-JV"/>
<a href="https://github.com/DeniseGiub">
<img src="https://avatars.githubusercontent.com/u/113139589?v=4" width="100;" alt="DeniseGiub"/>
<br />
<sub><b>Eddy Jalbout</b></sub>
<sub><b>DeniseGiub</b></sub>
</a>
</td>
</tr>
Expand Down Expand Up @@ -409,6 +409,13 @@ The documentation is available here: [documentation](https://pypsa-earth.readthe
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/arizeosalac">
<img src="https://avatars.githubusercontent.com/u/177637669?v=4" width="100;" alt="arizeosalac"/>
<br />
<sub><b>zeosalac</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/asolavi">
<img src="https://avatars.githubusercontent.com/u/131155817?v=4" width="100;" alt="asolavi"/>
Expand Down Expand Up @@ -444,15 +451,15 @@ The documentation is available here: [documentation](https://pypsa-earth.readthe
<sub><b>Stephen J Lee</b></sub>
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/rsparks3">
<img src="https://avatars.githubusercontent.com/u/30065966?v=4" width="100;" alt="rsparks3"/>
<br />
<sub><b>Ryan</b></sub>
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/ollie-bell">
<img src="https://avatars.githubusercontent.com/u/56110893?v=4" width="100;" alt="ollie-bell"/>
Expand Down Expand Up @@ -488,15 +495,15 @@ The documentation is available here: [documentation](https://pypsa-earth.readthe
<sub><b>Pietro Monticone</b></sub>
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/Netotse">
<img src="https://avatars.githubusercontent.com/u/89367243?v=4" width="100;" alt="Netotse"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/kma33">
<img src="https://avatars.githubusercontent.com/u/25573938?v=4" width="100;" alt="kma33"/>
Expand Down Expand Up @@ -532,15 +539,15 @@ The documentation is available here: [documentation](https://pypsa-earth.readthe
<sub><b>EmreYorat</b></sub>
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/AndreCNF">
<img src="https://avatars.githubusercontent.com/u/19359510?v=4" width="100;" alt="AndreCNF"/>
<br />
<sub><b>André Cristóvão Neves Ferreira</b></sub>
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/AlexanderMeisinger">
<img src="https://avatars.githubusercontent.com/u/91368938?v=4" width="100;" alt="AlexanderMeisinger"/>
Expand Down
2 changes: 2 additions & 0 deletions doc/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1198>`__

* Drop vrestil depenedncy `PR #1220 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1220>`__

**Minor Changes and bug-fixing**

* The default configuration for `electricity:estimate_renewable_capacities:year` was updated from 2020 to 2023. `PR #1106 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1106>`__
Expand Down
1 change: 0 additions & 1 deletion envs/environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 15 additions & 1 deletion scripts/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down Expand Up @@ -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(
Expand Down
8 changes: 3 additions & 5 deletions scripts/build_population_layouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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")
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion scripts/build_renewable_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down

0 comments on commit f71647b

Please sign in to comment.