source: flex_extract.git/python/_config.py @ 5d42acd

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

working version of restructured usement of pathes with config file

  • Property mode set to 100644
File size: 3.6 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
30# ------------------------------------------------------------------------------
31# FILENAMES
32# ------------------------------------------------------------------------------
33
34FLEXEXTRACT_DIRNAME = 'flex_extract_v' + _VERSION_STR
35FILE_MARS_REQUESTS = 'mars_requests.dat'
36FORTRAN_EXECUTABLE = 'CONVERT2'
37FILE_USER_ENVVARS = 'ECMWF_ENV'
38TEMPFILE_INSTALL_COMPILEJOB = 'compilejob.temp'
39FILE_INSTALL_COMPILEJOB = 'compilejob.ksh'
40TEMPFILE_INSTALL_JOB = 'job.temp.o'
41TEMPFILE_JOB = 'job.temp'
42FILE_JOB_OD = 'job.ksh'
43FILE_JOB_OP = 'jopoper.ksh'
44FILE_NAMELIST = 'fort.4'
45FILE_GRIB_INDEX = 'date_time_stepRange.idx'
46
47# ------------------------------------------------------------------------------
48#  PATHES
49# ------------------------------------------------------------------------------
50
51# path to the flex_extract directory
52PATH_FLEXEXTRACT_DIR = os.path.normpath(os.path.dirname(os.path.abspath(
53    inspect.getfile(inspect.currentframe()))) + '/../')
54
55# path to the local python source files
56PATH_LOCAL_PYTHON = os.path.dirname(os.path.abspath(
57    inspect.getfile(inspect.currentframe())))
58PATH_RELATIVE_PYTHON = os.path.relpath(PATH_LOCAL_PYTHON, PATH_FLEXEXTRACT_DIR)
59# add path to pythonpath
60if PATH_LOCAL_PYTHON not in sys.path:
61    sys.path.append(PATH_LOCAL_PYTHON)
62
63# path to the templates
64PATH_TEMPLATES = os.path.join(PATH_FLEXEXTRACT_DIR, '_templates')
65PATH_RELATIVE_TEMPLATES = os.path.relpath(PATH_TEMPLATES, PATH_FLEXEXTRACT_DIR)
66
67# path to the environment parameter file
68PATH_ECMWF_ENV = os.path.join(PATH_LOCAL_PYTHON, FILE_USER_ENVVARS)
69PATH_RELATIVE_ECMWF_ENV = os.path.relpath(PATH_ECMWF_ENV, PATH_FLEXEXTRACT_DIR)
70
71# path to gribtable
72PATH_GRIBTABLE = os.path.join(PATH_TEMPLATES, 'ecmwf_grib1_table_128')
73
74# path to run directory
75PATH_RUN_DIR = os.path.join(PATH_FLEXEXTRACT_DIR, 'run')
76PATH_RELATIVE_RUN_DIR = os.path.relpath(PATH_RUN_DIR, PATH_FLEXEXTRACT_DIR)
77
78# path to directory where all control files are stored
79if os.getenv('CONTROL') and '/' in os.getenv('CONTROL'):
80    # this is only needed if remote version with job script is used!
81    # because job is directly submitted from SCRATCH and because the
82    # CONTROL file is stored there, the normal path is not valid.
83    PATH_CONTROLFILES = os.getenv('CONTROL')
84else:
85    PATH_CONTROLFILES = os.path.join(PATH_RUN_DIR, 'control')
86    PATH_RELATIVE_CONTROLFILES = os.path.relpath(PATH_CONTROLFILES, PATH_FLEXEXTRACT_DIR)
87
88# path to directory where all job scripts are stored
89PATH_JOBSCRIPTS = os.path.join(PATH_RUN_DIR, 'jobscripts')
90PATH_RELATIVE_JOBSCRIPTS = os.path.relpath(PATH_JOBSCRIPTS, PATH_FLEXEXTRACT_DIR)
91
92# path to the fortran executable and the source code
93PATH_FORTRAN_SRC = os.path.join(PATH_FLEXEXTRACT_DIR, 'src')
94PATH_RELATIVE_FORTRAN_SRC = os.path.relpath(PATH_FORTRAN_SRC, PATH_FLEXEXTRACT_DIR)
95
96# path to the python testing directory
97PATH_TEST_DIR = os.path.join(PATH_LOCAL_PYTHON, 'pythontest')
98
Note: See TracBrowser for help on using the repository browser.
hosted by ZAMG