Skip to content

Commit

Permalink
#41 generate hwrf for 00 hour if no data
Browse files Browse the repository at this point in the history
  • Loading branch information
webgisdeveloper committed Nov 12, 2022
1 parent 2cb84a7 commit 272bcb3
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion GFMS_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
from shapely.geometry import Point

from settings import *
from utilities import watersheds_gdb_reader, findLatest
from utilities import watersheds_gdb_reader, findLatest, hwrf_today
from GFMS_MoM import flood_severity
from HWRF_MoM import update_HWRF_MoM

# no need for cron-job
# from progressbar import progress
Expand Down Expand Up @@ -439,6 +440,21 @@ def GFMS_cron():
#processing_dates = ['2021120200']
GFMS_processing(processing_dates)

# check if today's date are generated
# if now hwrf data, then generate the output for 00 hour
hwrf_flag = hwrf_today()
if hwrf_flag:
return
# otherwise
today = date.today()
tstr = today.strftime("%Y%m%d")
tstr = tstr + "00"
gfmscsv = os.path.join(GFMS_SUM_DIR, "Flood_byStor_" + tstr + ".csv")
glofascsv = os.path.join(GLOFAS_DIR, "threspoints_" + tstr + ".csv")
if os.path.exists(gfmscsv) and os.path.exists(glofascsv):
logging.info("no hwrf: " + tstr + " generating ...")
update_HWRF_MoM(tstr)

def GFMS_fixdate(adate):
"""run cron job"""
# cron steup cd ~/ModelofModels/data && python datatool.py --cron
Expand Down

0 comments on commit 272bcb3

Please sign in to comment.