From 463442851a41f9c9fe01e87aaa57e5804c68d25c Mon Sep 17 00:00:00 2001 From: Jordan Laser Date: Tue, 28 Nov 2023 16:07:59 -0700 Subject: [PATCH] fix filename bug --- forcingprocessor/src/forcingprocessor/forcingprocessor.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/forcingprocessor/src/forcingprocessor/forcingprocessor.py b/forcingprocessor/src/forcingprocessor/forcingprocessor.py index f1d68e02..b085e559 100644 --- a/forcingprocessor/src/forcingprocessor/forcingprocessor.py +++ b/forcingprocessor/src/forcingprocessor/forcingprocessor.py @@ -598,10 +598,11 @@ 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] - if fs_s3 is None: - nwm_file_sizes = os.path.getsize(filename) - else: + if fs_s3: response = fs_s3.open(bucket_key, mode='rb') + else: + nwm_file_sizes = os.path.getsize(jfile) + nwm_file_sizes.append(response.details['size']) nwm_file_size_avg = np.average(nwm_file_sizes)