Commit 2c507bde authored by Carl Schreck's avatar Carl Schreck

Added some categorical colors to cjs and successful station type plot

parent e8a89aa1
......@@ -9,6 +9,7 @@ import xarray as xr
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import matplotlib.cm as cm
import matplotlib.style
import matplotlib as mpl
import os
import pandas as pd
......@@ -61,6 +62,7 @@ def draw_station_type(path, lat_column=1, lon_column=2, time_column=6,
network = asc_data[0].str[2]
labels = ['RAWS', 'SNOTEL', 'NWS Midnight', 'NWS Morning']
zorders = [4, 5, 3, 2]
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)
station_type = np.where(network == 'W', 1, station_type)
......@@ -72,10 +74,7 @@ def draw_station_type(path, lat_column=1, lon_column=2, time_column=6,
for type_ind, group in groups:
ax.plot(group.lon, group.lat, transform=ccrs.PlateCarree(),
marker='.', linestyle='', label=labels[type_ind],
zorder=zorders[type_ind])
# plot = ax.scatter(x=lon, y=lat, transform=ccrs.PlateCarree(),
# c=cmap[station_type], zorder=2,
# marker='.')
zorder=zorders[type_ind], c=colors[type_ind])
ax.legend(labels=labels)
return asc_data
......@@ -88,5 +87,6 @@ bounds=np.arange(-30, 35, 5)
cmap = cm.get_cmap('bwr', lut=(len(bounds) + 1))
norm = mpl.colors.BoundaryNorm(bounds, cmap.N, clip=False)
station_plot = draw_station_type(path, cmap=cmap, norm=norm)
# station_plot = draw_station_type(path)
# plt.colorbar(station_plot)
plt.show()
\ No newline at end of file
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