diff --git a/scripts/catchup_day.sh b/scripts/catchup_day.sh deleted file mode 100755 index 86140eea6ac398fcea61453c6701de23222ace13..0000000000000000000000000000000000000000 --- a/scripts/catchup_day.sh +++ /dev/null @@ -1,36 +0,0 @@ -#/bin/bash -# A script that runs all of a day's wheat rust forecasts in order -# 1: depo -# 2: env -# 3: epi -# 4: advisory - -echo "starting catchup" - -config=$1 # /storage/app/EWS_prod/regions/EastAfrica/resources/coordinator/configs/config_EastAfrica_fc_live.json -date=$2 # 20221009 - -# depo -/storage/app/EWS_prod/code/coordinator/scripts/run_Processor.sh -p Deposition -c $config -s $date --clearup & - -# Wait at least a minute so that logfile timestamps do not clash -sleep 70 - -# env -/storage/app/EWS_prod/code/coordinator/scripts/run_Processor.sh -p Environment -c $config -s $date --clearup & - -# wait for depo and env to finish -wait - -# epi -/storage/app/EWS_prod/code/coordinator/scripts/run_Processor.sh -p Epidemiology -c $config -s $date --clearup & - -# Wait at least a minute so that logfile timestamps do not clash -sleep 70 - -# advisory -/storage/app/EWS_prod/code/coordinator/scripts/run_Processor.sh -p Advisory -c $config -s $date --clearup & - -wait - -echo "finished catchup" diff --git a/scripts/run_Depo_Processor.sh b/scripts/run_Depo_Processor.sh index b5827334aaddeb6c6037c1918713d4b95c829034..d16ac3990a5c33644c250ff94058bb88e7250275 100644 --- a/scripts/run_Depo_Processor.sh +++ b/scripts/run_Depo_Processor.sh @@ -1,15 +1,14 @@ -source ./run_utils.sh +# get path of this script (to point to files within the same git repo) +proc_path="$(dirname "$(readlink -f "$0")")" + +source "${proc_path}"/run_utils.sh setup_conda_env -# get path of this script (to point to files within the same git repo) -proc_path="$(dirname "$(readlink -f "$0")")" # run the processor with all arguments -processor=${proc_path}/../coordinator/ProcessorDeposition.py -printf "processor is %s\n\n" "$processor" -python "${processor}" "$@" +python "${proc_path}"/../coordinator/ProcessorDeposition.py "$@" exit_code=$? teardown_conda_env diff --git a/scripts/run_EnvPostProcess.sh b/scripts/run_EnvPostProcess.sh deleted file mode 100755 index 473b4d012174a26249320d78bef983024e359a7b..0000000000000000000000000000000000000000 --- a/scripts/run_EnvPostProcess.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -set -e - -# provide custom python packages so they can be imported - -# activate conda environment of python modules so they can be imported -source /storage/app/miniconda3/bin/activate /storage/app/EWS/General/EWS-python/py3EWSepi - -python /storage/app/EWS/General/EWS-Coordinator/ENVDataPostProcessor.py "$@" - -# deactivate conda environment -source /storage/app/miniconda3/bin/deactivate /storage/app/EWS/General/EWS-python/py3EWSepi - diff --git a/scripts/slice_tar_file_to_bounds.sh b/scripts/slice_tar_file_to_bounds.sh deleted file mode 100644 index 5a301cb65699351b4a90308e63c2a1e4177dcce7..0000000000000000000000000000000000000000 --- a/scripts/slice_tar_file_to_bounds.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!bin/bash -#slice_tar_file_to_bounds.sh -echo "CAUTION: Bounds are currently hard-wired" -echo "It can be calculated automatically, but requires both ogrinfo and cdo to be available" - -# activate conda env which has cdo -# CAUTION: Does not contain rasterio or geopandas, so ogrinfo is not available -echo "run conda activate conda activate /storage/home/tm689/miniconda3/envs/ewses_env" - -tar_file=$1 #/.tar.gz file from Met Office -bounds_file=$2 # shpfile -outputdir=$3 -# TODO: Determine lonres and latres in the script -lonres=0.140625 # can be obtained from any nc in tar file -latres=0.09375 # can be obtained from any nc in tar file - -# 1) Determine bounds of sub-region - -bounds_str=$(ogrinfo -so -al $bounds_file | grep "Extent"); -echo "bounds_str: $bounds_str" - -coords=($(echo $bounds_str | grep -o -E '[0-9\.]+')); - -# bounds of input file -blonmin=${coords[0]}; -blatmin=${coords[1]}; -blonmax=${coords[2]}; -blatmax=${coords[3];} - -# we need nc files to go beyond those bounds by at least one datapoint -lonmin=$(bc -l <<< "$blonmin - $lonres"); -latmin=$(bc -l <<< "$blatmin - $latres"); -lonmax=$(bc -l <<< "$blonmax + $lonres"); -latmax=$(bc -l <<< "$blatmax + $latres"); -# Hard-wired: Pre-determined for example Ethiopia region -lonmin=38.60 -lonmax=40.43 -latmin=8.10 -latmax=8.86 -echo "Bounds are $lonmin, $latmin, $lonmax, $latmax" - -# 2) get original netcdf files from input tar file - -originaldir=$outputdir/original; -mkdir $originaldir; - -tar -zxvf $tar_file -C $originaldir; - -# 3) Slice the original netcdf files - -# define the output directory -# remove suffix -tar_fn=$(basename $tar_file); -tar_fn_small=${tar_fn%.tar.gz}_small; - -outputdir_tar_contents=${outputdir}/${tar_fn_small}/; -mkdir $outputdir_tar_contents; - -nc_fns=$(find $originaldir -type f -name "*.nc"); - -for fn in $nc_fns; do - - fn_small=${outputdir_tar_contents}$(basename ${fn%.nc})_small.nc; - - echo "cdo command: sellonlatbox,$lonmin,$lonmax,$latmin,$latmax $fn $fn_small"; - cdo "sellonlatbox,$lonmin,$lonmax,$latmin,$latmax" $fn $fn_small; - -done; - -# copy over any other files that need to be retained -fns_to_keep=$(find $originaldir -type f -name "sources.txt"); -cp $fns_to_keep $outputdir_tar_contents; - -# 4) Make the smaller tar file - -out_fn=$tar_fn_small.tar.gz; -cd $outputdir; -tar -zcvf $out_fn ${tar_fn_small}/; -cd -; - -echo "created ${out_fn}"; - -# clean up - -rm -rf $originaldir; -rm -rf $outputdir_tar_contents; - -echo finished; -exit 0; \ No newline at end of file