@@ -234,10 +234,11 @@ def _driver():
234234 ens_num = int (args ['ens_num' ])
235235 print (f"[INFO] { fcst_init ['monthday' ]} { year } " )
236236
237+ fcst_init ["year" ] = year
237238 if fcst_init ['monthday' ] == "jan01" :
238- fcst_init ["year " ] = year - 1
239+ fcst_init ["year_cfsv2 " ] = year - 1
239240 else :
240- fcst_init ["year " ] = year
241+ fcst_init ["year_cfsv2 " ] = year
241242
242243 mmm = fcst_init ['monthday' ].split ("0" )[0 ].capitalize ()
243244 dt1 = datetime .strptime ('{} 1 {}' .format (mmm ,fcst_init ["year" ]), '%b %d %Y' )
@@ -246,8 +247,8 @@ def _driver():
246247 dt2 = np .datetime64 (dt2 .strftime ('%Y-%m-%d' ))
247248
248249 monthday = args ['all_monthdays' ][ens_num - 1 ]
249- temp_name = f"cfsv2.{ fcst_init ['year ' ]} { monthday } .nc"
250- fcst_init ['date' ] = f"{ fcst_init ['year ' ]} { monthday } "
250+ temp_name = f"cfsv2.{ fcst_init ['year_cfsv2 ' ]} { monthday } .nc"
251+ fcst_init ['date' ] = f"{ fcst_init ['year_cfsv2 ' ]} { monthday } "
251252 fcst_init ['month' ] = int (monthday [0 :2 ])
252253 fcst_init ['day' ] = int (monthday [2 :4 ])
253254 fcst_init ['hour' ] = args ['all_ensmembers' ][ens_num - 1 ]
@@ -272,23 +273,23 @@ def _driver():
272273 if not os .path .exists (outdirs ['outdir_monthly' ]):
273274 os .makedirs (outdirs ['outdir_monthly' ])
274275
275- cfsv2 = []
276+ cfsv2 = []
276277 for varname in ["prate" , "pressfc" , "tmp2m" , "dlwsfc" , "dswsfc" ,
277278 "q2m" , "wnd10m" ]:
278279 print (f"[INFO] { varname } " )
279280 subdir , file_pfx , file_sfx = \
280- _set_input_file_info (fcst_init ['year ' ],
281+ _set_input_file_info (fcst_init ['year_cfsv2 ' ],
281282 fcst_init ['month' ],
282283 varname )
283284 indir = f"{ args ['forcedir' ]} /{ subdir } /"
284285 if subdir == "Oper_TS" and not os .path .exists (indir ):
285286 indir = f"{ args ['forcedir' ]} /"
286-
287- indir += f"{ fcst_init ['year ' ]} /{ fcst_init ['date' ]} "
287+
288+ indir += f"{ fcst_init ['year_cfsv2 ' ]} /{ fcst_init ['date' ]} "
288289
289290 # Convert GRIB file to netCDF and handle missing/corrupted data
290291 cfsv2 .append (read_wgrib (indir , file_pfx , fcst_init ['timestring' ], file_sfx , outdirs ['outdir_6hourly' ], temp_name , varname , args ['patchdir' ]))
291-
292+
292293 cfsv2 = xr .merge (cfsv2 , compat = 'override' )
293294 reg_precip = _regrid_precip (cfsv2 , args )
294295 _migrate_to_monthly_files (cfsv2 .sel (step = (cfsv2 ['valid_time' ] >= dt1 ) &
0 commit comments