Skip to content

Instantly share code, notes, and snippets.

@gplssm
gplssm / hh_demand_profiles_data_check.py
Created June 15, 2021 10:20
Creates additional tables in the database that adds geometries to household demand data for data checking
import geopandas as gpd
from sqlalchemy import Column, ForeignKey, Integer, String, text
from sqlalchemy.ext.declarative import declarative_base
from egon.data import db
from egon.data.processing.hh_demand.hh_demand_profiles_tools import HouseholdElectricityProfilesInCensusCells
from egon.data.processing.zensus_grid_districts import MapZensusGridDistricts
from egon.data.processing.zensus_vg250.zensus_population_inside_germany import (
DestatisZensusPopulationPerHaInsideGermany,
)
@gplssm
gplssm / mirror_mastr_csv_export.py
Created June 7, 2021 07:22
Script for using tools from open-MaStR
from open_mastr.soap_api.mirror import MaStRMirror
import datetime
technology = ["solar", "wind", "biomass", "combustion", "gsgk", "hydro", "nuclear", "storage"]
data_types = ["unit_data", "eeg_data", "kwk_data", "permit_data"]
location_types = ["location_elec_generation", "location_elec_consumption", "location_gas_generation",
"location_gas_consumption"]
@gplssm
gplssm / test_mv_grid_district_creation_reproducibility.py
Created April 27, 2021 14:02
Compare results of MV grid districts
"""
Compare results of different runs for creating MV grid districts
Execute this script inside the eGon-data working/project directory
using the eGon-data virtual environment.
"""
from egon.data.processing.mv_grid_districts import substations_in_municipalities, split_multi_substation_municipalities, merge_polygons_to_grid_district, HvmvSubstPerMunicipality, VoronoiMunicipalityCuts, VoronoiMunicipalityCutsAssigned, MvGridDistrictsDissolved
from egon.data import db
import pandas as pd
@gplssm
gplssm / test_notebook_start-no-heading-H1-separate.ipynb
Created October 1, 2020 09:31
WindNODE_ABW single scenario results NBs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gplssm
gplssm / windnode_abw_test_docs_like_RTD.sh
Created August 15, 2020 15:57
Reproduce steps done by RTD to build docs from GitHub sources
#!/bin/bash
source ~/miniconda3/etc/profile.d/conda.sh
# conda setup
conda create -n windnode_abw_testdocs python=3 -y
conda activate windnode_abw_testdocs
# create dir
mkdir windnode_abw_testdocs
@gplssm
gplssm / windnode_abw_requirements_nb-49.txt
Created August 6, 2020 03:42
Version-specific pip requirement for WindNODE_ABW from NB-49
alabaster==0.7.12
ansiwrap==0.8.4
appdirs==1.4.3
async-generator==1.10
attrs==19.3.0
Babel==2.8.0
backcall==0.2.0
beautifulsoup4==4.9.1
black==19.10b0
bleach==3.1.5
@gplssm
gplssm / edges.csv
Created August 3, 2020 11:53
Test of Python skills with an example of graph analysis
node1 node2
Source 1
2 3
1 2
3 10
10 Target
1 4
4 5
5 Target
1 6
@gplssm
gplssm / run_analysis_local.py
Created May 19, 2020 10:58
Example script to post-process WindNODE_ABW model results
# define and setup logger
from windnode_abw.tools.logger import setup_logger
logger = setup_logger()
# load configs
from windnode_abw.tools import config
config.load_config('config_data.cfg')
config.load_config('config_misc.cfg')
from windnode_abw.tools.data_io import load_results
@gplssm
gplssm / LICENSE
Last active May 15, 2020 07:48
Query data from OEP with SQLAlchemy ORM and (Geo-)Pandas
Copyright 2020 Guido Pleßmann (gplssm)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
@gplssm
gplssm / Import_eDisGo_PyPSA.ipynb
Last active May 4, 2020 16:30
EVNG Neplan grid data conversion
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.