From ec09be0cddc75a201b1ab298667a9f84644eaf58 Mon Sep 17 00:00:00 2001 From: Panu Lahtinen Date: Wed, 13 Mar 2024 14:32:57 +0200 Subject: [PATCH] Fix instrument name reading from attributes --- satpy/readers/viirs_l2.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/satpy/readers/viirs_l2.py b/satpy/readers/viirs_l2.py index 9277620320..5399e4c883 100644 --- a/satpy/readers/viirs_l2.py +++ b/satpy/readers/viirs_l2.py @@ -70,7 +70,13 @@ def platform_name(self): @property def sensor_name(self): """Get sensor name.""" - return self["/attr/instrument"].lower() + try: + # Until v3r0 (or v3r1) + instrument = self["/attr/instrument_name"].lower() + except KeyError: + # Changed in ASCI v3r1 or v3r2 + instrument = self["/attr/instrument"].lower() + return instrument def _get_dataset_file_units(self, ds_info, var_path): file_units = ds_info.get("units")