Skip to content

Commit

Permalink
Github Issue #332. Merge branch 'feature_332_refactor_series_lead' in…
Browse files Browse the repository at this point in the history
…to develop
  • Loading branch information
bikegeek committed Dec 11, 2019
2 parents 460101c + 5beecf7 commit 9a4d5fa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 25 deletions.
6 changes: 2 additions & 4 deletions ush/extract_tiles_wrapper.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/usr/bin/env python

"""
Program Name: ExtractTiles.py
Contact(s): Julie Prestopnik, Minna Win
Program Name: extract_tiles_wrapper.py
Contact(s): Julie Prestopnik, Minna Win, George McCabe, Jim Frimel
Abstract: Extracts tiles to be used by series_analysis
History Log: Initial version
Usage: ExtractTiles.py
Parameters: None
Input Files: tc_pairs data
Output Files: tiled grib2 files
Expand Down
27 changes: 6 additions & 21 deletions ush/series_by_lead_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -1233,23 +1233,7 @@ def create_animated_gifs(self, do_fhr_by_range):
level, '_', cur_stat, '.gif']
animate_cmd = ''.join(gif_parts)
self.logger.debug("animate cmd: {}".format(animate_cmd))
# TODO:
# Fix animate_cmd so it does not require run_inshell
# to work.
# It is working as is, ideally we do not require
# run_inshell
# The issue has to do with multiple files in the directory
# when using the wild card. If only one file exists
# then the command will run ok without run_inshell.
# You can repeat the issue
# by removing run_inshell keyword in the call below and
# running examples/series_by_lead_all_fhrs.conf use case.
# no animated gifs are created.
# convert: unable to open image
# .... No such file or directory
# @ error/blob.c/OpenBlob/2712.
# convert: unable to open file
# convert: no images defined


(ret, animate_cmd) = self.cmdrunner.run_cmd\
(animate_cmd, env=None, ismetcmd=False,
Expand Down Expand Up @@ -1313,9 +1297,8 @@ def apply_series_filters(self, tile_dir, init_times, series_output_dir,
cur_function = sys._getframe().f_code.co_name

# Create temporary directory where intermediate files are saved.
cur_pid = str(os.getpid())
tmp_dir = os.path.join(temporary_dir, cur_pid)
self.logger.debug("creating tmp dir: " + tmp_dir)
tmp_dir = temporary_dir
self.logger.debug("creating tmp dir for filter files: " + tmp_dir)
util.mkdir_p(tmp_dir)

for cur_init in init_times:
Expand Down Expand Up @@ -1383,8 +1366,10 @@ def apply_series_filters(self, tile_dir, init_times, series_output_dir,
# series analysis.
util.prune_empty(series_output_dir, self.logger)

# Clean up the tmp dir
# Clean up the tmp dir and create an empty one
# in anticipation of another run.
util.rmtree(tmp_dir)
util.mkdir_p(tmp_dir)

if __name__ == "__main__":
util.run_stand_alone("series_by_lead_wrapper", "SeriesByLead")

0 comments on commit 9a4d5fa

Please sign in to comment.