diff --git a/satpy/readers/li_base_nc.py b/satpy/readers/li_base_nc.py index cefbcc7e55..1d1e56a850 100644 --- a/satpy/readers/li_base_nc.py +++ b/satpy/readers/li_base_nc.py @@ -439,11 +439,12 @@ def get_measured_variable(self, var_paths, fill_value=np.nan): # Also handle fill value here (but only if it is not None, so that we can still bypass this # step if needed) arr = self.apply_fill_value(arr, fill_value) - return arr def apply_fill_value(self, arr, fill_value): - """Apply fill values, unless it is None.""" + """Apply fill values, unless it is None and when _FillValue is provided.""" + if arr.attrs.get("_FillValue") is None: + return arr if fill_value is not None: if np.isnan(fill_value): fill_value = np.float32(np.nan) diff --git a/satpy/tests/reader_tests/test_li_l2_nc.py b/satpy/tests/reader_tests/test_li_l2_nc.py index 36cc930683..04f11acf4c 100644 --- a/satpy/tests/reader_tests/test_li_l2_nc.py +++ b/satpy/tests/reader_tests/test_li_l2_nc.py @@ -601,7 +601,6 @@ def test_coords_generation(self, filetype_infos): products = ["li_l2_af_nc", "li_l2_afr_nc", "li_l2_afa_nc"] - for prod in products: handler = LIL2NCFileHandler("filename", {}, extract_filetype_info(filetype_infos, prod)) @@ -611,7 +610,6 @@ def test_coords_generation(self, filetype_infos): elevation = handler.get_measured_variable(handler.swath_coordinates["elevation"]) elevation = handler.apply_use_rescaling(elevation) - # Initialize proj_dict proj_var = handler.swath_coordinates["projection"] geos_proj = handler.get_measured_variable(proj_var, fill_value=None) @@ -634,9 +632,6 @@ def test_coords_generation(self, filetype_infos): elevation_vals = elevation.values * point_height azimuth_vals *= -1 lon_ref, lat_ref = projection(azimuth_vals, elevation_vals, inverse=True) - # Convert to float32: - lon_ref = lon_ref.astype(np.float32) - lat_ref = lat_ref.astype(np.float32) handler.generate_coords_from_scan_angles() lon = handler.internal_variables["longitude"].values