diff --git a/gridded_glm/libexec/gridded_glm/_minute_gridder.py b/gridded_glm/libexec/gridded_glm/_minute_gridder.py index 4e9cabd8924b4b391712b91057cbc2e0f2b46738..295d64c72cc47471a6a1c049310d188438131f4b 100644 --- a/gridded_glm/libexec/gridded_glm/_minute_gridder.py +++ b/gridded_glm/libexec/gridded_glm/_minute_gridder.py @@ -65,6 +65,9 @@ warnings.filterwarnings("ignore") import dask dask.config.set(num_workers=1) +GOES_SAT_POSITIONS={'G16': 'east', 'G17': 'west', 'G18': 'west', 'G19': 'east',} + + def create_parser(): def bounded_float(afloat, inclusive_min, inclusive_max): value = float(afloat) @@ -118,12 +121,11 @@ def get_resolution(args): # if provided "auto" position, we determine the sensor from the filename def get_goes_position(filenames): - if all("_G16_" in f for f in filenames): - return "east" - if all("_G17_" in f for f in filenames): - return "west" - if all("_G18_" in f for f in filenames): - return "west" + +#Check that all files are the same sat + for key, value in GOES_SAT_POSITIONS.items(): + if all(f"_{key}_" in f for f in filenames): + return value # we require that all files are from the same sensor and raise an exception if not raise ValueError("could not determine GOES position - did you provide a mix of satellites?") @@ -484,4 +486,4 @@ def main(): return 0 if __name__ == '__main__': - sys.exit(main()) \ No newline at end of file + sys.exit(main())