Commit 25cebbca authored by Carl Schreck's avatar Carl Schreck

Introducing shaded relief, reduced number of panels for temp_steps.py

parent 8c0c4baf
......@@ -28,7 +28,7 @@ def draw_station_data(ax, path, lat_column=1, lon_column=2, data_column=5,
data = asc_data[data_column]
plot = ax.scatter(x=lon, y=lat, c=data, norm=cjs.norm_scatter(levels),
cmap=cmap, zorder=2, transform=ccrs.PlateCarree(),
cmap=cmap, zorder=3, transform=ccrs.PlateCarree(),
marker='.', edgecolors='black', linewidth=0.5)
return plot
......@@ -45,7 +45,7 @@ def draw_station_type(ax, path, lat_column=1, lon_column=2, time_column=6):
obs_time = asc_data[time_column]
network = asc_data[0].str[2]
labels = ['RAWS', 'SNOTEL', 'NWS Midnight', 'NWS Morning']
zorders = [4, 5, 3, 2]
zorders = [4, 5, 3, 2] + 5
colors = cjs.tab[[0, 3, 2, 1]]
station_type = np.full(lat.shape, fill_value=3)
station_type = np.where(network == 'R', 0, station_type)
......
......@@ -7,8 +7,6 @@ __license__ = "BSD-3.0"
import xarray as xr
import matplotlib.pyplot as plt
import matplotlib as mpl
import matplotlib.cm as cm
import os
import argparse
import numpy as np
......@@ -34,35 +32,11 @@ cmap = 'RdBu_r'
cjs.tstamp('Here we go!')
fig, axes = plt.subplots(nrows=2, ncols=2, figsize=(6.4, 6.4),
fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(6.4, 6.4),
subplot_kw={'projection': cjs.conus_projection, })
cjs.tstamp('Drawing station type')
ax = axes[0, 0]
helpers.draw_station_type(ax, station_path)
ax.set_title('a) Station type', loc='left')
ax.set_anchor('N')
cjs.tstamp('Drawing unscaled data')
ax = axes[0, 1]
helpers.draw_station_data(ax, station_path, levels=levels, cmap=cmap)
unscaled_data = helpers.read_unscaled(unscaled_path, var_name)
plot = unscaled_data.plot(ax=ax, transform=ccrs.PlateCarree(),
add_colorbar=True,
cmap=cmap, levels=levels, zorder=1,
vmin=-np.inf, vmax=np.inf, extend='both',
cbar_kwargs={'orientation': 'horizontal',
'label': '°C',
'pad': 0.05,
}
)
ax.set_title('b) Unscaled data', loc='left')
ax.set_extent([-115.0, -100.0, 35.0, 42.5])
ax.outline_patch.set_visible(True)
ax.set_anchor('N')
cjs.tstamp('Drawing scaled data')
ax = axes[1, 0]
ax = axes
helpers.draw_station_data(ax, station_path, levels=levels, cmap=cmap)
scaled_ds = xr.open_dataset(scaled_path)
scaled_data = scaled_ds[var_name].sel(time=time).drop('time')
......@@ -80,30 +54,7 @@ ax.set_extent([-115.0, -100.0, 35.0, 42.5])
ax.outline_patch.set_visible(True)
ax.set_anchor('N')
cjs.tstamp('Drawing difference data')
ax = axes[1, 1]
levels = np.arange(-6, 7, 1)
cjs.add_conus_map(ax=ax)
diff_data = scaled_data - unscaled_data
plot = diff_data.plot(ax=ax, transform=ccrs.PlateCarree(),
add_colorbar=True,
cmap=cmap, levels=levels, zorder=1,
vmin=-np.inf, vmax=np.inf, extend='both',
cbar_kwargs={'orientation': 'horizontal',
'label': '°C',
'pad': 0.05,
}
)
ax.set_title('d) Scaled minus unscaled', loc='left')
ax.set_anchor('N')
# cjs.tstamp('Add colorbar')
# fig.subplots_adjust(bottom=0.2)
# cbar_ax = fig.add_axes([0.15, 0.05, 0.80, 0.03])
# fig.colorbar(plot, extend='both',
# cax=cbar_ax,
# orientation='horizontal')
trans_gray = cjs.add_shaded_relief(ax)
cjs.tstamp('Drawing figure')
plt.tight_layout()
......
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