Commit 154b93fd authored by Bognár, Á.'s avatar Bognár, Á.
Browse files

Added tutorial to visualize simulated irradaince

Also made postprocess.view_idf_and_ill() able to return ax instead of to use for animated plots.
parent 3722440c
......@@ -6,3 +6,6 @@ __pycache__/
# docs
# test
......@@ -65,7 +65,7 @@ def view_idf_to_ax(fname=None, idf_txt=None, test=False):
return ax
def view_idf_and_ill(p_name, idf_name, sps, ill, save_fig):
def view_idf_and_ill(p_name, idf_name, sps, ill, save_fig, return_ax=False):
from geomeppy.geom.polygons import Polygon3D
"To view the e+ IDF and the DS sensorpoints together. Ill should be a pd.series with time in index"
# TODO implement auto save fig: Save_fig False: no saving, True: save it to /geo
......@@ -86,4 +86,7 @@ def view_idf_and_ill(p_name, idf_name, sps, ill, save_fig):
if return_ax:
return ax2
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
import json
import os
import sys
from postprocess import *
from daypym import *
## This tutorial shows how to visualize irradiance results with Daypym
# navigate to the project folder and run:
for f in os.listdir():
if f.endswith('.hea'):
project_name = f[:-4]
source_idf_name = r'{}.idf'.format(project_name)
# load teh previously calculated irradiance
ill = ill_to_df(p_name=project_name)
# read sensor point metadata json
with open('pts/{}.json'.format(project_name), 'r') as fp:
sps = json.load(fp)
# plot the sensor-point irradiance at a given timestep
t = pd.Timestamp('2001-06-06 15:10:00')
view_idf_and_ill(p_name=project_name, idf_name=source_idf_name, sps=sps,
ill=ill.loc[t, : ], save_fig=False)
# animated visualization of the results:
starttime = pd.Timestamp('2001-06-06 07:30:00')
endtime = pd.Timestamp('2001-06-06 19:50:00')
ill_t = ill.loc[starttime:endtime]
with open('pts/{}.json'.format(project_name), 'r') as fp:
sps2 = json.load(fp)
for t in ill_t.index:
ax = view_idf_and_ill(p_name=project_name, idf_name=source_idf_name,
sps=sps2, ill=ill.loc[t], save_fig=False,
min_irrad = ill.loc[t].min()
max_irrad = ill.loc[t].max()
mean_irrad = np.round(ill.loc[t].mean())
ax.set_title(str(t) + '\n'
+ 'G_min={}\n G_mean={}\n G_max={}'.format(min_irrad, mean_irrad, max_irrad))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment