#!/bin/bash
#
# Sets environment for this experiment, also makes the scratch (S) and
# data (D) directories if not already present

#
#
# --- R is region name.
# --- V is source code version number.
# --- T is topography number.
# --- K is number of layers.
# --- E is expt number.
# --- P is primary path.
# --- D is permanent directory.
# --- S is scratch   directory, must not be the permanent directory.
#
# hycom executable will be retrieved from Build_V${V}_X${X}. ex: Build_V2.2.12_X01.0
#

unset -v X E T V K P D S
X="01.0"                                                         # X based on dir name (expt_$X)
E="010"                                                          # E is X without "."
T="01"                                                           # Topography version
export V=2.2.12                                                  # hycom version              
export K=`grep "'kdm   ' =" blk* | awk '{printf("%03d", $1)}'`   # get kdm from blkdat
export P=$(pwd)                                                  #  ---""---
export D=$P/data                                                 # Where data ends up
export S=$P/SCRATCH                                              # Scratch area 
