Commit f368fa93 authored by Carl Schreck's avatar Carl Schreck

Working on bsub with monthly maps

parent 05f24172
......@@ -5,9 +5,13 @@ __email__ = "carl_schreck@ncsu.edu"
__copyright__ = "Copyright 2020, North Carolina State University"
__license__ = "BSD-3.0"
import numpy as np
import os
import argparse
import subprocess
from datetime import datetime
import glob
import calendar
import cjs # '~carl/lib/python'
# These are some parameters that could be useful to have up top
......@@ -15,6 +19,7 @@ parser = argparse.ArgumentParser()
parser.add_argument('--year', default=(datetime.today().year))
parser.add_argument('--month', default=(datetime.today().month - 1))
parser.add_argument('--dpi', default=200)
args = parser.parse_args()
year = int(args.year)
month = int(args.month)
dpi = int(args.dpi)
......@@ -22,6 +27,7 @@ if month < 1:
month += 12
year -= 1
start_day = 1
days_in_month = calendar.monthrange(year, month)[1]
days_in_month = 6 #######################
......@@ -38,8 +44,8 @@ for var_name in var_names:
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)
first_days = np.arange(start_day, days_in_month - delta_day + 2, 1)
last_days = np.arange(start_day + delta_day - 1, days_in_month + 1, 1)
for first_day, last_day in zip(first_days, last_days):
py_dir = os.getcwd()
......@@ -49,8 +55,14 @@ for var_name in var_names:
job_name = f'{var_name}_{first_day}_{last_day}'
log_file = f'{log_dir}/{job_name}.log'
err_file = f'{log_dir}/{job_name}.err'
os.remove(log_file)
os.remove(err_file)
try:
os.remove(log_file)
except OSError:
pass
try:
os.remove(err_file)
except OSError:
pass
py_option = f'--year {year} --month {month} ' \
f'--first_day {first_day} --last_day {last_day} ' \
......
......@@ -25,6 +25,7 @@ parser.add_argument('--dpi', default=200)
parser.add_argument('--fig_dir', default='figures/')
parser.add_argument('--no_terrain', dest='terrain', action='store_false')
parser.set_defaults(terrain=True)
args = parser.parse_args()
year = int(args.year)
month = int(args.month)
if month < 1:
......
......@@ -25,6 +25,7 @@ parser.add_argument('--dpi', default=200)
parser.add_argument('--fig_dir', default='figures/')
parser.add_argument('--no_terrain', dest='terrain', action='store_false')
parser.set_defaults(terrain=True)
args = parser.parse_args()
year = int(args.year)
month = int(args.month)
if month < 1:
......
......@@ -25,6 +25,7 @@ parser.add_argument('--first_day', default=25)
parser.add_argument('--last_day', default=31)
parser.add_argument('--dpi', default=200)
parser.add_argument('--fig_dir', default='figures/')
args = parser.parse_args()
year = int(args.year)
month = int(args.month)
if month < 1:
......
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