Commit 0407b476 authored by Carl Schreck's avatar Carl Schreck
Browse files

Automated Nightly Commit - Tue Jun 25 00:00:54 EDT 2019

parent 700dea97
......@@ -41,5 +41,11 @@ for remote_var, local_var in var_dict.items():
with open(local_path, 'wb') as out_file:
shutil.copyfileobj(response, out_file)
cjs.tstamp('Tarring')
tar_path = ( os.getenv('FTP_DIR') + 'monitor/hprcc/'
+ day.strftime('%Y%m') + '.tar')
with tarfile.open(tar_path, 'w') as tar:
tar.add(local_dir)
cjs.tstamp('Thank you, come again.')
......@@ -3,6 +3,7 @@ date
cd /home/carl/monitor/cron
source /home/carl/.bash_profile >& /dev/null
python scrape_hprcc.py
python scrape_sfcplot.py
date
""" Download maps from HPRCC and put them on the NCICS ftp."""
__author__ = "Carl Schreck"
__email__ = "cjschrec@ncsu.edu"
__copyright__ = "Copyright 2019, North Carolina State University"
__license__ = "BSD-3.0"
import datetime
import pandas as pd
import os
import shutil
import urllib.request
from urllib.error import URLError
import tarfile
import cjs # '~carl/lib-py'
cjs.tstamp('Here we go!')
# These are some parameters that could be useful to have up top
day = datetime.datetime.now() - datetime.timedelta(3)
local_dir = ( os.getenv('FTP_DIR') + 'monitor/sfcplot/'
+ day.strftime('%Y%m/'))
if not os.path.exists(local_dir):
os.makedirs(local_dir)
filename = 'sfcplot_sm_' + day.strftime('%Y%m%d') + '.gif'
remote_path = ('https://www.wpc.ncep.noaa.gov/dailywxmap/htmlimages/'
+ filename)
local_path = local_dir + filename
try:
response = urllib.request.urlopen(remote_path)
except URLError as e:
if hasattr(e, 'reason'):
print(e.reason + ': ' + remote_path)
elif hasattr(e, 'code'):
print(e.code + ': ' + remote_path)
else:
cjs.tstamp('Downloading: ' + remote_path)
with open(local_path, 'wb') as out_file:
shutil.copyfileobj(response, out_file)
cjs.tstamp('Tarring')
tar_path = ( os.getenv('FTP_DIR') + 'monitor/sfcplot/'
+ day.strftime('%Y%m') + '.tar')
with tarfile.open(tar_path, 'w') as tar:
tar.add(local_dir)
cjs.tstamp('Thank you, come again.')
......@@ -3,7 +3,7 @@
00 00 * * * /home/carl/monitor/cron/nightly_git.sh >& /home/carl/monitor/cron/log/nightly_git.log
00 23 * * * /home/carl/monitor/cron/archive.v2.sh >& /home/carl/monitor/cron/log/archive.log
00 10 * * * /home/carl/monitor/cron/tcvitals.sh >& /home/carl/monitor/cron/log/tcvitals.log
* 12 * * * /home/carl/monitor/cron/scrape_hprcc.sh >& /home/carl/monitor/cron/log/scrape_hprcc.log
* 16 * * * /home/carl/monitor/cron/scrap_mnb.sh >& /home/carl/monitor/cron/log/scrap_mnb.log
00 00 7 * * /home/carl/monitor/cron/monthly.sh >& /home/carl/monitor/cron/log/monthly.log
00 19 * * * /home/carl/monitor/v2/cluster/kickstarter.sh >& /home/carl/monitor/v2/cluster/log/kickstarter.log
#00 15 * * * /home/carl/monitor/v2/utilities/bsub_mail.sh >& /home/carl/monitor/v2/utilities/log/bsub_mail.log
......
Supports Markdown
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