Skip to content

Commit

Permalink
all updates pushed
Browse files Browse the repository at this point in the history
  • Loading branch information
ajleeson committed Dec 24, 2024
1 parent 8358fe9 commit 319e099
Show file tree
Hide file tree
Showing 7 changed files with 227 additions and 134 deletions.
2 changes: 1 addition & 1 deletion plotting/2014_2019_DO/budget_DO/make_terminalinlet_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@
# ax.text(-123.37,48.37,'Ecology monitoring\nstation (ID)',va='center',ha='left',fontweight='bold',color='mediumorchid',fontsize = 12)
# ax.text(-123.37,48.3,'No observations',va='center',ha='left',fontweight='bold',color='k',fontsize = 12)

plt.title('Terminal Inlet Locations',fontsize = 14)
# plt.title('Terminal Inlet Locations',fontsize = 14)
plt.tight_layout()


Expand Down
263 changes: 173 additions & 90 deletions plotting/2014_2019_DO/budget_DO/plot_budget_MANUSCRIPT.py

Large diffs are not rendered by default.

Binary file modified plotting/2014_2019_DO/budget_DO/terminal_inlet_map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 8 additions & 4 deletions plotting/2014_2019_DO/hypoxia_summary_map_6years.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def LO2SSM_name(rname):
# make a version of z with nans where masked
zm = z.copy()
zm[np.transpose(mask_rho) == 0] = np.nan
zm[np.transpose(mask_rho) != 0] = -1
zm[np.transpose(mask_rho) != 0] = -1.1

# Create map
plt.close('all')
Expand Down Expand Up @@ -316,8 +316,10 @@ def LO2SSM_name(rname):
plt.yticks(rotation=30)

# Add colormap title
# ax.set_title('(a) Days per year with\nbottom DO < {} '.format(str(DO_thresh) + r' mg L$^{-1}$'),
# fontsize=12, loc='left')
ax.set_title('(a) Days per year with\nbottom DO < {} '.format(str(DO_thresh) + r' mg L$^{-1}$'),
fontsize=12, loc='left')
fontsize=12, loc='left', fontweight='bold')

##############################################################
## PLOT MEAN BOTTOM DO CONCENTRATION ##
Expand Down Expand Up @@ -409,10 +411,12 @@ def LO2SSM_name(rname):
# ax.set_title('(b)' + start+' to '+end+' mean bottom DO [mg/L]',
# fontsize=14, y=0.95)

# ax.set_title('(b) Aug 1 to Sep 30 \n' + r'mean bottom DO [mg L$^{-1}$]',
# fontsize=12, loc='left')
ax.set_title('(b) Aug 1 to Sep 30 \n' + r'mean bottom DO [mg L$^{-1}$]',
fontsize=12, loc='left')
fontsize=12, loc='left', fontweight='bold')

plt.suptitle('2014 through 2019 averages', fontsize=14)
# plt.suptitle('2014 through 2019 averages', fontsize=14)

# Generate plot
plt.tight_layout
Expand Down
8 changes: 5 additions & 3 deletions plotting/2014_2019_DO/hypoxic_days_and_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def LO2SSM_name(rname):
dates_local = [pfun.get_dt_local(x) for x in dates]

# colors = ['red','darkorange','gold','green','blue','purple','deeppink']
colors = ['#F9627D','#62B6CB','#A8C256','#96031A','#957FEF','#476ad1','darkorange']
colors = ['#62B6CB','#A8C256','#96031A','#957FEF','#F9627D','#476ad1','darkorange']

# # plot timeseries
# for i,year in enumerate(years):
Expand Down Expand Up @@ -430,7 +430,8 @@ def LO2SSM_name(rname):
# Add the patch to the Axes
ax0.add_patch(rect)
ax0.text(-123.2,48.25,'Straits\nomitted', rotation=90, fontsize=12)
ax0.set_title('(a) Region', fontsize = 14, loc='left')
# ax0.set_title('(a) Region', fontsize = 14, loc='left')
ax0.set_title('(a)', fontsize = 14, loc='left', fontweight='bold')

