#!/bin/ksh

# **************************** LICENSE START ***********************************
#
# Copyright 2014 ECMWF and INPE. This software is distributed under the terms
# of the Apache License version 2.0. In applying this license, ECMWF does not
# waive the privileges and immunities granted to it by virtue of its status as
# an Intergovernmental Organization or submit itself to any jurisdiction.
#
# ***************************** LICENSE END ************************************


# -----------------------------------------
# ECMWF extras for setting MARS environment
# -----------------------------------------

export METAPS=$MARS_HOME # required for ppdir.sh

#-- for xtra safety --
unset FDB_SERVER_HOST || true

export MARS_AUTH_FILE=$MARS_HOME/etc/mars.authentication
export MARS_IBM_RULES=$MARS_HOME/chk/ibm.chk

#if [ $METV_DEV = no ]
#then
   export MARS_LANGUAGE_FILE=$MARS_HOME/etc/mars.def
   export MARS_TEST_FILE=$MARS_HOME/chk/mars.chk
#   export MARS_LANGUAGE_FILE=$METVIEW_DIR_SHARE/etc/MarsDef
#   export MARS_TEST_FILE=$METVIEW_DIR_SHARE/etc/MarsRules
#else
#   export MARS_LANGUAGE_FILE=$METVIEW_DIR_SHARE/etc/MarsDef
#   export MARS_TEST_FILE=$METVIEW_DIR_SHARE/etc/MarsRules

#   MARSOLD_LANGUAGE_FILE=/usr/local/lib/MARS_HOME/etc/mars.def
#   MARSOLD_TEST_FILE=/usr/local/lib/MARS_HOME/chk/mars.chk
#fi

export MARS_CFG_FILE=$MARS_HOME/etc/mars.cfg
export MARS_EMS_FILE=$MARS_HOME/etc/ems_cache_prod
export MARS_ACCOUNT_FILE=$MARS_HOME/etc/account
export MARS_DISSEMINATION_SCHEDULE_FILE=$MARS_HOME/etc/mars.dissemination.schedule
export MARS_EMS_ACCOUNTS_FILE=$MARS_HOME/etc/ems_ecaccount_prod


#-- for Lagrandian coeffiecient files --
export PPDIR=${PPDIR=`$MARS_HOME/bin/ppdir.sh`}

#-- for MARS statistics --
export STAT_PREFIX=metview
. $MARS_HOME/bin/marsstat.sh

#-- MARS home directory for user --
. $MARS_HOME/bin/mars_user_home

#-- how frequent MARS sends warning e-mails --
export MARS_MAIL_FREQUENCY=${MARS_MAIL_FREQUENCY:=86400}

export MARS_DHSBASE_CHECK=$MARS_HOME/chk/dhs.chk

#-- final solution from Manuel 000615/29 --
. $MARS_HOME/bin/mars.environment

#-- Choose interpolation configuration (040913) --
#-- -- moved inside 'mars.environment' (050308) --
#-- config_interp=$($MARS_HOME/bin/select_interpolation_mode)
#-- CONFIG_INTERP=${CONFIG_INTERP:=$config_interp}
