Skip to content

Commit

Permalink
Merge pull request #155 from nismod/p3_weather_full
Browse files Browse the repository at this point in the history
updated again
  • Loading branch information
eggimasv committed Feb 6, 2019
2 parents 91df046 + 247e695 commit c497ed8
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 16 deletions.
2 changes: 1 addition & 1 deletion energy_demand/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ def energy_demand_model(
# Write annual results to txt files
# -------------------------------------------
print("... Start writing results to file: " + str(data['weather_yr_result_paths']['data_results_model_run_results_txt']))
plot_only_selection = True
plot_only_selection = True
if plot_only_selection:

# Write only total region
Expand Down
4 changes: 2 additions & 2 deletions energy_demand/plotting/fig_3_plot_over_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ def scenario_over_time(

# dataframe with national peak (columns= simulation year, row: Realisation)
# Calculate quantiles
quantile_95 = 0.95
quantile_05 = 0.05
quantile_95 = 0.95 #0.68
quantile_05 = 0.05 #0.32

try:
color = colors[scenario_name]
Expand Down
34 changes: 24 additions & 10 deletions energy_demand/read_write/write_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,11 @@ def write_space_and_water_heating(
basic_functions.create_folder(
path_result, "enduse_specific_results")

for _, fuel in tot_fuel_y_enduse_specific_yh.items():
shape = fuel.shape
fuel_aggregated = np.zeros(shape)
break

for enduse, fuel in tot_fuel_y_enduse_specific_yh.items():
logging.info(" ... Enduse specific writing to file: %s Total demand: %s ", enduse, np.sum(fuel))

Expand All @@ -506,18 +511,27 @@ def write_space_and_water_heating(
'rs_water_heating',
'ss_water_heating']:

path_file = os.path.join(
os.path.join(path_result, "enduse_specific_results"),
"{}__{}__{}{}".format(
filename,
enduse,
sim_yr,
".npy"))
fuel_aggregated += fuel

path_file = os.path.join(
os.path.join(path_result, "enduse_specific_results"),
"{}__{}__{}{}".format(
filename,
"all_heating",
sim_yr,
".npy"))

np.save(path_file, fuel)
# Find peak day of electricity across all heating end uses
lookups = lookup_tables.basic_lookups()
fueltype_int = lookups['fueltypes']['electricity']

statistics_to_print.append("{}\t\t\t\t{}".format(
enduse, np.sum(fuel)))
peak_day_electricity, _ = enduse_func.get_peak_day_single_fueltype(fuel_aggregated[fueltype_int])
selected_hours = date_prop.convert_yearday_to_8760h_selection(peak_day_electricity)
selected_demand = fuel_aggregated[:, selected_hours]
np.save(path_file, selected_demand)

statistics_to_print.append("{}\t\t\t\t{}".format(
"all_heating", np.sum(fuel_aggregated)))

# Create statistic files with sum of all end uses
path_file = os.path.join(
Expand Down
4 changes: 1 addition & 3 deletions energy_demand/result_processing/p3_weather_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
from energy_demand.basic import basic_functions

# Folder paths
path_out = "C:/__TEST" # Folder to store results
path_results = "C:/Users/cenv0553/ED/results"
path_results = "C:\_WEATHER_p3" # Folder of calculated model runs
path_out = "C:/__DATA_RESULTS_FINAL" # Folder to store results
path_results = "//linux-filestore.ouce.ox.ac.uk/mistral/nismod/data/energy_demand/_p3_results_weather_second_ROUDN"

# Scenario definitions
Expand Down

0 comments on commit c497ed8

Please sign in to comment.