Commit d410ecca authored by Carl Schreck's avatar Carl Schreck

Empty output directories for multi_maps

parent 123429f6
......@@ -13,6 +13,7 @@ import cartopy.crs as ccrs
import calendar
import cjs # '~carl/lib/python'
from datetime import datetime
import glob
cjs.tstamp('Here we go!')
# These are some parameters that could be useful to have up top
......@@ -41,6 +42,12 @@ if download_err:
f'{year}/{month:02}/{file_name}')
download_err = cjs.download_file(ftp_path, in_path, clobber=True)
fig_path = f'figures/prcp-pon/'
os.makedirs(fig_path, exist_ok=True)
old_files = glob.glob(f'{fig_path}/*')
for file in old_files:
os.remove(file)
for first_day, last_day in zip(first_days, last_days):
time_range = slice(f'{year}-{month:02}-{first_day:02}',
f'{year}-{month:02}-{last_day:02}')
......@@ -98,8 +105,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}'
plt.savefig(f'{fig_path}/prcp-pon-{year}-{month:02}{first_day:02}'
f'-{month:02}{last_day:02}.png', dpi=100)
# plt.show()
......
......@@ -15,7 +15,7 @@ import cjs # '~carl/lib/python'
cjs.tstamp('Here we go!')
# These are some parameters that could be useful to have up top
month = 3
month = 4
year = 2020
days_in_month = calendar.monthrange(year, month)[1]
time_range = slice(f'{year}-{month}-01', f'{year}-{month}-{days_in_month}')
......
......@@ -7,6 +7,7 @@ __license__ = "BSD-3.0"
import xarray as xr
import os
import glob
import matplotlib.pyplot as plt
import numpy as np
import cartopy.crs as ccrs
......@@ -42,6 +43,12 @@ for delta_days in [1, 5]:
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)
fig_path = f'figures/tave-anom-{delta_days}/',
os.makedirs(fig_path, exist_ok=True)
old_files = glob.glob(f'{fig_path}/*')
for file in old_files:
os.remove(file)
for first_day, last_day in zip(first_days, last_days):
time_range = slice(f'{year}-{month:02}-{first_day:02}',
f'{year}-{month:02}-{last_day:02}')
......@@ -95,7 +102,6 @@ for delta_days in [1, 5]:
cjs.tstamp('Save figure')
plt.tight_layout()
os.makedirs(f'figures/tave-anom-{delta_days}/', exist_ok=True)
plt.savefig(f'figures/tave-anom-{delta_days}/tave-anom_{delta_days}-{year}'
f'-{month:02}{first_day:02}'
f'-{month:02}{last_day:02}.png', dpi=100)
......
......@@ -15,6 +15,7 @@ import matplotlib as mpl
import matplotlib.path as mpath
import cjs # '~carl/lib/python'
from datetime import datetime
import glob
cjs.tstamp('Here we go!')
# These are some parameters that could be useful to have up top
......@@ -32,7 +33,14 @@ ftp_path = (f'ftp://ftp.cdc.noaa.gov/Datasets/ncep.reanalysis.dailyavgs/'
f'pressure/{file_name}')
download_err = cjs.download_file(ftp_path, in_path, clobber=clobber)
for delta_days in [1, 5]:
fig_path = f'figures/hgt500-{region}-{delta_days}/',
os.makedirs(fig_path, exist_ok=True)
old_files = glob.glob(f'{fig_path}/*')
for file in old_files:
os.remove(file)
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)
......@@ -131,9 +139,8 @@ for delta_days in [1, 5]:
cjs.tstamp('Save figure')
# plt.tight_layout()
os.makedirs(f'figures/hgt500-{region}-{delta_days}/', exist_ok=True)
plt.savefig(f'figures/hgt500-{region}-{delta_days}/'
f'hgt500-{region}_{delta_days}-{year}-{month:02}{first_day:02}'
plt.savefig(f'{fig_path}/hgt500-{region}_{delta_days}'
f'-{year}-{month:02}{first_day:02}'
f'-{month:02}{last_day:02}.png', dpi=100)
# plt.show()
# plt.close()
......
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