Skip to content
Snippets Groups Projects
Commit 295ff45a authored by Anne Philipp's avatar Anne Philipp
Browse files

added request output option also for basetime requests; changed output to csv format

parent 7b4e39e7
No related branches found
No related tags found
No related merge requests found
...@@ -31,7 +31,7 @@ _VERSION_STR = '7.1' ...@@ -31,7 +31,7 @@ _VERSION_STR = '7.1'
# FILENAMES # FILENAMES
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
FILE_MARS_REQUESTS = 'mars_requests.dat' FILE_MARS_REQUESTS = 'mars_requests.csv'
FORTRAN_EXECUTABLE = 'CONVERT2' FORTRAN_EXECUTABLE = 'CONVERT2'
FILE_USER_ENVVARS = 'ECMWF_ENV' FILE_USER_ENVVARS = 'ECMWF_ENV'
TEMPFILE_INSTALL_COMPILEJOB = 'compilejob.temp' TEMPFILE_INSTALL_COMPILEJOB = 'compilejob.temp'
......
This diff is collapsed.
...@@ -334,7 +334,7 @@ class MarsRetrieval(object): ...@@ -334,7 +334,7 @@ class MarsRetrieval(object):
return return
def print_info(self, inputdir): def print_info(self, inputdir, request_number):
''' '''
@Description: @Description:
Prints all mars requests to an extra file for debugging and Prints all mars requests to an extra file for debugging and
...@@ -347,7 +347,10 @@ class MarsRetrieval(object): ...@@ -347,7 +347,10 @@ class MarsRetrieval(object):
inputdir: string inputdir: string
The path where all data from the retrievals are stored. The path where all data from the retrievals are stored.
@Return: request_number: integer
Number of mars requests for flux and non-flux data.
@Return:
<nothing> <nothing>
''' '''
# Get all class attributes and their values as a dictionary # Get all class attributes and their values as a dictionary
...@@ -356,7 +359,7 @@ class MarsRetrieval(object): ...@@ -356,7 +359,7 @@ class MarsRetrieval(object):
# open a file to store all requests to # open a file to store all requests to
with open(os.path.join(inputdir, with open(os.path.join(inputdir,
_config.FILE_MARS_REQUESTS), 'a') as f: _config.FILE_MARS_REQUESTS), 'a') as f:
f.write('mars\n') f.write('mars_request #' + str(request_number) + '\n')
# iterate through all attributes and print them # iterate through all attributes and print them
# with their corresponding values # with their corresponding values
for item in attrs.items(): for item in attrs.items():
...@@ -368,6 +371,40 @@ class MarsRetrieval(object): ...@@ -368,6 +371,40 @@ class MarsRetrieval(object):
return return
def print_infodata_csv(self, inputdir, request_number):
'''
@Description:
Write all request parameter in alpabetical order into a "csv" file.
@Input:
self: instance of MarsRetrieval
For description see class documentation.
inputdir: string
The path where all data from the retrievals are stored.
request_number: integer
Number of mars requests for flux and non-flux data.
@Return:
<nothing>
'''
# Get all class attributes and their values as a dictionary
attrs = vars(self)
del attrs['server']
# open a file to store all requests to
with open(os.path.join(inputdir,
_config.FILE_MARS_REQUESTS), 'a') as f:
f.write(str(request_number) + ', ')
f.write(', '.join(str(attrs[key])
for key in sorted(attrs.iterkeys())))
f.write('\n')
return
def data_retrieve(self): def data_retrieve(self):
''' '''
@Description: @Description:
......
...@@ -66,7 +66,8 @@ from classes.UioFiles import UioFiles ...@@ -66,7 +66,8 @@ from classes.UioFiles import UioFiles
def main(): def main():
''' '''
@Description: @Description:
If get_mars_data is called from command line, this function controls If get_mars_data is called directly from command line,
the program flow and calls the argumentparser function and the program flow and calls the argumentparser function and
the get_mars_data function for retrieving EC data. the get_mars_data function for retrieving EC data.
...@@ -81,7 +82,7 @@ def main(): ...@@ -81,7 +82,7 @@ def main():
c = ControlFile(args.controlfile) c = ControlFile(args.controlfile)
env_parameter = read_ecenv(_config.PATH_ECMWF_ENV) env_parameter = read_ecenv(_config.PATH_ECMWF_ENV)
c.assign_args_to_control(args, env_parameter) c.assign_args_to_control(args)
c.assign_envs_to_control(env_parameter) c.assign_envs_to_control(env_parameter)
c.check_conditions(args.queue) c.check_conditions(args.queue)
......
...@@ -91,9 +91,10 @@ def main(): ...@@ -91,9 +91,10 @@ def main():
c = ControlFile(args.controlfile) c = ControlFile(args.controlfile)
env_parameter = read_ecenv(_config.PATH_ECMWF_ENV) env_parameter = read_ecenv(_config.PATH_ECMWF_ENV)
c.assign_args_to_control(args, env_parameter) c.assign_args_to_control(args)
c.assign_envs_to_control(env_parameter) c.assign_envs_to_control(env_parameter)
c.check_conditions(args.queue) c.check_conditions(args.queue)
prepare_flexpart(args.ppid, c) prepare_flexpart(args.ppid, c)
return return
......
...@@ -86,7 +86,7 @@ def main(): ...@@ -86,7 +86,7 @@ def main():
# on local side # on local side
# on ECMWF server this would also be the local side # on ECMWF server this would also be the local side
called_from_dir = os.getcwd() called_from_dir = os.getcwd()
if not args.queue: if args.queue is None:
if c.inputdir[0] != '/': if c.inputdir[0] != '/':
c.inputdir = os.path.join(called_from_dir, c.inputdir) c.inputdir = os.path.join(called_from_dir, c.inputdir)
if c.outputdir[0] != '/': if c.outputdir[0] != '/':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment