Skip to content
Snippets Groups Projects
metobs_config.sh 1.77 KiB
Newer Older
#
# These values should override values used in python or bash scripts
#
# where the tower ascii files get pushed to
DATA_ROOT=/data1
export TOWER_INCOMING_DIR="${DATA_ROOT}/incoming/aoss/tower"
# The archived location (primary raw)
export TOWER_PRAW_DIR="${DATA_ROOT}/raw/aoss/tower"
# Where generated products go
export TOWER_CACHE_DIR="${DATA_ROOT}/cache/aoss/tower"
# Python environment to use and where scripts are location
export ENV=/opt/metobs/aoss_tower
# Directory where logs will be stored
export LOGDIR=$ENV/log
# Directory where lock files will be stored
export LOCKDIR=$ENV/lock
# Directory where work files can be placed (inside a separate temp directory)
export WORKDIR="${DATA_ROOT}/tmp"

log_info() {
    echo "INFO: $*" &>> $logfile
}

oops() {
    echo "ERROR: $*" &>> $logfile
    exit 1
}

    date +%Y%m%d --date "$1 -1 day" || oops "Could not get day before"
    d=$(mktemp -d --tmpdir="$WORKDIR" "work_$1_XXXXXXXXXX")
    if [ $? -ne 0 ]; then
        oops "Could not create temporary work directory: $1"
    fi
    chmod 777 "$d" || oops "Could not change permissions of work directory: $d"
    echo $d
}

cache_level_00_file() {
    d=$1
    year=${d:0:4}
    month=${d:4:2}
    day=${d:6:2}
#    echo "${TOWER_CACHE_DIR}/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() {
    d=$1
    year=${d:0:4}
    month=${d:4:2}
    day=${d:6:2}
    echo "${TOWER_CACHE_DIR}/level_b1/version_00/${year}/${month}/${day}/aoss_tower.${year}-${month}-${day}.nc"
#    echo "${TOWER_CACHE_DIR}/level_b1/version_00/${year}/${month}/aoss_tower.${year}-${month}-${day}.nc"