# Puget Sound volume
if remove_straits:
Expand Down Expand Up @@ -474,7 +475,8 @@ def LO2SSM_name(rname):
ax1.tick_params(axis='both', labelsize=12)
ax1.set_ylabel(r'Hypoxic volume [km$^3$]', fontsize=12)
plt.legend(loc='upper left', fontsize=12)
plt.title('(b) Puget Sound hypoxic volume (DO < 2 mg/L)', fontsize = 14, loc='left')
# plt.title('(b) Puget Sound hypoxic volume (DO < 2 mg/L)', fontsize = 14, loc='left')
plt.title('(b)', fontsize = 14, loc='left', fontweight='bold')
ax1.set_xlim([dates_local[0],dates_local[-1]])
ax1.set_ylim([0,13])

Expand Down
35 changes: 18 additions & 17 deletions plotting/2014_2019_DO/model_eval_2017_prprtyprprty.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,8 @@
t1.set_bbox(dict(facecolor='white', alpha=0.7, edgecolor='none'))
t2.set_bbox(dict(facecolor='white', alpha=0.7, edgecolor='none'))

ax_map.set_title('(a) Inlet obs comparison locations',fontsize=12,loc='left')
# ax_map.set_title('(a) Inlet obs comparison locations',fontsize=12,loc='left')
ax_map.set_title('(a) Locations',fontsize=12,loc='left', fontweight='bold')

##########################################################
## Puget Sound Property-property plots ##
Expand All @@ -603,7 +604,7 @@
# for border in ['top','right','bottom','left']:
# ax.spines[border].set_visible(False)
ax.tick_params(axis='both', labelsize=10)
ax.set_title(letter[i+1] + ' ' + vars[i],loc='left',fontsize=12)
ax.set_title(letter[i+1] + ' ' + vars[i],loc='left',fontsize=12, fontweight='bold')

# plot property-property plots for terminal inlets
for i,vn in enumerate(vns):
Expand Down Expand Up @@ -658,21 +659,21 @@
t02 = axes[i].text(0.37, 0.95, 'RMSE', fontweight='bold',
verticalalignment='top', horizontalalignment='right',
transform=axes[i].transAxes, fontsize=10, color = 'black')
t03 = axes[i].text(0.57, 0.95, 'NSE', fontweight='bold',
verticalalignment='top', horizontalalignment='right',
transform=axes[i].transAxes, fontsize=10, color = 'black')
# t03 = axes[i].text(0.57, 0.95, 'NSE', fontweight='bold',
# verticalalignment='top', horizontalalignment='right',
# transform=axes[i].transAxes, fontsize=10, color = 'black')
t1 = axes[i].text(0.17, 0.89, '{:.2f}'.format(round(bias,2)),
verticalalignment='top', horizontalalignment='right',fontweight='bold',
transform=axes[i].transAxes, fontsize=10, color = 'deeppink')
t2 = axes[i].text(0.37, 0.89, '{:.2f}'.format(round(rmse,2)),
verticalalignment='top', horizontalalignment='right',fontweight='bold',
transform=axes[i].transAxes, fontsize=10, color = 'deeppink')
t3 = axes[i].text(0.57, 0.89, '{:.2f}'.format(round(nse,2)),
verticalalignment='top', horizontalalignment='right',fontweight='bold',
transform=axes[i].transAxes, fontsize=10, color = 'deeppink')
# t3 = axes[i].text(0.57, 0.89, '{:.2f}'.format(round(nse,2)),
# verticalalignment='top', horizontalalignment='right',fontweight='bold',
# transform=axes[i].transAxes, fontsize=10, color = 'deeppink')
t1.set_bbox(dict(facecolor='white', alpha=0.7, edgecolor='none'))
t2.set_bbox(dict(facecolor='white', alpha=0.7, edgecolor='none'))
t3.set_bbox(dict(facecolor='white', alpha=0.7, edgecolor='none'))
# t3.set_bbox(dict(facecolor='white', alpha=0.7, edgecolor='none'))

