Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct Unexpected floats when reading LI L2 LFL #2998

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions satpy/readers/li_base_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
ClementLaplace marked this conversation as resolved.
Show resolved Hide resolved
if arr.attrs.get("_FillValue") is None:
return arr
if fill_value is not None:
ClementLaplace marked this conversation as resolved.
Show resolved Hide resolved
if np.isnan(fill_value):
fill_value = np.float32(np.nan)
Expand Down
5 changes: 0 additions & 5 deletions satpy/tests/reader_tests/test_li_l2_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand All @@ -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)
Expand All @@ -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)
ameraner marked this conversation as resolved.
Show resolved Hide resolved

handler.generate_coords_from_scan_angles()
lon = handler.internal_variables["longitude"].values
Expand Down
Loading