Skip to content

Commit

Permalink
📝 ✏️ updating usage documentation
Browse files Browse the repository at this point in the history
small typo in Run.sh mismatch between branches
  • Loading branch information
cemachelen committed Feb 7, 2019
1 parent 6a366f9 commit 3693adf
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 31 deletions.
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Repository for the [UNRESP](https://vumo.cloud/) Forecasting System:

An automated forecasting system has been created that uses the [CALPUFF](http://www.src.com/) dispersion model to predict S02 and S04 concentrations around the Masaya volcano. This is based on the current forecasting system implemented by IMO, but with modifications and improvements.

This work is displayed [here]([~earunres](https://homepages.see.leeds.ac.uk/~earunres))

## Description ##

The repository hosts the scripts required to run the CALPUFF dispersion model to predict SO2 concentrations around the Masaya volcano forecasting for 48 hours using NAM data. The hourly output is plotted in individual png files and collated into a mp4 movie.
Expand All @@ -26,6 +28,15 @@ python 3**

Aimed at running on the Leeds Linux systems

```bash
./Run.sh
optional arguments
-d Date YYYYMMDD, defaults to
-n specify home directory, defaults to ~earunres
-h help prints Usage statement and exits
```
This set up defaults to production behaviour to run as a chronjob displaying at [~earunres](https://homepages.see.leeds.ac.uk/~earunres/UNRESP_VIZ/index.html)

* In Run.sh various parameters can be set:
1. `res` to alter the resolution between 100 - 1000 m
2. `runVis=True` Enable visualization creating static and movie visualisations of the CALPUFF model output via a python script (generateMaps.py) and the Linux tool 'ffmpeg', respectively.
Expand All @@ -35,13 +46,13 @@ Aimed at running on the Leeds Linux systems
6. `run3DDAT=true` - Downloads the required met (NAM) data and runs a python script (Create3DDAT.py) to extract the required data into a file appropriate for input to CALMET.
7. `runCALMET=true` - The 3-D diagnostic meteorological model part of the CALPUFF system
8. `runCALPUFF=true` - The main dispersion model part of the CALPUFF system
* To forecast for the current day:
* To forecast for the current day default visualization home to ~earunres (production):
```bash
./Run.sh
```
* To forecast for a specific day:
```bash
./Run.sh YYYYMMDD
./Run.sh -d YYYYMMDD
```
Note, however, that the external met (NAM) data that the script will try to download is only accessible for around 10 days after the original date before it is removed from the ftp site.
* Chronjobs: 2 chronjobs are required
Expand Down Expand Up @@ -80,6 +91,17 @@ The directory structure of the repository is as follows:
<hr>
## Version information
<!--- release table --->
| Version | Release |
|---------------------|------------------|
| **UoL original** | [![GitHubrelease](https://img.shields.io/badge/release-v.1.0-blue.svg)](https://github.com/cemac/DECAF_workflow/releases/tag/v1.0)|
| **Viz update** | [![GitHubrelease](https://img.shields.io/badge/release-v.2.0.2-blue.svg)](https://github.com/cemac/UNRESPForcastingSystem/releases/tag/v2.0.2) |
| **SO4** | *coming soon* |
<!--- table --->
## Acknowledgements ##
*Comming soon*
Expand Down
43 changes: 14 additions & 29 deletions Run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,14 @@
set -e #stop at first error
module load intel/17.0.0
module load python2 python-libs
# Defaults
rundate=$(date +%Y%m%d)
vizhome=~earunres

print_usage() {
echo "Usage:
-d date YMD defaults to today
-n name of viz defaults to ~earunres"
}

while getopts 'dn:hv' flag; do
case "${flag}" in
d) rundate="${OPTARG}" ;;
n) vizhome="${OPTARG}" ;;
v) verbose=true ;;
h) print_usage
exit 1 ;;
*) print_usage
exit 1 ;;
esac
done

#Read in command line arguments and set subsequent variables
if [ $# -eq 0 ]
then
rundate=$(date +%Y%m%d)
else
rundate=$1
fi
prevdate=$(date -d "$rundate - 1 day" +%Y%m%d)
middate=$(date -d "$rundate + 1 day" +%Y%m%d)
enddate=$(date -d "$rundate + 2 days" +%Y%m%d)
Expand All @@ -49,15 +35,16 @@ run3DDAT=true
runCALMET=true
runCALPUFF=true
runVIS=true
runffmpeg=false
runffmepg=false

#Set other parameters
res=1000 #Resolution (m) of intended CALPUFF grid. Should be an integer that is > 100 and < 1000
let NX=90000/$res+1
let NY=54000/$res+1
DGRIDKM=$(echo "scale=3; $res/1000" | bc)
let MESHGLAZ=1000/$res+1
# VISUALISATION PATH
VIZPATH=$vizhome/public_html/UNRESP_VIZ/
VIZPATH=~/public_html/UNRESP_VIZ/
cwd=$(pwd)

echo "### RUNNING FORECAST SYSTEM FOR DATE "${rundate}" ###"
Expand Down Expand Up @@ -191,7 +178,7 @@ if [ "$run3DDAT" = true ]; then
#Entire GRIB file:
#wget http://www.ftp.ncep.noaa.gov/data/nccf/com/nam/prod/nam.${rundate}/nam.t00z.afwaca${hour}.tm00.grib2
#Subset of GRIB file using GRIB filter (http://nomads.ncep.noaa.gov/cgi-bin/filter_nam_crb.pl):
curl "https://nomads.ncep.noaa.gov/cgi-bin/filter_nam_crb.pl?file=nam.t00z.afwaca"${hour}".tm00.grib2&"\
curl "http://nomads.ncep.noaa.gov/cgi-bin/filter_nam_crb.pl?file=nam.t00z.afwaca"${hour}".tm00.grib2&"\
"lev_1000_mb=on&lev_100_mb=on&lev_10_mb=on&lev_150_mb=on&lev_200_mb=on&lev_20_mb=on&lev_250_mb=on&"\
"lev_2_mb=on&lev_300_mb=on&lev_30_mb=on&lev_400_mb=on&lev_500_mb=on&lev_50_mb=on&lev_5_mb=on&"\
"lev_600_mb=on&lev_700_mb=on&lev_75_mb=on&lev_7_mb=on&lev_800_mb=on&lev_850_mb=on&lev_900_mb=on&"\
Expand Down Expand Up @@ -339,17 +326,15 @@ if [ "$runVIS" = true ]; then
./generateMaps.py ${rundate}
cd ..
cd vis/${rundate}
if [ "$runffmpeg" = true]; then
echo "Running ffmpeg"
ffmpeg -f image2 -r 4 -i static_concrec0100%02d.png -vcodec mpeg4 -y -s 7680x4320 movie_${rundate}.mp4
if [ "$runffmepg" = true ]; then
ffmpeg -f image2 -r 4 -i static_concrec0100%02d.png -vcodec mpeg4 -y -s 7680x4320 movie_${rundate}.mp4
fi
cd ../..
echo " ---> FINISHED ###"

echo "Adding latest VISUALISATION to website at "$VIZPATH
echo "Adding latest VISUALISATION to website"

cd vis/${rundate}
echo "Reformatting png to jpg"
mogrify -format jpg *.png
rm -f *.png
setfacl -m other:r-x *.jpg *.html
Expand Down

0 comments on commit 3693adf

Please sign in to comment.