axes[i].set_ylabel('Modeled',fontsize=12)
axes[i].set_xlabel('Observed',fontsize=12)
Expand Down Expand Up @@ -741,15 +742,15 @@
t2 = axes[i].text(0.37, 0.83, '{:.2f}'.format(round(rmse,2)),
verticalalignment='top', horizontalalignment='right',fontweight='bold',
transform=axes[i].transAxes, fontsize=10, color = 'navy')
t3 = axes[i].text(0.57, 0.83, '{:.2f}'.format(round(nse,2)),
verticalalignment='top', horizontalalignment='right',fontweight='bold',
transform=axes[i].transAxes, fontsize=10, color = 'navy')
# t3 = axes[i].text(0.57, 0.83, '{:.2f}'.format(round(nse,2)),
# verticalalignment='top', horizontalalignment='right',fontweight='bold',
# transform=axes[i].transAxes, fontsize=10, color = 'navy')
t1.set_bbox(dict(facecolor='white', alpha=0.7, edgecolor='none'))
t2.set_bbox(dict(facecolor='white', alpha=0.7, edgecolor='none'))
t3.set_bbox(dict(facecolor='white', alpha=0.7, edgecolor='none'))
# t3.set_bbox(dict(facecolor='white', alpha=0.7, edgecolor='none'))


plt.suptitle('Model vs. Observations property-property plots (Puget Sound 2017)', fontsize=15, x=0.65)
# plt.suptitle('Model vs. Observations property-property plots (Puget Sound 2017)', fontsize=15, x=0.65)
plt.subplots_adjust(wspace=-0.2)
plt.tight_layout()

Expand Down Expand Up @@ -785,7 +786,7 @@
for stn, station in enumerate(selected_stns):
# add a title
if i == 0:
ax[i,stn].set_title(station + ' ('+selected_stns[station]+')',fontsize=12,fontweight='bold')
ax[i,stn].set_title(station + ' ('+selected_stns[station]+')',fontsize=12)
# get axis
axis = ax[i,stn]

Expand Down Expand Up @@ -946,8 +947,8 @@
# axis.spines[border].set_visible(False)
axis.text(0.03, 0.95, letter[i],
verticalalignment='top', horizontalalignment='left',
transform=axis.transAxes, fontsize=12, color = 'k')
transform=axis.transAxes, fontsize=12, color = 'k',fontweight='bold')

plt.suptitle('Model vs. Observations time series (2017)', fontsize=15)
# plt.suptitle('Model vs. Observations time series (2017)', fontsize=15)
plt.subplots_adjust(wspace=-0.2)
plt.tight_layout()
41 changes: 22 additions & 19 deletions plotting/model_bathymetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
out_dir = Ldir['LOo'] / 'AL_custom_plots'
Lfun.make_dir(out_dir)

background = 'dimgray'
background = 'white'#'whitesmoke' #'dimgray'

# Get LiveOcean grid info --------------------------------------------------

Expand Down Expand Up @@ -50,7 +50,8 @@
# create colormap
# newcmap = cmocean.tools.crop_by_percent(cmocean.cm.deep_r, 20, which='max', N=None)
# newcmap = cmocean.cm.deep_r
newcmap = cmocean.tools.crop_by_percent(cmocean.cm.deep_r, 10, which='max')
# newcmap = cmocean.tools.crop_by_percent(cmocean.cm.deep_r, 15, which='max')
newcmap = cmocean.tools.crop_by_percent(cmocean.cm.thermal, 20, which='max')
newcmap.set_bad(background,1.) # background color

# zm[np.transpose(mask_rho) != 0] = -1
Expand All @@ -70,8 +71,8 @@
# format figure
pfun.dar(ax0)
# pfun.add_coast(ax0, color='gray')
for border in ['top','right','bottom','left']:
ax0.spines[border].set_visible(False)
# for border in ['top','right','bottom','left']:
# ax0.spines[border].set_visible(False)
# Set axis limits
ax0.set_xlim(X[i1],-122)#X[i2]) # Salish Sea
ax0.set_ylim(Y[j1],Y[j2]) # Salish Sea
Expand All @@ -80,15 +81,17 @@
print('Lat={},{}'.format(Y[j1],Y[j2]))

