Skip to content

Commit

Permalink
fix syntax errors
Browse files Browse the repository at this point in the history
  • Loading branch information
byersiiasa committed Oct 30, 2023
1 parent 7b1fe91 commit a9f0bdb
Showing 1 changed file with 31 additions and 24 deletions.
55 changes: 31 additions & 24 deletions rime/plot_dashboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ def bin_data(data, bins):
hw_mm = hw_mm.where(land_mask['land area'] > 0)


#%%
#%% STARTS here new

fn_ds = 'C:\\Users\\byers\\IIASA\\ECE.prog - Documents\\Research Theme - NEXUS\\Hotspots_Explorer_2p0\\rcre_testing\\testing_2\\output\\maps\\'

Expand All @@ -443,15 +443,22 @@ def bin_data(data, bins):
def plot_maps_dashboard(ds, filename=None, indicators=None, year=2050, cmap='magma_r', shared_axes=True, clim=None):


if indicators==None:
indicators = list(ds.data_vars)
elif isinstance(indicators, list):
if all(x in ds.data_vars for x in indicators))==False:
except Exception as e:
print(f"Error: not all items in indicators were found in ds.")
elif isinstance(indicators, list)==False:
except Exception as e:
print(f"Error: indicators must be of type list.")
# if indicators==None:
# indicators = list(ds.data_vars)
# elif isinstance(indicators, list):
# if not all(x in ds.data_vars for x in indicators):
# print('')
# else:
# try:
# Your code here
# except Exception as e:
# print(f"Error: not all items in indicators were found in ds.")
# elif not isinstance(indicators, list):
# print('')
# try:
# nothing
# except Exception as e:
# print(f"Error: indicators must be of type list.")



Expand All @@ -460,11 +467,11 @@ def plot_maps_dashboard(ds, filename=None, indicators=None, year=2050, cmap='mag
ds = check_ds_dims(ds)


if 'year' in ds.dims:
ds = ds.sel(year=year)
elif len(ds.dims) != 2:
except Exception as e:
print(f"Error: Year not a dimension and more than 2 dimensions in dataset")
# if 'year' in ds.dims:
# ds = ds.sel(year=year)
# elif len(ds.dims) != 2:
# except Exception as e:
# print(f"Error: Year not a dimension and more than 2 dimensions in dataset")



Expand All @@ -481,16 +488,16 @@ def plot_maps_dashboard(ds, filename=None, indicators=None, year=2050, cmap='mag


# Plot - check filename
if type(filename) is None:
filename = 'maps_dashboard_{model}_{scenario}.html'
# if type(filename) is None:
# filename = 'maps_dashboard_{model}_{scenario}.html'

elif (type(filename) is str):
if (filename[:-5]) != '.html':
except Exception as e:
print(f"filename {filename} must end with '.html'")
else:
except Exception as e:
print(f"filename must be string and end with '.html'")
# elif (type(filename) is str):
# if (filename[:-5]) != '.html':
# except Exception as e:
# print(f"filename {filename} must end with '.html'")
# else:
# except Exception as e:
# print(f"filename must be string and end with '.html'")



Expand Down

0 comments on commit a9f0bdb

Please sign in to comment.