Commit ff36cab8 authored by Carl Schreck's avatar Carl Schreck

Working version of bsub with monthly maps

Changed temp_map.py to tavg_map.py
parent f368fa93
......@@ -29,14 +29,47 @@ if month < 1:
start_day = 1
days_in_month = calendar.monthrange(year, month)[1]
clobber = False
days_in_month = 6 #######################
var_names = ['z500', 'prcp', 'temp']
var_names = ['z500', 'prcp', 'tavg']
delta_days = [1, 5]
cjs.tstamp('Here we go!')
for var_name in var_names:
cjs.tstamp(f'Downloading {var_name}')
if var_name == 'z500':
file_name = f'hgt.{year}.nc'
in_path = f'{os.environ["DATA_DIR"]}/ncep1/esrl/daily/{file_name}'
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=False)
else:
file_type = 'scaled'
file_name = f'{var_name}-{year}{month:02}-grd-{file_type}.nc'
in_path = f'{os.environ["DATA_DIR"]}/nclimgrid/beta/{var_name}/' \
f'{file_name}'
ftp_path = (
f'ftp://ftp.ncdc.noaa.gov/pub/data/daily-grids/beta/by-month/'
f'{year}/{month:02}/{file_name}')
web_path = (
f'https://www1.ncdc.noaa.gov/pub/data/daily-grids/beta/by-month/'
f'{year}/{month:02}/{file_name}')
download_err = cjs.download_file(ftp_path, in_path, clobber=False)
if download_err:
file_type = 'prelim'
file_name = f'{var_name}-{year}{month:02}-grd-{file_type}.nc'
in_path = f'{os.environ["DATA_DIR"]}/nclimgrid/beta/{var_name}/' \
f'{file_name}'
web_path = (
f'https://www1.ncdc.noaa.gov/pub/data/daily-grids/beta/by-month/'
f'{year}/{month:02}/{file_name}')
ftp_path = (
f'ftp://ftp.ncdc.noaa.gov/pub/data/daily-grids/beta/by-month/'
f'{year}/{month:02}/{file_name}')
download_err = cjs.download_file(ftp_path, in_path, clobber=True)
for delta_day in delta_days:
fig_dir = f'figures/{var_name}-{delta_day}'
os.makedirs(fig_dir, exist_ok=True)
......@@ -66,12 +99,14 @@ for var_name in var_names:
py_option = f'--year {year} --month {month} ' \
f'--first_day {first_day} --last_day {last_day} ' \
f'--dpi {dpi} --fig_dir {fig_dir} --no_terrain'
f'--dpi {dpi} --fig_dir {fig_dir}'
if var_name != 'z500':
py_option = f'{py_option} --no_terrain'
command = f'bsub -J {job_name} -o {log_file} -e {err_file} ' \
f'-q allnodes -sp 75 /home/carl/template/run_py.sh' \
f'-q allnodes -sp 75 /home/carl/template/run_py.sh ' \
f'{py_dir} {py_script} "{py_option}"'
subprocess.run(command, shell=True)
subprocess.Popen(command, shell=True)
......
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