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

Fix data promotion in generic_image reader and satpy.composites.add_bands #2923

Merged
merged 5 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
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
1 change: 1 addition & 0 deletions satpy/composites/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2015-2023 Satpy developers

Check notice on line 1 in satpy/composites/__init__.py

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

ℹ Getting worse: Lines of Code in a Single File

The lines of code increases from 1276 to 1277, improve code health by reducing it to 600. The number of Lines of Code in a single file. More Lines of Code lowers the code health.
#
# This file is part of satpy.
#
Expand Down Expand Up @@ -985,6 +985,7 @@
alpha = new_data[0].copy()
alpha.data = da.ones((data.sizes["y"],
data.sizes["x"]),
dtype=new_data[0].dtype,
chunks=new_data[0].chunks)
# Rename band to indicate it's alpha
alpha["bands"] = "A"
Expand Down
2 changes: 1 addition & 1 deletion satpy/readers/generic_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def _mask_image_data(data, info):
if not np.issubdtype(data.dtype, np.integer):
raise ValueError("Only integer datatypes can be used as a mask.")
mask = data.data[-1, :, :] == np.iinfo(data.dtype).min
data = data.astype(np.float64)
data = data.astype(np.float32)
masked_data = da.stack([da.where(mask, np.nan, data.data[i, :, :])
for i in range(data.shape[0])])
data.data = masked_data
Expand Down
Loading
Loading