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

Automated Daily Commit - Tue Apr 14 12:00:15 EDT 2020

parent edb456bc
...@@ -38,6 +38,36 @@ def draw_station_data(path, lat_column=1, lon_column=2, data_column=5, ...@@ -38,6 +38,36 @@ def draw_station_data(path, lat_column=1, lon_column=2, data_column=5,
transform=ccrs.PlateCarree(), marker='.') transform=ccrs.PlateCarree(), marker='.')
return plot return plot
def draw_station_type(path, lat_column=1, lon_column=2, time_column=6,
norm=None, cmap=None):
cjs.tstamp('Reading')
print(path)
asc_data = pd.read_csv(path, sep=' ', header=None, skipinitialspace=True)
ax = plt.axes(projection=ccrs.AlbersEqualArea(central_longitude=360 - 95,
standard_parallels=(40, 60)))
plt.gca().outline_patch.set_visible(False)
# ax.set_extent([-118, -75, 23.5, 50.5])
shp_name = 'ne_10m_admin_1_states_provinces_lakes'
cjs.add_map(ax, shp_name, edgecolor='none', facecolor='silver', zorder=1,
usa_only=True)
cjs.add_map(ax, shp_name, edgecolor=(0.2, 0.2, 0.2), facecolor='none',
zorder=3, usa_only=True)
lat = asc_data[lat_column]
lon = asc_data[lon_column]
obs_time = asc_data[time_column]
network = asc_data[0].str[2]
labels = ['RAWS', 'SNOTEL', 'NWS Midnight', 'NWS Morning']
# R/S is 0000
# C/W is NWS and can be anything... 2400 not 0000
# plot = ax.scatter(x=lon, y=lat, c=data, norm=norm, cmap=cmap, zorder=2,
# transform=ccrs.PlateCarree(), marker='.')
return asc_data
path = f'{os.environ["DATA_DIR"]}/nclimgrid/imke_figures/02temp-steps/' \ path = f'{os.environ["DATA_DIR"]}/nclimgrid/imke_figures/02temp-steps/' \
...@@ -46,6 +76,6 @@ path = f'{os.environ["DATA_DIR"]}/nclimgrid/imke_figures/02temp-steps/' \ ...@@ -46,6 +76,6 @@ path = f'{os.environ["DATA_DIR"]}/nclimgrid/imke_figures/02temp-steps/' \
bounds=np.arange(-30, 35, 5) bounds=np.arange(-30, 35, 5)
cmap = cm.get_cmap('bwr', lut=(len(bounds) + 1)) cmap = cm.get_cmap('bwr', lut=(len(bounds) + 1))
norm = mpl.colors.BoundaryNorm(bounds, cmap.N, clip=False) norm = mpl.colors.BoundaryNorm(bounds, cmap.N, clip=False)
station_plot = draw_station_data(path, cmap=cmap, norm=norm) station_plot = draw_station_type(path, cmap=cmap, norm=norm)
plt.colorbar(station_plot) # plt.colorbar(station_plot)
plt.show() # plt.show()
\ No newline at end of file \ 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