From ffa03027cb3edd1b8d54aab2e890743aaf38f4c3 Mon Sep 17 00:00:00 2001 From: Jordan Laser Date: Tue, 28 Nov 2023 15:49:25 -0700 Subject: [PATCH] fix local nwm file size read --- forcingprocessor/src/forcingprocessor/forcingprocessor.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/forcingprocessor/src/forcingprocessor/forcingprocessor.py b/forcingprocessor/src/forcingprocessor/forcingprocessor.py index 439c7c1b..f1d68e02 100644 --- a/forcingprocessor/src/forcingprocessor/forcingprocessor.py +++ b/forcingprocessor/src/forcingprocessor/forcingprocessor.py @@ -598,7 +598,10 @@ def prep_ngen_data(conf): if j > 10: break _nc_file_parts = jfile.split('/') bucket_key = "noaa-nwm-pds/" + _nc_file_parts[-3] + '/' + _nc_file_parts[-2] + '/' + _nc_file_parts[-1] - response = fs_s3.open(bucket_key, mode='rb') + if fs_s3 is None: + nwm_file_sizes = os.path.getsize(filename) + else: + response = fs_s3.open(bucket_key, mode='rb') nwm_file_sizes.append(response.details['size']) nwm_file_size_avg = np.average(nwm_file_sizes)