Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]
### Changed
- Remove mutable argument defaults to avoid gotchas. ([PR #44](https://github.com/ClimateImpactLab/dscim/pull/44), [@brews](https://github.com/brews))
- Quiet unused(?), common, logging messages to terminal. ([PR #14](https://github.com/ClimateImpactLab/dscim/pull/14), [@brews](https://github.com/brews))

## [0.1.0] - 2022-08-30
Expand Down
12 changes: 7 additions & 5 deletions src/dscim/diagnostics/batch_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,24 +74,26 @@ def batch_maps(
ECON_ZARR,
eta,
maxmin=True,
selection=dict(year=2097, ssp=["SSP2", "SSP3", "SSP4"], batch="batch0"),
selection=None,
location=(0.35, -0.2),
gcm="mean",
prefix=None,
variables=[
variables=(
"rp_inc_share",
"rp_damage_share",
"rp_cons_share",
"rp",
"cons",
"cons_ce",
],
maxes=[None, None, None, None, None, None],
mins=[None, None, None, None, None, None],
),
maxes=(None, None, None, None, None, None),
mins=(None, None, None, None, None, None),
year=2097,
plot=True,
save_path=None,
):
if selection is None:
selection = dict(year=2097, ssp=["SSP2", "SSP3", "SSP4"], batch="batch0")

assert len(maxes) == len(
variables
Expand Down
2 changes: 1 addition & 1 deletion src/dscim/diagnostics/compare_sccs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


def compare_sccs(
rootdict, recipe, disc, eta, rho, quantiles=[0, 0.05, 0.5, 0.95, 1], wp="0.5"
rootdict, recipe, disc, eta, rho, quantiles=(0, 0.05, 0.5, 0.95, 1), wp="0.5"
):

this_list = []
Expand Down
8 changes: 4 additions & 4 deletions src/dscim/diagnostics/damage_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def damage_function(
rho,
year=2097,
hue_vars="ssp",
recipes=["adding_up", "risk_aversion", "equity"],
recipes=("adding_up", "risk_aversion", "equity"),
scale=10**12,
x_lim=(-np.inf, np.inf),
y_lim=(-np.inf, np.inf),
Expand All @@ -97,7 +97,7 @@ def damage_function(
Type of discounting. Can be 'constant', 'ramsey', or 'wr'.
year: int
Year of damage function to be plotted.
recipes : list of str
recipes : sequence of str
Recipe types to be plotted. Can be 'adding_up', 'risk_aversion', 'equity'
scale : int
Units of dollars for axis. ie., if 10**12 is passed, y axis will be in trillions.
Expand Down Expand Up @@ -269,8 +269,8 @@ def damage_function_w_consumption(
output,
eta,
rho,
years=[2050, 2099],
recipes=["equity"],
years=(2050, 2099),
recipes=("equity",),
disc="constant",
model="IIASA GDP",
ssp="SSP3",
Expand Down
12 changes: 6 additions & 6 deletions src/dscim/diagnostics/discount_rates.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ def plot_implicit_rates(
eta,
rho,
fair_aggregation="ce",
ssp=["SSP3"],
model=["IIASA GDP"],
rcp=["ssp585", "ssp245", "ssp460", "ssp370", "Naive Ramsey"],
weitzman_parameter=["0.001", "0.1", "1.0"],
ssp=("SSP3",),
model=("IIASA GDP",),
rcp=("ssp585", "ssp245", "ssp460", "ssp370", "Naive Ramsey"),
weitzman_parameter=("0.001", "0.1", "1.0"),
pulse_year=2020,
recipes=["risk_aversion", "equity"],
discounting=["ramsey", "gwr"],
recipes=("risk_aversion", "equity"),
discounting=("ramsey", "gwr"),
aspect=0.4,
save_path=None,
csv=True,
Expand Down
27 changes: 16 additions & 11 deletions src/dscim/diagnostics/equity_risk_premiums.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,23 @@ def mumbai_plots(
eta,
title=True,
aspect=1,
selection=dict(year=2097),
region_dict={
"IND.21.317.1249": "Mumbai, IND",
"CAN.2.33.913": "Vancouver, CAN",
"USA.14.608": "Chicago, USA",
"EGY.11": "Cairo, EGY",
"SDN.4.11.50.164": "Khartoum, SDN",
"NGA.25.510": "Lagos, NGA",
"SAU.7": "Riyadh, SAU",
"RUS.16.430.430": "St Petersburg, RUS",
},
selection=None,
region_dict=None,
):
if selection is None:
selection = dict(year=2097)

if region_dict is None:
region_dict = {
"IND.21.317.1249": "Mumbai, IND",
"CAN.2.33.913": "Vancouver, CAN",
"USA.14.608": "Chicago, USA",
"EGY.11": "Cairo, EGY",
"SDN.4.11.50.164": "Khartoum, SDN",
"NGA.25.510": "Lagos, NGA",
"SAU.7": "Riyadh, SAU",
"RUS.16.430.430": "St Petersburg, RUS",
}

assert premium in [
"risk_aversion",
Expand Down
25 changes: 15 additions & 10 deletions src/dscim/diagnostics/fair_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def marginal_damages(
sector,
sector_path,
discounting,
recipes=["risk_aversion", "equity"],
recipes=("risk_aversion", "equity"),
save_path=None,
):

Expand Down Expand Up @@ -98,7 +98,7 @@ def global_consumption(
sector,
sector_path,
discounting,
recipes=["risk_aversion", "equity"],
recipes=("risk_aversion", "equity"),
save_path=None,
scale=10**12,
):
Expand Down Expand Up @@ -153,20 +153,20 @@ def output_scc(
sector_path,
eta,
rho,
recipes=["adding_up", "risk_aversion", "equity", "local"],
discounting=["constant_model_collapsed", "constant", "euler_ramsey", "euler_gwr"],
recipes=("adding_up", "risk_aversion", "equity", "local"),
discounting=("constant_model_collapsed", "constant", "euler_ramsey", "euler_gwr"),
save_path=None,
file=None,
subset_dict=None,
index=[
index=(
"discount_type",
"discrate",
"weitzman_parameter",
"model",
"ssp",
"rcp",
"gas",
],
),
):

final_dfs = []
Expand Down Expand Up @@ -230,14 +230,19 @@ def plot_implicit_rates(
sector,
path,
fair_aggregation="ce",
ssp=["SSP3"],
model=["IIASA GDP"],
ssp=None,
model=None,
pulse_year=2020,
recipes=["risk_aversion", "equity"],
discounting=["ramsey", "gwr"],
recipes=("risk_aversion", "equity"),
discounting=("ramsey", "gwr"),
save_path=None,
csv=True,
):
if ssp is None:
ssp = ["SSP3"]
Comment thread
brews marked this conversation as resolved.

if model is None:
model = ["IIASA GDP"]
Comment thread
brews marked this conversation as resolved.

for recipe in recipes:

Expand Down
12 changes: 7 additions & 5 deletions src/dscim/diagnostics/maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,24 +74,26 @@ def maps(
ECON_ZARR,
eta,
maxmin=True,
selection=dict(year=2097, ssp=["SSP2", "SSP3", "SSP4"]),
selection=None,
location=(0.35, -0.2),
gcm="mean",
prefix=None,
variables=[
variables=(
"rp_inc_share",
"rp_damage_share",
"rp_cons_share",
"rp",
"cons",
"cons_ce",
],
maxes=[None, None, None, None, None, None],
mins=[None, None, None, None, None, None],
),
maxes=(None, None, None, None, None, None),
mins=(None, None, None, None, None, None),
year=2097,
plot=True,
save_path=None,
):
if selection is None:
selection = dict(year=2097, ssp=["SSP2", "SSP3", "SSP4"])

assert len(maxes) == len(
variables
Expand Down
4 changes: 3 additions & 1 deletion src/dscim/diagnostics/stacked_damage_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ def plot_stacked(
eta=2.0,
rho=0.0,
xlim=(-1, 8),
years=[2020, 2050, 2090, 2100, 2200, 2300],
years=None,
sharey=False,
rff=True,
):
if years is None:
years = [2020, 2050, 2090, 2100, 2200, 2300]

root_rff = f"/shares/gcp/integration_replication/results/rff/{sector}/2020/"
root_ssp = f"/shares/gcp/integration_replication/results/AR6_ssp/{sector}/2020/"
Expand Down
Loading