Commit 3b59a348 authored by Carl Schreck's avatar Carl Schreck

Final version of precip steps?

parent 8c5e1ada
......@@ -34,7 +34,8 @@ def draw_station_data(ax, path, lat_column=1, lon_column=2, data_column=5,
return plot
def draw_station_type(ax, path, sep=',', lat_column=2, lon_column=3,
time_column=7, markersize=[16, 4, 16, 4], edgecolor=None):
time_column=7, markersize=[16, 4, 16, 4],
zorder=5, edgecolor=None):
if np.isscalar(markersize):
markersize = np.full(4, markersize)
cjs.tstamp('Reading')
......@@ -49,7 +50,7 @@ def draw_station_type(ax, path, sep=',', lat_column=2, lon_column=3,
obs_time = asc_data[time_column]
network = asc_data[0].str[2]
labels = ['RAWS', 'SNOTEL', 'NWS Midnight', 'NWS Morning']
zorders = np.array([4, 5, 6, 2]) + 5
zorders = np.array([4, 5, 6, 2]) + zorder
colors = cjs.tab[[3, 2, 0, 1]]
station_type = np.full(lat.shape, fill_value=3)
......
......@@ -10,6 +10,7 @@ import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
from matplotlib import cm
import matplotlib.patches as mpatches
import matplotlib.lines as mlines
import os
import numpy as np
import cartopy.crs as ccrs
......@@ -41,7 +42,7 @@ cat_cmap = mcolors.ListedColormap(cjs.tab_2016[:4])
cjs.tstamp('Here we go!')
fig, axs = plt.subplots(nrows=3, ncols=1, figsize=(6.4, 8.0),
fig, axs = plt.subplots(nrows=3, ncols=1, figsize=(5.0, 8.0),
subplot_kw={
'projection': ccrs.AlbersEqualArea(
central_longitude=central_longitude),
......@@ -50,8 +51,8 @@ fig, axs = plt.subplots(nrows=3, ncols=1, figsize=(6.4, 8.0),
cjs.tstamp('Drawing anusplin categories')
ax = axs[0]
helpers.draw_station_data(ax, station_path, levels=0.1, cmap=precip_cmap,
data_column=6)
station_plot = helpers.draw_station_data(ax, station_path, levels=0.01,
cmap=precip_cmap, data_column=6)
anu_occur_path = f'{base_path}BPRC_20180914_D6_A2.pnt.gz'
anu_occur_data = helpers.read_unscaled(anu_occur_path, var_name, data_column=5)
sph_occur_path = f'{base_path}BPRC_20180914_D6_S1.pnt.gz'
......@@ -68,16 +69,25 @@ ax.set_title(f'(a) Occurrence', loc='left')
ax.set_extent(extent)
ax.outline_patch.set_visible(True)
labels = ['ANUSPLIN < 0.4, Spheremap < 0.9',
'ANUSPLIN < 0.4, Spheremap > 0.9',
'ANUSPLIN > 0.4, Spheremap < 0.9',
'ANUSPLIN > 0.4, Spheremap > 0.9',
labels = ['Both wet',
'ANUSPLIN dry\nSpheremap wet',
'ANUSPLIN wet\nSpheremap dry',
'Both dry',
'Dry station',
'Wet station'
]
# proxy = [plt.Rectangle((0,0), 1, 1, fc=cat_color)
# for cat_color in cat_cmap.colors]
patches = [mpatches.Patch(color=color) for color in cat_cmap.colors]
patches.append(mlines.Line2D([],[], color=precip_cmap(0.),
marker='o', mec='black', mew=0.5,
linestyle='None'))
patches.append(mlines.Line2D([],[], color=precip_cmap(1.),
marker='o', mec='black', mew=0.5,
linestyle = 'None'))
ax.legend(patches, labels,
bbox_to_anchor=(1.05, 1), loc='upper left', borderaxespad=0.)
bbox_to_anchor=(1.05, 1), labelspacing=1.1, loc='upper left',
borderaxespad=0.)
cjs.tstamp('Drawing anusplin precip')
ax = axs[1]
......@@ -123,14 +133,12 @@ ax.set_extent(extent)
ax.outline_patch.set_visible(True)
str_levels = [str(lev) for lev in precip_levels]
cb = fig.colorbar(plot, ax=axs[1:], shrink=0.6, orientation='vertical',
anchor=(0.5, 1.0),
label='Precipitation (mm)')
cb = fig.colorbar(plot, ax=axs[1:], orientation='vertical',
panchor=False, label='Precipitation (mm)')
cb.set_ticks(precip_levels)
cb.set_ticklabels(str_levels)
cjs.tstamp('Drawing figure')
plt.tight_layout()
plt.savefig(f'figures/prcp_steps.png', dpi=200)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment