Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
ba4347e
add adjustText to environment.yml
clairehalloran Aug 5, 2026
bc2452b
Fix map-diff tech aggregation bug
clairehalloran Aug 6, 2026
1623eee
abs cmap rain->tempo in compare_cases.py
clairehalloran Aug 7, 2026
7f792a6
Add region labels in plot_seed_stressperiods
clairehalloran Aug 7, 2026
8a9957f
Add region labels in capacity maps
clairehalloran Aug 7, 2026
547fae3
Adjust labels in map_neue
clairehalloran Aug 20, 2026
a318242
Adjust labels in hourly_plots.py
clairehalloran Aug 20, 2026
4c7d0dd
Update hourly_plots abs cbar
clairehalloran Aug 20, 2026
8cf6a8c
Label capacity, net_imports, h2_capacity maps
clairehalloran Aug 20, 2026
b459be5
rain -> tempo in reedsplots
clairehalloran Aug 20, 2026
17549ab
Re-attach dropped CRS
clairehalloran Aug 20, 2026
a45d433
rain -> tempo in plots.py
clairehalloran Aug 20, 2026
c31370d
rain -> tempo in single_case_plots.py
clairehalloran Aug 20, 2026
47b0d26
Adjust labels in map_outage_days
clairehalloran Aug 21, 2026
2917dd9
rain -> tempo in map_output_byyear
clairehalloran Aug 21, 2026
b7618b4
Remove slashes from savenames
clairehalloran Aug 21, 2026
61d2c2a
rain -> tempo in diagnostic_plots.py
clairehalloran Aug 21, 2026
e62570e
Add opt_single_decimal to label_region_value
clairehalloran Aug 24, 2026
0cc02cf
Use opt_single_decimal in compare_cases.py capacity maps
clairehalloran Aug 24, 2026
170ee33
Add sub-state regional outlines to plot_diff_maps
clairehalloran Aug 24, 2026
31c1cf0
Decrease map_capacity_techs label fontsize
clairehalloran Aug 24, 2026
fde159b
Decrease multi-case map capacity tech label fontsize
clairehalloran Aug 24, 2026
22228af
Update reedsplot.py label format
clairehalloran Aug 24, 2026
0d3e1dd
Adjust labels in map_dropped_load
clairehalloran Aug 24, 2026
d43381f
Avoid label overlap in maps.py
clairehalloran Aug 25, 2026
4b8a74e
Make cf map NaNs gray and unlabeled
clairehalloran Aug 25, 2026
afcd4ae
Seperate region-colored and black labels for different levels in docs…
clairehalloran Aug 25, 2026
d568a0f
cmap added as global in outage_rates.py and diagnostic_plots.py
clairehalloran Sep 10, 2026
4448bf2
cmap updated with global in single_case_plots.py and diagnostic_plots.py
clairehalloran Sep 10, 2026
2ad183c
Use global cmap in compare_cases.py
clairehalloran Sep 10, 2026
9b23940
adjustText optional for core functionality
clairehalloran Sep 11, 2026
5c2b9db
Import cmocean in outage_rate.py
clairehalloran Sep 14, 2026
fd2cfa4
Correct adjustText version
clairehalloran Sep 14, 2026
0a0626a
Remove added lines in reedsplots.py
clairehalloran Sep 14, 2026
07dbb58
Fix load map annotation
clairehalloran Sep 14, 2026
23813ca
Reset diagnostic plots debug inputs
clairehalloran Sep 14, 2026
c9c1f3e
Update reeds/reedsplots.py
clairehalloran Oct 8, 2026
262d79f
Update reeds/reedsplots.py
clairehalloran Oct 8, 2026
7c9f9df
Update reeds/reedsplots.py
clairehalloran Oct 8, 2026
eb629be
Update reeds/reedsplots.py
clairehalloran Oct 8, 2026
f54ebde
Update docs/source/plotting_scripts/maps.py
clairehalloran Oct 8, 2026
02d01af
Update reeds/reedsplots.py
clairehalloran Oct 8, 2026
50e4b3f
Add `label_regions` kwarg for some maps
clairehalloran Oct 9, 2026
bbf18ba
Missing values white in hourly_plots.py
clairehalloran Oct 9, 2026
cda61aa
Remove `opt_single_decimal` arg
clairehalloran Oct 9, 2026
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
29 changes: 19 additions & 10 deletions docs/source/plotting_scripts/maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#%% Imports
import os
import sys
from adjustText import adjust_text
import shapely
import datetime
import numpy as np
Expand Down Expand Up @@ -230,39 +231,47 @@
dfcounty.plot(ax=ax, facecolor='none', edgecolor='C7', lw=0.02, zorder=1e6)
if draw_lakes:
greatlakes.plot(ax=ax, edgecolor='#2CA8E7', facecolor='#D3EFFA', lw=0.2, zorder=-1)
text_artists = []
for r, row in dfregion.iterrows():
dfregion.loc[[r]].plot(ax=ax, color=colors[r], alpha=alpha_region, lw=0, zorder=1)
if label_regions.get(level, True):
x, y = (
np.array([row.geometry.centroid.x, row.geometry.centroid.y])
+ np.array(offset.get(level, {}).get(r, (0,0)))
)
for i, (c, a) in enumerate([('k',1), (colors[r], 0.6)]):
## Shade the r labels with the zone color
for i, (_color, _alpha) in enumerate([('k', 1), (colors[r], 0.6)]):
if i == 1 and level != 'r':
continue
ax.annotate(
text_artists.append(ax.annotate(
(r if level == 'r' else r.replace('_','\n')),
(x, y),
ha='center', va='center', weight='bold',
size={'r':7, 'hurdlereg':7, 'st':10}.get(level,11),
color=c, zorder=1e11+i, alpha=a,
color=_color, zorder=1e11+i, alpha=_alpha,
path_effects=(
[pe.withStroke(linewidth=1.5, foreground='w', alpha=(1 if i == 0 else 0))]
),
)
))
adjust_text(text_artists, ax=ax, avoid_self=False, ensure_inside_axes=True)

