Skip to content

Commit 671f4dc

Browse files
committed
Moved the codes copying USGS timeslices to the workin directory from the ABS nwm_forecast to the subclass nwm_analyais_assim. The USGS timeslices are only used by AnA and Extended AnA cycles.
1 parent f7a7e89 commit 671f4dc

2 files changed

Lines changed: 20 additions & 19 deletions

File tree

nwm.v4.0.0/ush/nwm-realtime/nwm_analysis_assim.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,26 @@ def move_outputs_to_storage(self) -> int:
487487
# ------------------------------------------------------------------ #
488488

489489
def runRTE(self) -> int:
490+
#
491+
# Copy USGS output timeslices
492+
#
493+
paths = self._paths()
494+
usgs_path = os.path.join(self.comout, "usgs_timeslices")
495+
working_usgs_path = os.path.join(paths.host_run_dir, "usgs_timeslices")
496+
if os.path.isdir( usgs_path ) and any(os.scandir(usgs_path)):
497+
shutil.copytree( usgs_path, working_usgs_path, dirs_exist_ok=True )
498+
else:
499+
print("WARNING: USGS timeslices does not exist or is empty! Skipping USGS data assimilation!")
500+
501+
# Copy the previous day USGS output timeslices
502+
if self.start_time.hour <= 6 or self.start_time.date() < self.t0.date():
503+
usgs_path = os.path.join(self.previous_day_comout, "usgs_timeslices")
504+
working_usgs_path = os.path.join(paths.host_run_dir, "usgs_timeslices")
505+
if os.path.isdir( usgs_path ) and any(os.scandir(usgs_path)):
506+
shutil.copytree( usgs_path, working_usgs_path, dirs_exist_ok=True )
507+
else:
508+
print("WARNING: Previous day USGS timeslices does not exist or is empty!")
509+
490510
case_type = self.case_type
491511
if case_type == "CONUS_ANALYSIS_ASSIM":
492512
# AnA 3h window split into 1h (run 1) + 2h (run 2).

nwm.v4.0.0/ush/nwm-realtime/nwm_forecast.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -385,25 +385,6 @@ def configureRTE(self) -> None:
385385
else:
386386
print("WARNING: Previous RFC Reservoir timeseries does not exist or is empty!")
387387

388-
#
389-
# Copy USGS output timeslices
390-
#
391-
usgs_path = os.path.join(self.comout, "usgs_timeslices")
392-
working_usgs_path = os.path.join(paths.host_run_dir, "usgs_timeslices")
393-
if os.path.isdir( usgs_path ) and any(os.scandir(usgs_path)):
394-
shutil.copytree( usgs_path, working_usgs_path, dirs_exist_ok=True )
395-
else:
396-
print("WARNING: USGS timeslices does not exist or is empty! Skipping USGS data assimilation!")
397-
398-
# Copy the previous day USGS output timeslices
399-
if self.start_time.hour <= 6 or self.start_time.date() < self.t0.date():
400-
usgs_path = os.path.join(self.previous_day_comout, "usgs_timeslices")
401-
working_usgs_path = os.path.join(paths.host_run_dir, "usgs_timeslices")
402-
if os.path.isdir( usgs_path ) and any(os.scandir(usgs_path)):
403-
shutil.copytree( usgs_path, working_usgs_path, dirs_exist_ok=True )
404-
else:
405-
print("WARNING: Previous day USGS timeslices does not exist or is empty!")
406-
407388
# ------------------------------------------------------------------ #
408389
# ecFlow / container helpers (shared by all configurations)
409390
# ------------------------------------------------------------------ #

0 commit comments

Comments
 (0)