@@ -182,11 +182,15 @@ def process_one_var(
182182 parallel = True ,
183183 open_kwargs = open_kwargs ,
184184 )
185+
185186 # Append ocn_fx_fields to ds_native if available
186187 if realm == "ocn" and ocn_fx_fields is not None :
187188 ds_native = ds_native .merge (ocn_fx_fields )
188- logger .info (
189- f"ds_native keys: { list (ds_native .keys ())} for var { varname } with dims { dims } "
189+ logger .debug (
190+ "ds_native keys: %s for var %s with dims %s" ,
191+ list (ds_native .keys ()),
192+ varname ,
193+ dims ,
190194 )
191195 if var is None :
192196 logger .warning (f"Source variable(s) not found for { varname } " )
@@ -215,8 +219,9 @@ def _extract_array(val):
215219 )
216220 else :
217221 # For lnd/atm or any other dims, use existing logic
218- logger .info (f"Processing { varname } for dims { dims } (atm/lnd or other)" )
219- sftlf_path = next (Path (outdir ).rglob ("sftlf_fx_*.nc" ), None )
222+ logger .debug (
223+ "Processing %s for dims %s (atm/lnd or other)" , varname , dims
224+ )
220225 ds_cmor = realize_regrid_prepare (
221226 mapping ,
222227 ds_native ,
@@ -232,12 +237,14 @@ def _extract_array(val):
232237 )
233238 except Exception as e :
234239 logger .error (
235- f"Exception during regridding of { varname } with dims { dims } : { e !r} "
240+ "Exception during regridding of %s with dims %s: %r" ,
241+ varname ,
242+ dims ,
243+ e ,
236244 )
237245 continue
238246 try :
239247 # CMORize
240- logger .info (f"CMOR writing for { varname } with dims { dims } " )
241248 log_dir = outdir + "/logs"
242249 with CmorSession (
243250 tables_path = tables_path ,
@@ -262,7 +269,9 @@ def _extract_array(val):
262269 "levels" : cfg .get ("levels" , None ),
263270 },
264271 )()
265- logger .info (f"Writing variable { varname } with dims { dims } " )
272+ logger .info (
273+ f"Writing variable { varname } with dims { dims } and type { ds_cmor [varname ].dtype } "
274+ )
266275 cm .write_variable (ds_cmor , varname , vdef )
267276 logger .info (f"Finished processing for { varname } with dims { dims } " )
268277 results .append ((varname , "ok" ))
@@ -428,7 +437,7 @@ def main():
428437 sys .exit (0 )
429438 hf_collection = HFCollection (input_head_dir , dask_client = client )
430439 for include_pattern in include_patterns :
431- logger .info (f "Processing files with pattern: { include_pattern } " )
440+ logger .info ("Processing files with pattern: %s" , include_pattern )
432441 hfp_collection = hf_collection .include_patterns ([include_pattern ])
433442 hfp_collection .pull_metadata ()
434443 ts_collection = TSCollection (
@@ -491,13 +500,26 @@ def main():
491500 results = []
492501 for _ , result in as_completed (futures , with_results = True ):
493502 try :
494- results .append (result ) # (v, status)
503+ # Handle result types: list of tuples, tuple, or other
504+ if isinstance (result , list ):
505+ # If it's a list, check if it's a list of tuples
506+ if all (isinstance (x , tuple ) and len (x ) == 2 for x in result ):
507+ results .extend (result )
508+ else :
509+ # Not a list of tuples, wrap as unknown
510+ results .append ((str (result ), "unknown" ))
511+ elif isinstance (result , tuple ) and len (result ) == 2 :
512+ results .append (result )
513+ else :
514+ # Not a tuple/list, wrap as unknown
515+ results .append ((str (result ), "unknown" ))
495516 except Exception as e :
496517 logger .error ("Task error:" , e )
497518 raise
498519
499520 for v , status in results :
500521 logger .info (f"Variable { v } processed with status: { status } " )
522+
501523 else :
502524 logger .info ("No results to process." )
503525 if client :
0 commit comments