Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add long tutorial for the DHNx pandapipes workflow #124

Open
wants to merge 14 commits into
base: dev
Choose a base branch
from

Conversation

joroeder
Copy link
Member

see title

@joroeder joroeder changed the title Add long tutorial for the DHNx optimisation process Add long tutorial for the DHNx pandapipes workflow Apr 24, 2023
@joroeder
Copy link
Member Author

@uvchik @jnettels If somebody has time to have a look at the tutorial, feedback is welcome!

If you have no time, no worries, let me know and I will merge it the next days ...

Copy link
Contributor

@jnettels jnettels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great addition to dhnx.
As noted with the "suggestion" feature, a folder creation is missing from the script.
Also I got a weird fiona error which was fixed by rearranging the order of the import to this.

import logging
import math
import numpy as np
import matplotlib.pyplot as plt
from shapely import geometry
from CoolProp.CoolProp import PropsSI
import networkx as nx
from oemof.tools import logger
import pandas as pd
import pandapipes as pp
import osmnx as ox

But maybe that is just me, because in that environment I was still running shapely 1.8 and stuff is weird right now with the switch to shapely 2.0 and how all the other packages handle it.

As a more general note, it would be great to not only have this example script for pandapipes, but actually have a interface function which translates an dhnx network to the required input for pandapipes. That would be much cleaner and more reliable, hopefully

"""
import logging
import math

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import os

# # Example of exports of the results

# to excel
with pd.ExcelWriter('results/results_fine.xlsx') as writer:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
with pd.ExcelWriter('results/results_fine.xlsx') as writer:
filepath = 'results/results_fine.xlsx'
if not os.path.exists(os.path.dirname(filepath)):
os.makedirs(os.path.dirname(filepath))
with pd.ExcelWriter(filepath) as writer:

The 'results' folder does not exist when the script runs for the first time, so we need to create it here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants