#!/bin/bash
# Run this after setting the namelist.wps up correctly

# Set paths
date=20190725.0000
gribdir=/users/staff/serafin/data/GRIB_IC_for_LAM/ECMWF/TEAMx_convection/

# Run WPS
./geogrid.exe
./link_grib.csh ${gribdir}/${date}/*
./ungrib.exe
./calc_ecmwf_p.exe
./avg_tsfc.exe
mpirun -np 32 ./metgrid.exe

# Archive results and clean up
archive=./archive/TEAMxConv_${date}
mkdir -p ${archive}
mv geo_em.d01.nc met_em* ${archive}
cp namelist.wps geogrid/GEOGRID.TBL.HIRES ${archive}
rm -fr FILE* PRES* TAVGSFC GRIBFILE* metgrid.log.*
