Skip to content
Snippets Groups Projects
metobs_config.sh 1.55 KiB
#
# These values should override values used in python or bash scripts
#
# where the tower ascii files get pushed to
export TOWER_INCOMING_DIR=/mnt/inst-data/incoming/aoss/tower
# The archived location (primary raw)
export TOWER_PRAW_DIR=/mnt/inst-data/raw/aoss/tower
# Where generated products go
export TOWER_CACHE_DIR=/mnt/inst-data/cache/aoss/tower
# Python environment to use and where scripts are location
export ENV=/data1/software/aoss-tower3
# Directory where logs will be stored
export LOGDIR=$ENV/logs
# Directory where work files can be placed (inside a separate temp directory)
export WORKDIR=/mnt/inst-data/tmp

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

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

day_before() {
    date +%Y%m%d --date "$1 -1 day" || oops "Could not get day before"
}

work_dir() {
    mktemp -d --tmpdir="$WORKDIR" "work_$1_XXXXXXXXXX" || oops "Could not create work directory: $1"
}

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}/rig_tower.${year}-${month}-${day}.ascii"
}

cache_level_b1_file() {
    d=$1
    year=${d:0:4}
    month=${d:4:2}
    day=${d:6:2}
    # 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"
}