Skip to content

Commit

Permalink
Ungrib links in the data files.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomas Barton committed Nov 1, 2017
1 parent fcb6307 commit ab52f61
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/wrf_runner/ungrib.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ async def run(self):

try:

try:
pattern = self.config['metdata_pattern']
except KeyError:
self.logger.error('`key_error` is missing in the config file.')
return False

self.logger.info(
f'Linking in the metdata using pattern `{pattern}`.')
link_grib(pattern)

self.logger.info('Processing the configuration file...')

# Generate the config file and save it
Expand All @@ -79,7 +89,7 @@ async def run(self):
return_code = await self.program.run()
finally:
os.chdir(cwd)

# Evaluate the result
return self.state_machine.state == 'done' and return_code == 0

Expand Down Expand Up @@ -120,7 +130,7 @@ def link_grib(path_pattern):
os.remove(link)

# Get the new files
if len(path_pattern) == 1:
if isinstance(path_pattern, str):
new_files = glob.glob(path_pattern)
else:
new_files = path_pattern
Expand Down

0 comments on commit ab52f61

Please sign in to comment.