text_artists = []
if label_zones.get(level, True):
for r, row in dfmap['r'].iterrows():
x, y = (
np.array([row.geometry.centroid.x, row.geometry.centroid.y])
+ np.array(offset.get('r', {}).get(r, (0,0)))
)
ax.annotate(
r,
(x, y),
ha='center', va='center', size=6, weight='normal',
color='C7', zorder=1e10,
path_effects=[pe.withStroke(linewidth=0.7, foreground='w', alpha=1)]
text_artists.append(
ax.annotate(
r,
(x, y),
ha='center', va='center', size=6, weight='normal',
color='C7', zorder=1e10,
path_effects=[pe.withStroke(linewidth=0.7, foreground='w', alpha=1)]
)
)
adjust_text(text_artists, ax=ax, avoid_self=False, ensure_inside_axes=True)

ax.axis('off')
savename = (
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ dependencies:
- tqdm=4.68
## vvv The next packages are optional for default settings and may
## vvv be excluded if you're having trouble building the environment.
- adjustText=1.4 # for avoiding map label overlaps
- fiona=1.10 # for interactive maps
- folium=0.20 # for interactive maps
- ipykernel=7.3 # for interactive python in VS Code
Expand Down
8 changes: 5 additions & 3 deletions postprocessing/compare_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@


#%%### Fixed inputs
cmap = cmocean.cm.rain
cmap = cmocean.cm.tempo
cmap_diff = plt.cm.RdBu_r
## https://www.whitehouse.gov/wp-content/uploads/2023/11/CircularA-4.pdf
discountrate_social = DEFAULT_DISCOUNT_RATE
Expand Down Expand Up @@ -2595,7 +2595,7 @@ def two_bars(dfplot, basecase, colors, ax, col=0, ypad=0.02):
year=lastyear, casebase=casebase, casecomp=casecomp,
level=level,
plot='base', f=f, ax=ax[0],
cmap=cmocean.cm.rain,
cmap=cmap,
)
ax[0].annotate(
casebase_name,
Expand All @@ -2606,7 +2606,7 @@ def two_bars(dfplot, basecase, colors, ax, col=0, ypad=0.02):
year=lastyear, casebase=casebase, casecomp=casecomp,
level=level,
plot='comp', f=f, ax=ax[1],
cmap=cmocean.cm.rain,
cmap=cmap,
)
ax[1].annotate(
casecomp_name,
Expand Down Expand Up @@ -2682,6 +2682,7 @@ def two_bars(dfplot, basecase, colors, ax, col=0, ypad=0.02):
ax=ax[coords[case]], column='GW', cmap=cmap, vmin=vmin, vmax=vmax,
legend=False,
)
reedsplots.label_region_value(dfplot, ax=ax[coords[case]], column="GW", fontsize=5)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Claire, thanks for this PR update - love the new colors!

Small correction - I believe the fontsize parameter was changed to a dictionary entry in the new text_kwargs parameter:

Suggested change
reedsplots.label_region_value(dfplot, ax=ax[coords[case]], column="GW", fontsize=5)
reedsplots.label_region_value(dfplot, ax=ax[coords[case]], column="GW", text_kwargs={'fontsize': 5})

This would also need to be fixed in the other call to reedsplots.label_region_value() below

## Legend
if coords[case] == legendcoords:
plots.addcolorbarhist(
Expand Down Expand Up @@ -2753,6 +2754,7 @@ def two_bars(dfplot, basecase, colors, ax, col=0, ypad=0.02):
vmax=(absmax if case == basecase else diffmax),
legend=False,
)
reedsplots.label_region_value(dfplot, ax=ax[coords[case]], column="GW", fontsize=5)
## Difference legend
if coords[case] == legendcoords:
plots.addcolorbarhist(
Expand Down
20 changes: 14 additions & 6 deletions postprocessing/single_case_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
## the position of the annotations
crs = 'ESRI:102008'
### General purpose
cmap = cmocean.cm.rain
cmap = cmocean.cm.tempo
### For VRE siting & transmission maps
transalpha = 0.25
transcolor = 'k'
Expand Down Expand Up @@ -267,7 +267,7 @@
plt.close()
f,ax = reedsplots.plot_trans_vsc(
case=case, year=year, wscale=wscale_straight*1e3,
alpha=1.0, miles=300,
alpha=1.0, miles=300, cmap=cmap,
)
savename = f'map_translines_vsc-{year}.png'
if write and (f is not None):
Expand All @@ -288,7 +288,10 @@
for vmax in ['each', 'shared']:
try:
f,ax = reedsplots.map_capacity_techs(
case, year=year, ncols=ncols, vmax=vmax,
case, year=year, ncols=ncols, vmax=vmax, cmap=cmap,
label_regions = (
True if len(reeds.inputs.parse_regions(case))<=100 else False
),
)
savename = f'map_capacity-{year}-{vmax}.png'
if write:
Expand Down Expand Up @@ -517,7 +520,11 @@
if int(sw.GSw_H2):
plt.close()
f,ax = reedsplots.map_h2_capacity(
case=case, year=year, cmap=cmap, wscale_h2=wscale_h2)
case=case, year=year, cmap=cmap, wscale_h2=wscale_h2,
label_regions = (
True if len(reeds.inputs.parse_regions(case))<=100 else False
),
)
savename = f'map_h2_capacity-{sw.endyear}.png'
if write:
plt.savefig(os.path.join(savepath, savename))
Expand Down Expand Up @@ -646,7 +653,7 @@
try:
for y in [y for y in years if y >= 2025]:
plt.close()
f, ax, neue, _iteration = reedsplots.map_neue(case=case, year=y)
f, ax, neue, _iteration = reedsplots.map_neue(case=case, year=y, cmap=cmap)
savename = f"map_PRAS_neue-{y}i{_iteration}.png"
if write:
plt.savefig(os.path.join(savepath, savename))
Expand Down Expand Up @@ -860,7 +867,7 @@
#%% PRM if iterating
if int(sw.GSw_PRM_StressIterateMax) and int(sw.GSw_PRM_UpdateMethod):
try:
f, ax, prm_final = reedsplots.map_prm(case)
f, ax, prm_final = reedsplots.map_prm(case, cmap=cmap)
savename = 'map_prm.png'
if write:
plt.savefig(os.path.join(savepath, savename))
Expand Down Expand Up @@ -928,6 +935,7 @@
years=[year],
vscale=1e-3,
vmin=0,
cmap=cmap,
title='Sited demand [GW]',
)
savename = f'map_loadsite-{year}.png'
Expand Down
34 changes: 16 additions & 18 deletions reeds/input_processing/hourly_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from pathlib import Path
sys.path.append(str(Path(__file__).parent.parent.parent))
import reeds
from reeds import reedsplots
from reeds import plots
plots.plotparams()

Expand Down Expand Up @@ -230,7 +231,7 @@ def plot_maps(sw, inputs_case, reeds_path, figpath, periodtype='rep', crs='EPSG:
### Settings
cmaps = {
'cf_actual':plt.cm.turbo, 'cf_rep':plt.cm.turbo, 'cf_diff':plt.cm.RdBu_r,
'GW_actual':cmocean.cm.rain, 'GW_rep':cmocean.cm.rain,
'GW_actual':cmocean.cm.tempo, 'GW_rep':cmocean.cm.tempo,
'GW_diff':plt.cm.RdBu_r, 'GW_frac':plt.cm.RdBu_r, 'pct_diff':plt.cm.RdBu_r,
}
vm = {
Expand Down Expand Up @@ -351,17 +352,16 @@ def plot_maps(sw, inputs_case, reeds_path, figpath, periodtype='rep', crs='EPSG:
dfdiffs[level].plot(
ax=ax[coords[level]], column='cf_diff', cmap=cmaps['cf_diff'],
vmin=vm[tech]['cf_diff'][0], vmax=vm[tech]['cf_diff'][1],
lw=0, legend=False,
lw=0, legend=False, missing_kwds={"color": "white"},
)
dfmap[level].plot(ax=ax[coords[level]], facecolor='none', edgecolor='k', lw=0.2)
## Text differences
for r, row in (dfdiffs[level].assign(val=dfdiffs[level].cf_diff.abs()).sort_values('val')).iterrows():
decimals = 0 if abs(row.cf_diff) >= 1 else 1
ax[coords[level]].annotate(
f"{row.cf_diff*100:+.{decimals}f}",
[row.centroid_x, row.centroid_y],
ha='center', va='center', c='k', fontsize={'r':5}.get(level,7),
path_effects=[pe.withStroke(linewidth=1.5, foreground='w', alpha=0.5)],
dfmap[level]['cf_diff_pct'] = (dfdiffs[level].cf_diff * 100).values
reedsplots.label_region_value(
dfmap[level],
ax[coords[level]],
column='cf_diff_pct',
text_kwargs={'fontsize': {'r':5}.get(level,7)},
pe_kwargs={'linewidth': 1.5, 'foreground': 'w', 'alpha': 0.5},
)
## Colorbar
plots.addcolorbarhist(
Expand Down Expand Up @@ -485,14 +485,12 @@ def plot_maps(sw, inputs_case, reeds_path, figpath, periodtype='rep', crs='EPSG:
lw=0, legend=False,
)
dfmap[level].plot(ax=ax[coords[level]], facecolor='none', edgecolor='k', lw=0.2)
## Text differences
for r, row in (dfdiffs[level].assign(val=dfdiffs[level][val].abs()).sort_values('val')).iterrows():
decimals = 0 if abs(row[val]) >= 1 else 1
ax[coords[level]].annotate(
f"{row[val]:+.{decimals}f}",
[row.centroid_x, row.centroid_y],
ha='center', va='center', c='k', fontsize={'r':5}.get(level,7),
path_effects=[pe.withStroke(linewidth=1.5, foreground='w', alpha=0.5)],
reedsplots.label_region_value(
dfdiffs[level],
ax[coords[level]],
column=val,
text_kwargs={'fontsize': {'r':5}.get(level,7)},
pe_kwargs={'linewidth': 1.5, 'foreground': 'w', 'alpha': 0.5},
)
## Colorbar
plots.addcolorbarhist(
Expand Down
4 changes: 3 additions & 1 deletion reeds/input_processing/outage_rates.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import argparse
import h5py
from pathlib import Path
import cmocean
sys.path.append(str(Path(__file__).parent.parent.parent))
import reeds
reeds_path = reeds.io.reeds_path
Expand All @@ -19,6 +20,7 @@
tz_out = 'Etc/GMT+6'
temp_min = -50
temp_max = 60
cmap = cmocean.cm.tempo
## Only use during_quarters for techs without a monthly scheduled outage rate
during_quarters = ['spring', 'fall']
## Cap the extrapolation of forced outage rates at high/low temperatures to 0.4 because
Expand Down Expand Up @@ -383,7 +385,7 @@ def plot_outage_forced(

plt.close()
f, ax = reeds.plots.map_years_months(
dfzones=dfzones, dfdata=dfdata, aggfunc=aggfunc,
dfzones=dfzones, dfdata=dfdata, cmap=cmap, aggfunc=aggfunc,
title=f"Monthly {aggfunc}\nforced outage rate,\n{nicelabels.get(pm,pm)} [%]",
)
plt.savefig(os.path.join(figpath, f'FOR_monthly-{aggfunc}-{pm}.png'))
Expand Down
Loading
Loading