File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ def get_mvr_coeff(
3131 c_list = get_coeff_list (site , prefix , coeff_files )
3232
3333 coeff : dict = {}
34- if len (c_list ) != 1 :
34+ if len (c_list ) == 0 :
3535 return coeff
3636
3737 if (str (c_list [0 ][- 3 :]).lower () == "ret" ) and (len (c_list ) == 1 ):
Original file line number Diff line number Diff line change @@ -279,8 +279,8 @@ def get_coeff_list(
279279 site : str | None , prefix : str , coeff_files : Sequence [str | PathLike ] | None
280280) -> list [str ]:
281281 """Returns list of .ret or .nc coefficient file(s)."""
282+ c_list = []
282283 if coeff_files is not None :
283- c_list = []
284284 for file in coeff_files :
285285 basename = os .path .basename (file )
286286 if f"{ prefix .lower ()} _" in basename .lower ():
@@ -291,27 +291,28 @@ def get_coeff_list(
291291 assert isinstance (site , str )
292292 dir_path = os .path .dirname (os .path .realpath (__file__ ))
293293 for suf in (".nc" , ".ret" ):
294- c_list = glob .glob (
295- dir_path
296- + "/site_config/"
297- + site
298- + "/coefficients/"
299- + "*"
300- + prefix .lower ()
301- + "*"
302- + suf
303- )
304294 if len (c_list ) == 0 :
305295 c_list = glob .glob (
306296 dir_path
307297 + "/site_config/"
308298 + site
309299 + "/coefficients/"
310300 + "*"
311- + prefix .upper ()
301+ + prefix .lower ()
312302 + "*"
313303 + suf
314304 )
305+ if len (c_list ) == 0 :
306+ c_list = glob .glob (
307+ dir_path
308+ + "/site_config/"
309+ + site
310+ + "/coefficients/"
311+ + "*"
312+ + prefix .upper ()
313+ + "*"
314+ + suf
315+ )
315316
316317 if len (c_list ) > 0 :
317318 return sorted (c_list )
You can’t perform that action at this time.
0 commit comments