Commit ea900582 authored by Carl Schreck's avatar Carl Schreck

Automated Nightly Commit - Wed Feb 12 09:12:31 EST 2020

parent 27a747de
......@@ -18,7 +18,7 @@ cjs.tstamp('Here we go!')
# These are some parameters that could be useful to have up top
basins = ['NA', 'EP']
parser = argparse.ArgumentParser()
parser.add_argument('--year', default=datetime.today().year)
parser.add_argument('--year', default=2019)
parser.add_argument('--month', default=(datetime.today().month - 1))
args = parser.parse_args()
end_year = int(args.year)
......@@ -98,10 +98,13 @@ for basin in basins:
& ibt.check_basin(basin))
any_eligible = np.any(is_eligible, axis=1)
for storm in ibt.ds.storm[any_eligible]:
print(f'name: {ibt.ds.name[storm].item().decode().title()}')
print(f'id: {ibt.ds.sid[storm].item().decode().title()}')
max_wind = ibt.ds.usa_wind[storm,is_eligible[storm,:]].max().values
min_pres = ibt.ds.usa_pres[storm,is_eligible[storm,:]].min().values
nature = ibt.ds.nature[
storm,max_wind==ibt.ds.usa_wind[storm,:]][0].values
print(f'id: {ibt.ds.sid[storm].item().decode().title()}')
print(f'name: {ibt.ds.name[storm].item().decode().title()}')
print(f'category: {ibt.ss_cat(max_wind,nature)}')
print(f'max wind: {max_wind} kt / {max_wind * 1.15} mph')
print(f'min pressure: {min_pres}')
min_time_ind = np.where(is_eligible[storm,:])[0].min()
......
......@@ -10,17 +10,15 @@ import os
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import calendar
import cartopy.io.shapereader as shapereader
import matplotlib as mpl
import cjs # '~carl/lib/python'
from datetime import datetime
import numpy as np
# These are some parameters that could be useful to have up top
year = 2019
month = 12
first_day = 2
last_day = 8
year = 2020
month = 1
first_day = 24
last_day = 31
clobber = False
time_range = slice(f'{year}-{month:02}-{first_day:02}',
......@@ -71,16 +69,11 @@ ax = plt.axes(projection=ccrs.AlbersEqualArea(central_longitude=360-95,
plt.gca().outline_patch.set_visible(False)
ax.set_extent([-118, -75, 23.5, 50.5])
state_shp_path = f'{os.environ["DATA_DIR"]}' \
f'/geography/ne_10m_admin_1_states_provinces_lakes' \
f'/ne_10m_admin_1_states_provinces_lakes.shp'
for shape in shapereader.Reader(state_shp_path).records():
if shape.attributes['adm0_a3'] == 'USA':
ax.add_geometries(shape.geometry, ccrs.PlateCarree(),
edgecolor='none', facecolor='silver', zorder=1)
ax.add_geometries(shape.geometry, ccrs.PlateCarree(),
edgecolor=(0.2, 0.2, 0.2), linewidth=0.5,
facecolor='none', zorder=3)
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)
cjs.tstamp('Draw data')
levels = [5, 10, 25, 50, 75, 100, 125, 150, 200, 300, 500]
......
......@@ -11,18 +11,16 @@ import matplotlib.pyplot as plt
import numpy as np
import cartopy.crs as ccrs
import calendar
import cartopy.io.shapereader as shapereader
import matplotlib as mpl
import cjs # '~carl/lib/python'
from datetime import datetime
cjs.tstamp('Here we go!')
# These are some parameters that could be useful to have up top
# mpl.use('Agg')
year = 2019
month = 12
year = 2020
month = 1
days_in_month = calendar.monthrange(year, month)[1]
start_day = 15
start_day = 1
delta_days = 5
first_days = np.arange(start_day, days_in_month - delta_days + 2, 1)
......@@ -73,16 +71,13 @@ for first_day, last_day in zip(first_days, last_days):
plt.gca().outline_patch.set_visible(False)
ax.set_extent([-118, -75, 23.5, 50.5])
state_shp_path = f'{os.environ["DATA_DIR"]}' \
f'/geography/ne_10m_admin_1_states_provinces_lakes' \
f'/ne_10m_admin_1_states_provinces_lakes.shp'
for shape in shapereader.Reader(state_shp_path).records():
if shape.attributes['adm0_a3'] == 'USA':
ax.add_geometries(shape.geometry, ccrs.PlateCarree(),
edgecolor='none', facecolor='silver', zorder=1)
ax.add_geometries(shape.geometry, ccrs.PlateCarree(),
edgecolor=(0.2, 0.2, 0.2), linewidth=0.5,
facecolor='none', zorder=3)
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)
cjs.tstamp('Draw data')
levels = [5, 10, 25, 50, 75, 100, 125, 150, 200, 300, 500]
......@@ -113,6 +108,7 @@ for first_day, last_day in zip(first_days, last_days):
cjs.tstamp('Save figure')
plt.tight_layout()
os.makedirs(f'figures/prcp-pon/', exist_ok=True)
plt.savefig(f'figures/prcp-pon/prcp-pon-{year}-{month:02}{first_day:02}'
f'-{month:02}{last_day:02}.png', dpi=200)
......
......@@ -15,8 +15,8 @@ import cjs # '~carl/lib/python'
cjs.tstamp('Here we go!')
# These are some parameters that could be useful to have up top
month = 12
year = 2019
month = 1
year = 2020
days_in_month = calendar.monthrange(year, month)[1]
time_range = slice(f'{year}-{month}-01', f'{year}-{month}-{days_in_month}')
clobber = False
......@@ -61,7 +61,7 @@ ax.plot(ax.get_xlim(), [1, 1], '--', color='k', linewidth=0.5)
ax.xaxis.set_minor_locator(mdates.DayLocator(interval=1))
ax.xaxis.set_major_locator(mdates.DayLocator(bymonthday=np.arange(1,35,5)))
ax.xaxis.set_major_formatter(mdates.DateFormatter('%b %-d'))
plt.xlim(time_range.start, time_range.stop)
plt.xlim(sub_ds.time[0], sub_ds.time[-1])
plt.title(f'Standardized teleconnection amplitudes\n'
f' {calendar.month_name[month]} {year}')
plt.ylabel('Standard Deviations')
......
......@@ -11,16 +11,13 @@ import matplotlib.pyplot as plt
import numpy as np
import cartopy.crs as ccrs
import calendar
import cartopy.io.shapereader as shapereader
import matplotlib as mpl
import cjs # '~carl/lib/python'
from datetime import datetime
# These are some parameters that could be useful to have up top
# mpl.use('Agg')
year = 2019
month = 12
first_day = 27
year = 2020
month = 1
first_day = 24
last_day = 31
clobber = False
......@@ -66,16 +63,11 @@ ax = plt.axes(projection=ccrs.AlbersEqualArea(central_longitude=360-95,
plt.gca().outline_patch.set_visible(False)
ax.set_extent([-118, -75, 23.5, 50.5])
state_shp_path = f'{os.environ["DATA_DIR"]}' \
f'/geography/ne_10m_admin_1_states_provinces_lakes' \
f'/ne_10m_admin_1_states_provinces_lakes.shp'
for shape in shapereader.Reader(state_shp_path).records():
if shape.attributes['adm0_a3'] == 'USA':
ax.add_geometries(shape.geometry, ccrs.PlateCarree(),
edgecolor='none', facecolor='silver', zorder=1)
ax.add_geometries(shape.geometry, ccrs.PlateCarree(),
edgecolor=(0.2, 0.2, 0.2), linewidth=0.5,
facecolor='none', zorder=3)
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)
cjs.tstamp('Draw data')
levels = list(np.arange(-5,6)*3)
......
......@@ -11,19 +11,17 @@ import matplotlib.pyplot as plt
import numpy as np
import cartopy.crs as ccrs
import calendar
import cartopy.io.shapereader as shapereader
import matplotlib as mpl
import cjs # '~carl/lib/python'
from datetime import datetime
cjs.tstamp('Here we go!')
# These are some parameters that could be useful to have up top
# mpl.use('Agg')
year = 2019
month = 12
year = 2020
month = 1
days_in_month = calendar.monthrange(year, month)[1]
delta_days = 5
start_day = 15
start_day = 1
delta_days = 1
first_days = np.arange(start_day, days_in_month - delta_days + 2, 1)
last_days = np.arange(start_day + delta_days - 1, days_in_month + 1, 1)
......@@ -69,16 +67,12 @@ for first_day, last_day in zip(first_days, last_days):
plt.gca().outline_patch.set_visible(False)
ax.set_extent([-118, -75, 23.5, 50.5])
state_shp_path = f'{os.environ["DATA_DIR"]}' \
f'/geography/ne_10m_admin_1_states_provinces_lakes' \
f'/ne_10m_admin_1_states_provinces_lakes.shp'
for shape in shapereader.Reader(state_shp_path).records():
if shape.attributes['adm0_a3'] == 'USA':
ax.add_geometries(shape.geometry, ccrs.PlateCarree(),
edgecolor='none', facecolor='silver', zorder=1)
ax.add_geometries(shape.geometry, ccrs.PlateCarree(),
edgecolor=(0.2, 0.2, 0.2), linewidth=0.5,
facecolor='none', zorder=3)
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)
cjs.tstamp('Draw data')
levels = list(np.arange(-5,6)*3)
......@@ -110,6 +104,7 @@ for first_day, last_day in zip(first_days, last_days):
cjs.tstamp('Save figure')
plt.tight_layout()
os.makedirs(f'figures/tave-anom/', exist_ok=True)
plt.savefig(f'figures/tave-anom/tave-anom-{year}-{month:02}{first_day:02}'
f'-{month:02}{last_day:02}.png', dpi=200)
# plt.show()
......
......@@ -12,15 +12,14 @@ import matplotlib.path as mpath
import numpy as np
import cartopy.crs as ccrs
import calendar
import cartopy.io.shapereader as shapereader
import matplotlib as mpl
import cjs # '~carl/lib/python'
from datetime import datetime
# These are some parameters that could be useful to have up top
year = 2019
month = 12
first_day = 1
year = 2020
month = 1
first_day = 24
last_day = 31
clobber = False
......@@ -53,6 +52,10 @@ clim_data = clim_ds['hgt500'].sel(year_day=dayofyear.values).mean(
cjs.tstamp('Anomalize')
anom_data = total_data - clim_data
anom_data = cjs.add_cyclic(anom_data)
total_data = cjs.add_cyclic(total_data)
for region in ['nhem', 'namer']:
cjs.tstamp('Draw map')
plt.figure(figsize=[6.4,6.0])
......@@ -97,12 +100,8 @@ for region in ['nhem', 'namer']:
levels=clevels, colors=['black'])
country_shp_path = f'{os.environ["DATA_DIR"]}' \
f'/geography/ne_50m_admin_0_countries_lakes' \
f'/ne_50m_admin_0_countries_lakes.shp'
for shape in shapereader.Reader(country_shp_path).records():
ax.add_geometries(shape.geometry, ccrs.PlateCarree(),
edgecolor=(0.2, 0.2, 0.2), linewidth=0.5,
shp_name = 'ne_50m_admin_0_countries_lakes'
cjs.add_map(ax, shp_name, edgecolor=(0.2, 0.2, 0.2), linewidth=0.5,
facecolor='none', zorder=3)
cjs.tstamp('Add labels')
......
......@@ -11,7 +11,6 @@ import matplotlib.pyplot as plt
import numpy as np
import cartopy.crs as ccrs
import calendar
import cartopy.io.shapereader as shapereader
import matplotlib as mpl
import matplotlib.path as mpath
import cjs # '~carl/lib/python'
......@@ -20,12 +19,12 @@ from datetime import datetime
cjs.tstamp('Here we go!')
# These are some parameters that could be useful to have up top
# mpl.use('Agg')
year = 2019
month = 12
year = 2020
month = 1
days_in_month = calendar.monthrange(year, month)[1]
delta_days = 5
start_day = 15
clobber = False
start_day = 1
clobber = True
first_days = np.arange(start_day, days_in_month - delta_days + 2, 1)
last_days = np.arange(start_day + delta_days - 1, days_in_month + 1, 1)
......@@ -58,6 +57,9 @@ for first_day, last_day in zip(first_days, last_days):
cjs.tstamp('Anomalize')
anom_data = total_data - clim_data
anom_data = cjs.add_cyclic(anom_data)
total_data = cjs.add_cyclic(total_data)
for region in ['nhem', 'namer']:
cjs.tstamp('Draw map')
plt.figure(figsize=[6.4, 6.0])
......@@ -102,13 +104,9 @@ for first_day, last_day in zip(first_days, last_days):
cont_plot = total_data.plot.contour(ax=ax, transform=ccrs.PlateCarree(),
levels=clevels, colors=['black'])
country_shp_path = f'{os.environ["DATA_DIR"]}' \
f'/geography/ne_50m_admin_0_countries_lakes' \
f'/ne_50m_admin_0_countries_lakes.shp'
for shape in shapereader.Reader(country_shp_path).records():
ax.add_geometries(shape.geometry, ccrs.PlateCarree(),
edgecolor=(0.2, 0.2, 0.2), linewidth=0.5,
facecolor='none', zorder=3)
shp_name = 'ne_50m_admin_0_countries_lakes'
cjs.add_map(ax, shp_name, edgecolor=(0.2, 0.2, 0.2), linewidth=0.5,
facecolor='none', zorder=3)
cjs.tstamp('Add labels')
date_string = f'{calendar.month_name[month]} {first_day}-{last_day} {year}'
......@@ -133,6 +131,7 @@ for first_day, last_day in zip(first_days, last_days):
cjs.tstamp('Save figure')
# plt.tight_layout()
os.makedirs(f'figures/hgt500-{region}/', exist_ok=True)
plt.savefig(f'figures/hgt500-{region}/'
f'hgt500-{region}-{year}-{month:02}{first_day:02}'
f'-{month:02}{last_day:02}.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