From 5207bd75cd2d3cc1acc5d7786190cf05ed7bd5da Mon Sep 17 00:00:00 2001
From: davidh-ssec <david.hoese@ssec.wisc.edu>
Date: Fri, 14 Jul 2017 14:25:02 -0500
Subject: [PATCH] Move tower archive script to new common archive scheme

---
 scripts/archive_tower.sh | 12 ++++++++++--
 scripts/metobs_config.sh |  7 +++++--
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/scripts/archive_tower.sh b/scripts/archive_tower.sh
index 859c8cc..e1877b9 100755
--- a/scripts/archive_tower.sh
+++ b/scripts/archive_tower.sh
@@ -28,8 +28,16 @@ fi
         mkdir -p $TOWER_INCOMING_DIR
     fi
 
-    log_info "$(date +%Y-%m-%dT%H:%M:%S): Running archive jobs for ${DATE}" >> $logfile
-    $ENV/bin/python -m metobscommon.archive.incoming -vv -l $logfile --date=${DATE} aoss.tower
+    log_info "$(date +%Y-%m-%dT%H:%M:%S): Running archive jobs for ${DATE}"
+    $ENV/bin/python -m metobscommon.archive.incoming -vv -l $logfile --dates=${DATE} 00 aoss.tower "rig_tower.%Y-%m-%d.ascii"
+
+    # Hack to keep the old 'ascii' directory up to date
+    # FIXME: Remove this once all new generation scripts work
+    year=${DATE:0:4}
+    month=${DATE:4:2}
+    day=${DATE:6:2}
+    mkdir -p $TOWER_CACHE_DIR/ascii/${year}/${month}/
+    ln -s "$TOWER_PRAW_DIR/${year}/${month}/${day}/rig_tower.${year}-${month}-${day}.ascii" "$TOWER_CACHE_DIR/ascii/${year}/${month}/"
 
     log_info "Done"
 
diff --git a/scripts/metobs_config.sh b/scripts/metobs_config.sh
index 287839c..11f4c2c 100644
--- a/scripts/metobs_config.sh
+++ b/scripts/metobs_config.sh
@@ -36,7 +36,7 @@ cache_level_00_file() {
     year=${d:0:4}
     month=${d:4:2}
     day=${d:6:2}
-    echo "${TOWER_CACHE_DIR}/aoss/tower/level_00/version_00/${year}/${month}/${day}/aoss_tower.${year}-${month}-${day}.ascii"
+    echo "${TOWER_CACHE_DIR}/level_00/version_00/${year}/${month}/${day}/aoss_tower.${year}-${month}-${day}.ascii"
 }
 
 cache_level_b1_file() {
@@ -44,5 +44,8 @@ cache_level_b1_file() {
     year=${d:0:4}
     month=${d:4:2}
     day=${d:6:2}
-    echo "${TOWER_CACHE_DIR}/aoss/tower/level_b1/version_00/${year}/${month}/${day}/aoss_tower.${year}-${month}-${day}.nc"
+    # new:
+#    echo "${TOWER_CACHE_DIR}/level_b1/version_00/${year}/${month}/${day}/aoss_tower.${year}-${month}-${day}.nc"
+    # old:
+    echo "${TOWER_CACHE_DIR}/level_b1/version_00/${year}/${month}/aoss_tower.${year}-${month}-${day}.nc"
 }
\ No newline at end of file
-- 
GitLab