Skip to content

Commit

Permalink
Merge pull request #22 from alavin87/bug_save_wps
Browse files Browse the repository at this point in the history
Bug save wps
  • Loading branch information
cofinoa authored Aug 29, 2018
2 parents 7fee890 + 41b2fee commit 767a26d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/python/wrf4g/utils/namelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ def get_latlon_dx(start_date, dom):
file_name = "met_em.%s.%s.nc" % ( dom, datetime2datewrf( start_date ) )
if exists( file_name ) :
dxfile = file_name
file_name = "wrfinput_%s" % dom
if exists( file_name ) :
logging.info("Reading dx from %s" % file_name)
else:
file_name = "wrfinput_%s" % dom
dxfile = file_name
logging.info("Reading dx from %s" % file_name)
if dxfile:
shcmd = "ncdump -h %s | grep 'DX =' | sed -e 's/^\t//' | tr '=;' ' ' | awk '{printf \"%%f\", $2}'" % dxfile
rval = round(float(os.popen(shcmd).read().strip()), 4)
Expand Down
4 changes: 3 additions & 1 deletion lib/python/wrf4g/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ def launch_wrapper( params ):
except :
raise JobError( "'namelist.wps' has not copied", Job.CodeError.COPY_FILE )
job_db.set_job_status( Job.Status.DOWN_WPS )
pattern = "wrf[lbif]*_d\d\d_" + datetime2dateiso( sdate ) + "*"
pattern = "wrf[lbif]*_d\d\d_" + datetime2dateiso( params.chunk_sdate ) + "*"
for file_name in VCPURL( params.real_rea_output_path ).ls( pattern ):
orig = join( params.real_rea_output_path, file_name )
# From wrflowinp_d08_ we remove the _ at the end
Expand All @@ -700,6 +700,8 @@ def launch_wrapper( params ):
copy_file( orig, dest )
except :
raise JobError( "'%s' has not copied" % file_name, Job.CodeError.COPY_REAL_FILE )
# Change the directory to wrf run path
os.chdir( params.wrf_run_path )
wps2wrf( params.namelist_wps, params.namelist_input, params.chunk_rdate,
params.chunk_edate, params.max_dom, chunk_rerun, params.timestep_dxfactor)
except :
Expand Down

0 comments on commit 767a26d

Please sign in to comment.