source: flex_extract.git/source/python/_config.py @ 70fee58

ctbtodev
Last change on this file since 70fee58 was 70fee58, checked in by Anne Philipp <anne.philipp@…>, 6 years ago

some bug corrections, minor code improvements

  • Property mode set to 100644
File size: 4.0 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3#*******************************************************************************
4# @Author: Anne Philipp (University of Vienna)
5#
6# @Date: August 2018
7#
8# @Change History:
9#
10# @License:
11#    (C) Copyright 2014-2018.
12#
13#    This software is licensed under the terms of the Apache Licence Version 2.0
14#    which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
15#
16# @Description:
17#    Contains constant value parameter for flex_extract.
18#
19#*******************************************************************************
20
21# ------------------------------------------------------------------------------
22# MODULES
23# ------------------------------------------------------------------------------
24import os
25import sys
26import inspect
27
28_VERSION_STR = '7.1'
29
30QUEUES_LIST = ['ecgate', 'cca']
31
32# ------------------------------------------------------------------------------
33# FILENAMES
34# ------------------------------------------------------------------------------
35
36FILE_MARS_REQUESTS = 'mars_requests.csv'
37FORTRAN_EXECUTABLE = 'CONVERT2'
38TEMPFILE_USER_ENVVARS = 'ECMWF_ENV.template'
39FILE_USER_ENVVARS = 'ECMWF_ENV'
40TEMPFILE_INSTALL_COMPILEJOB = 'compilejob.template'
41FILE_INSTALL_COMPILEJOB = 'compilejob.ksh'
42TEMPFILE_INSTALL_JOB = 'job.template'
43TEMPFILE_JOB = 'job.temp'
44FILE_JOB_OD = 'job.ksh'
45FILE_JOB_OP = 'jopoper.ksh'
46TEMPFILE_NAMELIST = 'convert.nl'
47FILE_NAMELIST = 'fort.4'
48FILE_GRIB_INDEX = 'date_time_stepRange.idx'
49FILE_GRIBTABLE = 'ecmwf_grib1_table_128'
50
51# ------------------------------------------------------------------------------
52# DIRECTORY NAMES
53# ------------------------------------------------------------------------------
54
55FLEXEXTRACT_DIRNAME = 'flex_extract_v' + _VERSION_STR
56INPUT_DIRNAME_DEFAULT = 'workspace'
57
58# ------------------------------------------------------------------------------
59#  PATHES
60# ------------------------------------------------------------------------------
61
62# path to the local python source files
63# first thing to get because the submitted python script starts in here
64PATH_LOCAL_PYTHON = os.path.dirname(os.path.abspath(
65    inspect.getfile(inspect.currentframe())))
66# add path to pythonpath
67if PATH_LOCAL_PYTHON not in sys.path:
68    sys.path.append(PATH_LOCAL_PYTHON)
69PATH_FLEXEXTRACT_DIR = os.path.normpath(os.path.dirname(os.path.abspath(
70    inspect.getfile(inspect.currentframe()))) + '/../../')
71PATH_RUN_DIR = os.path.join(PATH_FLEXEXTRACT_DIR, 'run')
72PATH_SOURCES = os.path.join(PATH_FLEXEXTRACT_DIR, 'source')
73PATH_TEMPLATES = os.path.join(PATH_FLEXEXTRACT_DIR, 'templates')
74PATH_ECMWF_ENV = os.path.join(PATH_RUN_DIR, FILE_USER_ENVVARS)
75PATH_GRIBTABLE = os.path.join(PATH_TEMPLATES, FILE_GRIBTABLE)
76PATH_JOBSCRIPTS = os.path.join(PATH_RUN_DIR, 'jobscripts')
77PATH_FORTRAN_SRC = os.path.join(PATH_SOURCES, 'fortran')
78PATH_TEST_DIR = os.path.join(PATH_SOURCES, 'pythontest')
79PATH_INPUT_DIR = os.path.join(PATH_RUN_DIR, INPUT_DIRNAME_DEFAULT)
80if os.getenv('CONTROL'):# and '/' in os.getenv('CONTROL'):
81    # this is only needed if remote version with job script is used!
82    # because job is directly submitted from SCRATCH and because the
83    # CONTROL file is stored there, the normal path is not valid.
84    PATH_CONTROLFILES = '.'
85else:
86    PATH_CONTROLFILES = os.path.join(PATH_RUN_DIR, 'control')
87#
88# ------------------------------------------------------------------------------
89# for making the installation tar ball, the relative pathes to the
90# flex_extract root directory are needed
91# ------------------------------------------------------------------------------
92
93PATH_REL_PYTHON = os.path.relpath(PATH_LOCAL_PYTHON, PATH_FLEXEXTRACT_DIR)
94PATH_REL_CONTROLFILES = os.path.relpath(PATH_CONTROLFILES, PATH_FLEXEXTRACT_DIR)
95PATH_REL_TEMPLATES = os.path.relpath(PATH_TEMPLATES, PATH_FLEXEXTRACT_DIR)
96PATH_REL_ECMWF_ENV = os.path.relpath(PATH_ECMWF_ENV, PATH_FLEXEXTRACT_DIR)
97PATH_REL_RUN_DIR = os.path.relpath(PATH_RUN_DIR, PATH_FLEXEXTRACT_DIR)
98PATH_REL_JOBSCRIPTS = os.path.relpath(PATH_JOBSCRIPTS, PATH_FLEXEXTRACT_DIR)
99PATH_REL_FORTRAN_SRC = os.path.relpath(PATH_FORTRAN_SRC, PATH_FLEXEXTRACT_DIR)
Note: See TracBrowser for help on using the repository browser.
hosted by ZAMG