Skip to content

Commit

Permalink
Renamed top folder so docs building works
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathias157 committed Sep 20, 2024
1 parent e0050ff commit d935585
Show file tree
Hide file tree
Showing 41 changed files with 987 additions and 996 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/sphinx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ jobs:
- uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: '1.5.8-0' # any version from https://github.com/mamba-org/micromamba-releases
environment-file: "Raw\ Data\ Processing/docs/docs_environment.yml"
environment-file: RawDataProcessing/docs/docs_environment.yml
init-shell: bash
cache-environment: true
post-cleanup: 'all'
generate-run-shell: false

- name: Sphinx build
run: |
sphinx-build 'Raw Data Processing/docs' _build
sphinx-build 'RawDataProcessing/docs' _build
shell: bash -el {0}

- name: Deploy to GitHub Pages
Expand Down
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Raw Data Processing/Data/*
Raw Data Processing/Output/*
!Raw Data Processing/Data/IncFilePreSuf/README.md
!Raw Data Processing/Output/Figures/.keepoutfolder
RawDataProcessing/Data/*
RawDataProcessing/Output/*
!RawDataProcessing/Data/IncFilePreSuf/README.md
!RawDataProcessing/Output/Figures/.keepoutfolder
conversion_dictionaries.pkl
.snakemake
__pycache__
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ pip install pybalmorel
See more here
https://www.gams.com/latest/docs/API_PY_GETTING_STARTED.html

## Raw Data Processing
These scripts process raw data into Balmorel input. An application presented at the EGU24 conference is illustrated in the poster below (check Zenodo link below for a high-res pdf). For more info, read README in the Raw Data Processing folder.
## RawDataProcessing
These scripts process raw data into Balmorel input. An application presented at the EGU24 conference is illustrated in the poster below (check Zenodo link below for a high-res pdf). For more info, read README in the RawDataProcessing folder.
![Application example](https://github.com/Mathias157/balmorel-preprocessing/blob/master/Raw%20Data%20Processing/Conference%20Poster%20for%20Analysis%20of%20Spatial%20Resolutions%20for%20Modelling%20Sector-Coupled%20Energy%20Systems.png)

Data can be downloaded in the Zenodo link below and should be placed in Raw Data Processing/
Data can be downloaded in the Zenodo link below and should be placed in RawDataProcessing/

https://zenodo.org/records/10960910

Expand Down
8 changes: 0 additions & 8 deletions Raw Data Processing/Data/IncFilePreSuf/README.md

This file was deleted.

1 change: 0 additions & 1 deletion Raw Data Processing/Output/Figures/.keepthisfolder

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def convert_municipal_code_to_name(to_be_converted: pd.DataFrame,
column_to_convert: (str, int),
pivot_table: bool = False,
exclude_regions: list = ['Herlev', 'Christiansø'],
muni_geofile_path: str = r'C:\Users\mberos\gitRepos\balmorel-preprocessing\Raw Data Processing\Data\Shapefiles\Denmark\Adm\gadm36_DNK_2.shp'):
muni_geofile_path: str = r'C:\Users\mberos\gitRepos\balmorel-preprocessing\RawDataProcessing\Data\Shapefiles\Denmark\Adm\gadm36_DNK_2.shp'):

index, muni_geofile, country = prepared_geofiles('DK Municipalities')

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,83 +1,83 @@
"""
Created on 17.03.2024
@author: Mathias Berg Rosendal, PhD Student at DTU Management (Energy Economics & Modelling)
"""
#%% ------------------------------- ###
### 0. Script Settings ###
### ------------------------------- ###

import matplotlib.pyplot as plt
import pandas as pd
import geopandas as gpd
from shapely import Point
import numpy as np
from pybalmorel.functions import IncFile, read_lines

style = 'report'

if style == 'report':
plt.style.use('default')
fc = 'white'
elif style == 'ppt':
plt.style.use('dark_background')
fc = 'none'

#%% ------------------------------- ###
### 1.
### ------------------------------- ###

# From Kountouris et al 2024
XH2LOSS = 2.5e-08 # MWh/Mwh
XH2COST = 1e-6 # €/Mwh
XH2INVCOST = 0.55 # €/MW - new onshore pipe
# XH2INVCOST = 0.9 # €/MW - new offshore pipe
# XH2INVCOST = 0.15 # €/MW - repurposed onshore pipe
# XH2INVCOST = 0.2 # €/MW - repurposed offshore pipe


class Hydrogen:

def __init__(self, choice: str) -> None:

# Read pre-calculated distances
self.grid = pd.read_parquet('Data/Shapefiles/Distances/%s_Distances.gzip'%choice.upper())

# Gas storage DK1
self.gasstorage = gpd.GeoDataFrame({'geometry' : Point(9.416895889014997, 56.64039606410427)},
index=['Lille Torup'], crs='EPSG:4326')


def create_hydrogen_data(self, areas: gpd.GeoDataFrame, the_index: str) -> dict:

incfiles = {}
incfilenames = ['HYDROGEN_XH2INVCOST',
'HYDROGEN_XH2LOSS',
'HYDROGEN_AGKN']

for name in incfilenames:
incfiles[name] = IncFile(name=name,
path='Output',
body=pd.DataFrame(),
prefix=read_lines(name+'_prefix.inc',
file_path='Data/IncFilePreSuf'),
suffix=read_lines(name+'_suffix.inc',
file_path='Data/IncFilePreSuf'))

# Make investment and loss
incfiles['HYDROGEN_XH2INVCOST'].body = self.grid[self.grid.Y == '2050']
incfiles['HYDROGEN_XH2LOSS'].body = self.grid[self.grid.Y == '2050']
incfiles['HYDROGEN_XH2INVCOST'].body.loc[:, 'Value'] = incfiles['HYDROGEN_XH2INVCOST'].body['Value']*XH2INVCOST
incfiles['HYDROGEN_XH2LOSS'].body.loc[:, 'Value'] = incfiles['HYDROGEN_XH2LOSS'].body['Value']*XH2LOSS
incfiles['HYDROGEN_XH2INVCOST'].body.loc[:, 'Y'] = incfiles['HYDROGEN_XH2INVCOST'].body['Y'].str.replace('2050', '2030')
incfiles['HYDROGEN_XH2LOSS'].body.loc[:, 'Y'] = incfiles['HYDROGEN_XH2LOSS'].body['Y'].str.replace('2050', '2030')

# Find salt-cavern investment option
saltcavern = areas[areas.geometry.contains(self.gasstorage.geometry[0])][the_index].iloc[0]
incfiles['HYDROGEN_AGKN'].body = "AGKN('%s_A', 'GNR_H2S_H2-CAVERN_Y-2030') = YES;\n"%saltcavern
incfiles['HYDROGEN_AGKN'].body = "AGKN('%s_A', 'GNR_H2S_H2-CAVERN_Y-2040') = YES;\n"%saltcavern
incfiles['HYDROGEN_AGKN'].body = "AGKN('%s_A', 'GNR_H2S_H2-CAVERN_Y-2050') = YES;\n"%saltcavern

return incfiles


"""
Created on 17.03.2024
@author: Mathias Berg Rosendal, PhD Student at DTU Management (Energy Economics & Modelling)
"""
#%% ------------------------------- ###
### 0. Script Settings ###
### ------------------------------- ###

import matplotlib.pyplot as plt
import pandas as pd
import geopandas as gpd
from shapely import Point
import numpy as np
from pybalmorel.functions import IncFile, read_lines

style = 'report'

if style == 'report':
plt.style.use('default')
fc = 'white'
elif style == 'ppt':
plt.style.use('dark_background')
fc = 'none'

#%% ------------------------------- ###
### 1.
### ------------------------------- ###

# From Kountouris et al 2024
XH2LOSS = 2.5e-08 # MWh/Mwh
XH2COST = 1e-6 # €/Mwh
XH2INVCOST = 0.55 # €/MW - new onshore pipe
# XH2INVCOST = 0.9 # €/MW - new offshore pipe
# XH2INVCOST = 0.15 # €/MW - repurposed onshore pipe
# XH2INVCOST = 0.2 # €/MW - repurposed offshore pipe


class Hydrogen:

def __init__(self, choice: str) -> None:

# Read pre-calculated distances
self.grid = pd.read_parquet('Data/Shapefiles/Distances/%s_Distances.gzip'%choice.upper())

# Gas storage DK1
self.gasstorage = gpd.GeoDataFrame({'geometry' : Point(9.416895889014997, 56.64039606410427)},
index=['Lille Torup'], crs='EPSG:4326')


def create_hydrogen_data(self, areas: gpd.GeoDataFrame, the_index: str) -> dict:

incfiles = {}
incfilenames = ['HYDROGEN_XH2INVCOST',
'HYDROGEN_XH2LOSS',
'HYDROGEN_AGKN']

for name in incfilenames:
incfiles[name] = IncFile(name=name,
path='Output',
body=pd.DataFrame(),
prefix=read_lines(name+'_prefix.inc',
file_path='Data/IncFilePreSuf'),
suffix=read_lines(name+'_suffix.inc',
file_path='Data/IncFilePreSuf'))

# Make investment and loss
incfiles['HYDROGEN_XH2INVCOST'].body = self.grid[self.grid.Y == '2050']
incfiles['HYDROGEN_XH2LOSS'].body = self.grid[self.grid.Y == '2050']
incfiles['HYDROGEN_XH2INVCOST'].body.loc[:, 'Value'] = incfiles['HYDROGEN_XH2INVCOST'].body['Value']*XH2INVCOST
incfiles['HYDROGEN_XH2LOSS'].body.loc[:, 'Value'] = incfiles['HYDROGEN_XH2LOSS'].body['Value']*XH2LOSS
incfiles['HYDROGEN_XH2INVCOST'].body.loc[:, 'Y'] = incfiles['HYDROGEN_XH2INVCOST'].body['Y'].str.replace('2050', '2030')
incfiles['HYDROGEN_XH2LOSS'].body.loc[:, 'Y'] = incfiles['HYDROGEN_XH2LOSS'].body['Y'].str.replace('2050', '2030')

# Find salt-cavern investment option
saltcavern = areas[areas.geometry.contains(self.gasstorage.geometry[0])][the_index].iloc[0]
incfiles['HYDROGEN_AGKN'].body = "AGKN('%s_A', 'GNR_H2S_H2-CAVERN_Y-2030') = YES;\n"%saltcavern
incfiles['HYDROGEN_AGKN'].body = "AGKN('%s_A', 'GNR_H2S_H2-CAVERN_Y-2040') = YES;\n"%saltcavern
incfiles['HYDROGEN_AGKN'].body = "AGKN('%s_A', 'GNR_H2S_H2-CAVERN_Y-2050') = YES;\n"%saltcavern

return incfiles

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit d935585

Please sign in to comment.