#!/bin/csh -f

/bin/ln -s YOUR-installed-bin

source bin/g5_modules
limit stacksize unlimited

#cleanup
/bin/rm -r InData/ OutData/ InData1/

mkdir -p InData OutData1 OutData2

# Set links
###########
# InRestart and InTilFile
/bin/ln -s /gpfsm/dnb78s1/projects/p18/jperket/regriddebug/x0037NL/catch_internal_rst InData/InRestart
/bin/ln -s /discover/nobackup/ltakacs/bcs/Icarus-NLv3/Icarus-NLv3_Ostia/CF0360x6C_CF0360x6C/CF0360x6C_CF0360x6C-Pfafstetter.til InData/InTilFile

# Out grid
/bin/ln -s /discover/nobackup/ltakacs/bcs/Icarus-NLv3/Icarus-NLv3_Ostia/CF0720x6C_CF0720x6C/CF0720x6C_CF0720x6C-Pfafstetter.til OutData1/OutTilFile
/bin/ln -s /discover/nobackup/ltakacs/bcs/Icarus-NLv3/Icarus-NLv3_Ostia/CF0720x6C_CF0720x6C/CF0720x6C_CF0720x6C-Pfafstetter.til OutData2/OutTilFile
/bin/ln -s /discover/nobackup/ltakacs/bcs/Icarus-NLv3/Icarus-NLv3_Ostia/CF0720x6C_CF0720x6C/clsm OutData2/clsm

# STEP 1: regrid from CF360 to CF720
####################################

ln -s OutData1 OutData
mpiexec_mpt.nccs -np 56 bin/mk_CatchRestarts OutData/OutTilFile InData/InTilFile InData/InRestart 50 4

/bin/rm OutData

# STEP 2: read land parameters from BCS and update catch_internal_rst
#####################################################################

ln -s OutData2 OutData
mpiexec_mpt.nccs -np 1 bin/mk_CatchRestarts OutData/OutTilFile OutData1/OutTilFile OutData1/InRestart 50 4

/bin/rm OutData

# Step 3 Scale catch_internal_rst
#################################
# Below 26 and 13 are WEMIN values of input and output restart respectivelly.

bin/Scale_Catch OutData1/InRestart OutData2/InRestart catch_internal_rst 50 26 13


