Skip to content

Commit

Permalink
start plot dashboards
Browse files Browse the repository at this point in the history
  • Loading branch information
byersiiasa committed Oct 17, 2023
1 parent 6037fa7 commit 5e12fe8
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 25 deletions.
29 changes: 11 additions & 18 deletions rime/bivariate_scores.py → rime/plot_dashboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,18 @@
import itertools as it
from scipy.interpolate import interp1d

from rime.process_config import *
from rime.rime_functions import *

input_dir = "C:\\Users\\werning\\IIASA\\ECE.prog - Research Theme - NEXUS\\Hotspots_Explorer_2p0\\Data\\1_mmm_stats"
score_dir = "C:\\Users\\werning\\IIASA\ECE.prog - Research Theme - NEXUS\\Hotspots_Explorer_2p0\\Data\\3_scores"
diff_dir = "C:\\Users\\werning\\IIASA\ECE.prog - Research Theme - NEXUS\\Hotspots_Explorer_2p0\\Data\\2_differences"
std_dir = "C:\\Users\\werning\\IIASA\\ECE.prog - Research Theme - NEXUS\\Hotspots_Explorer_2p0\\Data\\score_revision\\hist_standard_deviations_V2\\"
plot_dir = "C:\\Users\\werning\\IIASA\ECE.prog - Research Theme - NEXUS\\Hotspots_Explorer_2p0\\Data\\score_revision\\bivariate"
yaml_path = "H:\\git\\climate_impacts_processing\\hotspots.yml"
landmask_path = "H:\\git\\climate_impacts_processing\\landareamaskmap0.nc"
kg_class_path = "C:\\Users\\werning\\IIASA\\ECE.prog - Research Theme - NEXUS\\Hotspots_Explorer_2p0\\Data\\kg_class.nc"

input_dir = "C:\\Users\\{user}\\IIASA\\ECE.prog - Research Theme - NEXUS\\Hotspots_Explorer_2p0\\Data\\1_mmm_stats"
score_dir = "C:\\Users\\{user}\\IIASA\ECE.prog - Research Theme - NEXUS\\Hotspots_Explorer_2p0\\Data\\3_scores"
diff_dir = "C:\\Users\\{user}\\IIASA\ECE.prog - Research Theme - NEXUS\\Hotspots_Explorer_2p0\\Data\\2_differences"
std_dir = "C:\\Users\\{user}\\IIASA\\ECE.prog - Research Theme - NEXUS\\Hotspots_Explorer_2p0\\Data\\score_revision\\hist_standard_deviations_V2\\"
# plot_dir = "C:\\Users\\{user}\\IIASA\ECE.prog - Research Theme - NEXUS\\Hotspots_Explorer_2p0\\Data\\score_revision\\bivariate"
# yaml_path = "H:\\git\\climate_impacts_processing\\hotspots.yml"
# landmask_path = "H:\\git\\climate_impacts_processing\\landareamaskmap0.nc"
# kg_class_path = "H:\\git\\climate_impacts_processing\\kg_class.nc"

# Set interpolation & load landarea mask and parameters
land_mask = hfp.load_landmask(landmask_path)
Expand Down Expand Up @@ -61,16 +64,6 @@
# %% Functions
# -----------------------------------------------------------------------------

# def bin_data(data, bins):

# print(bins)

# no_impact = xr.where(data < bins[1], bins[0], data)
# low_impact = xr.where((no_impact < bins[2]) & (no_impact >= bins[1]), 1, no_impact)
# medium_impact = xr.where((low_impact < bins[3]) & (low_impact >= bins[2]), 2, low_impact)
# high_impact = xr.where(medium_impact >= bins[3], 3, medium_impact)

# return high_impact


def bin_data(data, bins):
Expand Down
22 changes: 15 additions & 7 deletions rime/process_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
# =============================================================================
import os

# Run and environment settings
user = "byers"
env = "pc"
# env = 'server'
# env = 'ebro3'

git_path = f"C:\\users\\{user}\\Github\\"



# From generate_aggregated_inputs.py

Expand All @@ -23,11 +32,7 @@
yr_start = 2010
yr_end = 2100

# Run and environment settings
user = "byers"
env = "pc"
# env = 'server'
# env = 'ebro3'


num_workers = 24
parallel = True # Uses Dask in processing the IAMC scenarios
Expand All @@ -40,7 +45,10 @@
# %% Working directories
# =============================================================================

yaml_path = "C:\\users\\byers\\Github\\climate_impacts_processing\\hotspots.yml"

yaml_path = git_path+"climate_impacts_processing\\hotspots.yml"
landmask_path = git_path+"climate_impacts_processing\\landareamaskmap0.nc"
kg_class_path = git_path+"climate_impacts_processing\\kg_class.nc"

if env == "pc":
# Main working directory
Expand Down Expand Up @@ -112,7 +120,7 @@
# impact data settings

indicators = ["cdd", "precip"]
ftype = "score"
ftype = "score" #score
interpolation = 0.01


Expand Down
1 change: 1 addition & 0 deletions rime/process_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Created on Thu Apr 6 11:36:24 2023
@author: werning, byers
Execute this script ideally in the top level of the RIME directory
To Do:
Expand Down
20 changes: 20 additions & 0 deletions rime/rime_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,26 @@ def map_transform_gmt_multi_dask(


def calculate_cumulative_CO2(ts, first_year, year, variable):
"""
Parameters
----------
ts : TYPE
DESCRIPTION.
first_year : TYPE
DESCRIPTION.
year : TYPE
DESCRIPTION.
variable : TYPE
DESCRIPTION.
Returns
-------
dfo : TYPE
DESCRIPTION.
"""
dfo = (
ts.apply(
pyam.cumulative, raw=False, axis=1, first_year=first_year, last_year=year
Expand Down

0 comments on commit 5e12fe8

Please sign in to comment.