-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmasked_verif.sh
More file actions
37 lines (28 loc) · 946 Bytes
/
Copy pathmasked_verif.sh
File metadata and controls
37 lines (28 loc) · 946 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
FILES=(
"/path/to/verif_file1.nc"
"/path/to/verif_file2.nc"
)
MASK_FILE="/path/to/mask_file.nc"
MASK_VARIABLE="mask_variable_name"
MASK_VALUE=1
VERIF_COMMAND="-m ensemble_crps -leg model1,model2 -lc black,red"
OUTPUT="test_verif.png"
PYTHON_SCRIPT=masked_verif.py
#----------------------------------------------------------------------------------------------------------#
#Check that all files exist
for file in "${FILES[@]}"; do
if [[ ! -f "$file" ]]; then
echo "File does not exist: $file" >&2
exit 1
fi
done
#Find list of filtered locations based on mask
LOCATIONS=($(python $PYTHON_SCRIPT \
--template-file "${FILES[0]}" \
--mask-file "$MASK_FILE" \
--mask-variable "$MASK_VARIABLE" \
--mask-value "$MASK_VALUE"))
echo "Filtered locations: ${LOCATIONS[@]}"
#Run verif with filtered locations
verif ${FILES[@]} $VERIF_COMMAND -l $(IFS=,; echo "${LOCATIONS[*]}") -f $OUTPUT