# plt.xticks(rotation=30, color='gray')
plt.xticks(rotation=30,horizontalalignment='right',color='gray',fontsize=12)
plt.yticks(color='gray',fontsize=12)
plt.xticks(rotation=30,horizontalalignment='right',fontsize=12)
plt.yticks(fontsize=12)
ax0.set_ylabel('Latitude', fontsize=12)
ax0.set_xlabel('Longitude', fontsize=12)
ax0.xaxis.set_major_locator(MaxNLocator(integer=True))
ax0.yaxis.set_major_locator(MaxNLocator(integer=True))
# plt.yticks(color='gray')
# ax0.set_yticklabels([])
# ax0.set_xticklabels([])
# add title
ax0.set_title('(a) Salish Sea',fontsize=14, loc='left')#,color='#EEEEEE')
ax0.set_title('(a) Salish Sea',fontsize=14, loc='left', fontweight='bold')#,color='#EEEEEE')
# add 10 km bar
lat0 = 47
lon0 = -124.63175
Expand All @@ -97,23 +100,23 @@
distances_m = zfun.ll2xy(lon1,lat1,lon0,lat0)
x_dist_km = round(distances_m[0]/1000)
ax0.plot([lon0,lon1],[lat0,lat1],color='white',linewidth=5)
ax0.text((lon0+lon1)/2,lat0+0.05,'{} km'.format(x_dist_km),color='white',fontsize=12,
ax0.text((lon0+lon1)/2,lat0+0.05,'{} km'.format(x_dist_km),color='w',fontsize=12,
horizontalalignment='center')
# draw box around Puget Sound
bordercolor = '#EEEEEE'
bordercolor = 'k'#'#EEEEEE'
ax0.add_patch(Rectangle((-123.3, 46.93), 1.2, 1.52,
edgecolor = bordercolor, facecolor='none', lw=2))
edgecolor = bordercolor, facecolor='none', lw=1))

# add major cities
# Seattle
ax0.scatter([-122.3328],[47.6061],s=[250],color='pink',
marker='*',edgecolors='darkred')
ax0.text(-122.3328 + 0.1,47.6061,'Seattle',color='pink', rotation=90,
ax0.text(-122.3328 + 0.1,47.6061,'Seattle',color='darkred', rotation=90,
horizontalalignment='left',verticalalignment='center', size=12)
# Vancouver
ax0.scatter([-123.1207],[49.2827],s=[250],color='pink',
marker='*',edgecolors='darkred')
ax0.text(-123.1207 + 0.1,49.2827,'Vancouver',color='pink', rotation=0,
ax0.text(-123.1207 + 0.1,49.2827,'Vancouver',color='darkred', rotation=0,
horizontalalignment='left',verticalalignment='center', size=12)

# add major water bodies
Expand All @@ -138,10 +141,10 @@
# format figure
pfun.dar(ax1)
# pfun.add_coast(ax1, color='gray')
for border in ['top','right','bottom','left']:
ax1.spines[border].set_visible(False)
# ax1.spines[border].set_color(bordercolor)
# ax1.spines[border].set_linewidth(2)
# for border in ['top','right','bottom','left']:
# ax1.spines[border].set_visible(False)
# # ax1.spines[border].set_color(bordercolor)
# # ax1.spines[border].set_linewidth(2)
# Set axis limits
ax1.set_xlim([-123.3,-122.1])
ax1.set_ylim([46.93,48.45])
Expand All @@ -153,16 +156,16 @@
# plt.xticks(rotation=30, color='gray')
# plt.yticks(color='gray')
# add title
ax1.set_title('(b) Puget Sound',fontsize=14,loc='left')# color='#EEEEEE')
ax1.set_title('(b) Puget Sound',fontsize=14,loc='left', fontweight='bold')# color='#EEEEEE')
# add 10 km bar
lat0 = 47
lon0 = -123.2
lat1 = lat0
lon1 = -123.06825
distances_m = zfun.ll2xy(lon1,lat1,lon0,lat0)
x_dist_km = round(distances_m[0]/1000)
ax1.plot([lon0,lon1],[lat0,lat1],color='w',linewidth=5)
ax1.text((lon0+lon1)/2,lat0+0.015,'{} km'.format(x_dist_km),color='w',fontsize=12,
ax1.plot([lon0,lon1],[lat0,lat1],color='k',linewidth=5)
ax1.text((lon0+lon1)/2,lat0+0.015,'{} km'.format(x_dist_km),color='k',fontsize=12,
horizontalalignment='center')

plt.subplots_adjust(wspace = -0.3)
Expand Down

0 comments on commit 319e099

Please sign in to comment.