File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 2222from typing import Optional , Tuple
2323import sys
2424from datetime import datetime , UTC
25+ import glob
2526
2627import xarray as xr
2728from cmip7_prep .mapping_compat import Mapping
@@ -305,6 +306,9 @@ def main():
305306 INPUTDIR = os .path .join (inputroot , subdir , "hist" )
306307 TSDIR = Path (inputroot ).parent / "timeseries" / casename / subdir / "hist"
307308 native = latest_monthly_file (Path (INPUTDIR ))
309+ if native is None :
310+ print (f"No output files found in { INPUTDIR } " )
311+ sys .exit (0 )
308312 if TSDIR .exists ():
309313 timeseries = latest_monthly_file (TSDIR )
310314 if timeseries is not None :
@@ -365,6 +369,14 @@ def main():
365369 if args .skip_timeseries :
366370 print ("Skipping timeseries processing as per --skip-timeseries flag." )
367371 else :
372+ cnt = 0
373+ for include_pattern in include_patterns :
374+ cnt = cnt + len (glob .glob (os .path .join (input_head_dir , include_pattern )))
375+ if cnt == 0 :
376+ logger .warning (
377+ f"No input files to process in { input_head_dir } with { include_patterns } "
378+ )
379+ sys .exit (0 )
368380 hf_collection = HFCollection (input_head_dir , dask_client = client )
369381 for include_pattern in include_patterns :
370382 logger .info (f"Processing files with pattern: { include_pattern } " )
You can’t perform that action at this time.
0 commit comments