#! /bin/csh -f

# This script sets up environment variables and runs the Metmoves utility 
# Metmoves processes meteorology files preprocessed by Metcombine utility
# to create custom met files needed by MOVES Driver Scripts and SMOKE-Movesmrg. 
#
# This script assumes that the meteorology files are preprocessed and named with
# the following convention:
#
#     METCOMBO_<YYYYDDD>
#     METCOMBO_<YYYYDDD>
#
# Script created by B.H. Baek, CEMPD (4/20/2010)
#
#*****************************************************************************

# Script settings
setenv PROMPTFLAG N                # Y prompts for input
setenv GRID  FL4KM_MET4MOVES
setenv METABBREV 210525
setenv IOAPI_GRIDNAME_1  4MIDFLA1_87X81

# Metcombine settings
setenv SRG_LIST  "100 110 308 309 320 340 350"# list of surrogates to retrieve a list of counties

# Define averaging method for RH and Min/Max temperatures
setenv TVARNAME          TEMP2       # chosen temperature variable name
setenv AVERAGING_METHOD	 DAILY       # averaging method for creating 24hr T profiles, DAILY or MONTHLY

# Temperature buffer in degrees F.  Will decrease the min by - TEMP_BUFFER_BIN 
# and increase the max by + TEMP_BUFFER_BIN, done before creating profile bins
setenv TEMP_BUFFER_BIN 0

## RH file (for RPD,RPV) do you want to get specific humidity (Y) or relative humidity (N) out
## default is RH
#setenv SPECIFIC_HUMIDITY_YN Y

# Case or abbreviation for name and year
setenv CASE FL4KM
setenv YEAR 2021

# Input files
# Base dir
setenv BASEDIR /lustre/fs0/home/mhasan/Parallel/XPORTFRAC/met4moves
setenv GE_DAT  /lustre/fs0/home/mhasan/Parallel/cmaq/Build_CMAQ/LIBRARIES/data/ge_dat
setenv MCXREF $GE_DAT/MCXREF_MYR_2002_2017_13oct2020_nf_v1
setenv MFMREF $GE_DAT/MFMREF_MYR_2002_2017_13oct2020_nf_v1
setenv SRGPRO_PATH $GE_DAT/Surrogates_4km
setenv SRGDESC $GE_DAT/srgdesc_4US3.txt
setenv COSTCY $GE_DAT/costcy.txt
setenv GRIDDESC $GE_DAT/GRIDDESC_NSF_PROJECT.txt

setenv METLIST  $BASEDIR/metlist.txt

# Define the modeling period
setenv STDATE ${YEAR}145               # Starting date in Julian
setenv ENDATE ${YEAR}146            # Ending date in Julian (should be 366 for leap year)
setenv ENDTIME 040000
setenv OUTZONE 0
setenv SMK_DEFAULT_TZONE 0



##############################################################################

# Define output file names for MOVES and SMOKE models
#setenv SMOKE_OUTFILE $BASEDIR/SMOKE_${AVERAGING_METHOD}_${CASE}_${GRID}.txt
setenv SMOKE_OUTFILE $BASEDIR/SMOKE_${AVERAGING_METHOD}_${CASE}_${GRID}.ncf
setenv MOVES_OUTFILE $BASEDIR/MOVES_${AVERAGING_METHOD}_${CASE}_${GRID}.txt
setenv MOVES_RH_OUTFILE $BASEDIR/MOVES_RH_${AVERAGING_METHOD}_${CASE}.txt

##############################################################################

/lustre/fs0/home/mhasan/Parallel/cmaq/Build_CMAQ/LIBRARIES/subsys/smoke/Linux2_x86_64ifort/met4moves
