Skip to content

Commit

Permalink
Merge branch 'master' of github.com:mankoff/SICE
Browse files Browse the repository at this point in the history
  • Loading branch information
mankoff committed Apr 26, 2020
2 parents 35592a5 + 9bd082c commit 3b0c52d
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions S3_NRT.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/usr/bin/env bash

# Wrapper for running SICE pipeline Near Real-Time (NRT)

# example of cron job:
# m h dom mon dow command
# 00 12 * * * /bin/bash -c "/path/to/wrapper/S3_NRT.sh" > /path/to/log/log_NRT.txt

# use SNAP gpt
export PATH=/srv/home/8675309/local/snap/bin:${PATH}

# activate SICE anaconda virtual environment
. /srv/home/8675309/local/anaconda/envs/SICE/bin/activate

set -o errexit
set -o nounset
set -o pipefail
set -x

red='\033[0;31m'; orange='\033[0;33m'; green='\033[0;32m'; nc='\033[0m' # No Color
log_info() { echo -e "${green}[$(date --iso-8601=seconds)] [INFO] ${@}${nc}"; }
log_warn() { echo -e "${orange}[$(date --iso-8601=seconds)] [WARN] ${@}${nc}"; }
log_err() { echo -e "${red}[$(date --iso-8601=seconds)] [ERR] ${@}${nc}" 1>&2; }

# change directory to the current folder
cd "${0%/*}"

### dev
# SEN3_source=./SEN3
# proc_root=./out
# mosaic_root=./mosaic

LD_LIBRARY_PATH=. # SNAP requirement

date=$(date -d '-2days' "+%Y-%m-%d")
year=$(date "+%Y")

declare -a regions=("Greenland" "Iceland" "Svalbard" "NovayaZemlya" "SevernayaZemlya" "FransJosefLand" "NorthernArcticCanada" "SouthernArcticCanada" "JanMayen" "Norway" "Beaufort")

for region in "${regions[@]}"; do

# CREODIAS
SEN3_local=/eodata/Sentinel-3
SEN3_source=/sice-data/SICE/${region}/S3
proc_root=/sice-data/SICE/${region}/proc
mosaic_root=/sice-data/SICE/${region}/mosaic

mkdir -p /sice-data/SICE/${region}

### Fetch one day of OLCI & SLSTR scenes over Greenland
## Use local files (PTEP, DIAS, etc.)
./dhusget_wrapper.sh -d ${date} -l ${SEN3_local} -o ${SEN3_source}/${year}/${date} \
-f ${region} -u <user> -p <password>

# SNAP: Reproject, calculate reflectance, extract bands, etc.
./S3_proc.sh -i ${SEN3_source}/${year}/${date} -o ${proc_root}/${date} -X S3.xml -t

# Run the Simple Cloud Detection Algorithm (SCDA)
python ./SCDA.py ${proc_root}/${date}

# Mosaic
./dm.sh ${date} ${proc_root}/${date} ${mosaic_root}

# SICE
python ./sice.py ${mosaic_root}/${date}

done

0 comments on commit 3b0c52d

Please sign in to comment.