From b7533f53334cf2437fa3f049cb183f7d4143d8f7 Mon Sep 17 00:00:00 2001 From: Ashley Barnes <53282288+ashjbarnes@users.noreply.github.com> Date: Mon, 9 Feb 2026 15:47:40 +1100 Subject: [PATCH 1/2] Error handling when user can't access BARRA files Currently the error thrown if a user isn't yet on ob53 is cryptic, and not obviously a `file not found` issue. This explicitly tells the user what's wrong if the `barra_files` list is empty --- src/replace_landsurface/replace_landsurface_with_BARRA2R_IC.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/replace_landsurface/replace_landsurface_with_BARRA2R_IC.py b/src/replace_landsurface/replace_landsurface_with_BARRA2R_IC.py index a420754..0c5af9f 100755 --- a/src/replace_landsurface/replace_landsurface_with_BARRA2R_IC.py +++ b/src/replace_landsurface/replace_landsurface_with_BARRA2R_IC.py @@ -201,6 +201,8 @@ def swap_land_barra(mask_fullpath, ec_cb_file_fullpath, ic_date): BARRA_FIELDN = 'ts' indir = os.path.join(BARRA_DIR, '1hr',BARRA_FIELDN, 'latest') barra_files = glob(os.path.join(indir, BARRA_FIELDN + '*' + yyyy + mm + '*nc')) + if not barra_files: + raise ImportError("BARRA files not found. This most likely means you're not a member of the ob53 group.") barra_fname = indir + '/' + barra_files[0].split('/')[-1] # Work out the grid bounds using the surface temperature file From 96ee7ea5c472ad87de3346ec0cb09299ff93dcfc Mon Sep 17 00:00:00 2001 From: Ashley Barnes <53282288+ashjbarnes@users.noreply.github.com> Date: Mon, 7 Sep 2026 15:16:41 +1000 Subject: [PATCH 2/2] Update src/replace_landsurface/replace_landsurface_with_BARRA2R_IC.py Co-authored-by: Davide Marchegiani --- src/replace_landsurface/replace_landsurface_with_BARRA2R_IC.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/replace_landsurface/replace_landsurface_with_BARRA2R_IC.py b/src/replace_landsurface/replace_landsurface_with_BARRA2R_IC.py index 0c5af9f..d845c0a 100755 --- a/src/replace_landsurface/replace_landsurface_with_BARRA2R_IC.py +++ b/src/replace_landsurface/replace_landsurface_with_BARRA2R_IC.py @@ -202,7 +202,7 @@ def swap_land_barra(mask_fullpath, ec_cb_file_fullpath, ic_date): indir = os.path.join(BARRA_DIR, '1hr',BARRA_FIELDN, 'latest') barra_files = glob(os.path.join(indir, BARRA_FIELDN + '*' + yyyy + mm + '*nc')) if not barra_files: - raise ImportError("BARRA files not found. This most likely means you're not a member of the ob53 group.") + raise FileNotFoundError("BARRA files not found. This most likely means you're not a member of the ob53 group.") barra_fname = indir + '/' + barra_files[0].split('/')[-1] # Work out the grid bounds using the surface temperature file