pytroll / satpy

Python package for earth-observing satellite data processing
http://satpy.readthedocs.org/en/latest/
GNU General Public License v3.0
1.07k stars 298 forks source link

Unexpected floats when reading LI L2 LFL data #2854

Open gerritholl opened 4 months ago

gerritholl commented 4 months ago

Describe the bug

When reading LI L2 LFL data, several datasets are returned as floats when they should be integers.

To Reproduce

from satpy import Scene
from glob import glob
from satpy.utils import debug_on; debug_on()

fn = "/media/nas/x23352/MTG/LI/L2/2024/07/01/10/W_XX-EUMETSAT-Darmstadt,IMG+SAT,MTI1+LI-2-LFL--FD--CHK-BODY---NC4E_C_EUMT_20240701105944_L2PF_OPE_20240701105923_20240701105933_N__T_0066_0057.nc"
sc = Scene(filenames=[fn], reader="li_l2_nc")
sc.load(["flash_id"])
print(sc["flash_id"].dtype)

Expected behavior

I expect an integer dtype.

Actual results

I get float64.

[DEBUG: 2024-07-10 16:42:30 : satpy.readers.yaml_reader] Reading ('/data/gholl/checkouts/satpy/satpy/etc/readers/li_l2_nc.yaml',)
[DEBUG: 2024-07-10 16:42:30 : satpy.readers.yaml_reader] Assigning to li_l2_nc: ['/media/nas/x23352/MTG/LI/L2/2024/07/01/10/W_XX-EUMETSAT-Darmstadt,IMG+SAT,MTI1+LI-2-LFL--FD--CHK-BODY---NC4E_C_EUMT_20240701105944_L2PF_OPE_20240701105923_20240701105933_N__T_0066_0057.nc']
[DEBUG: 2024-07-10 16:42:30 : satpy.readers.li_base_nc] Product type is: 2-LFL
[DEBUG: 2024-07-10 16:42:30 : satpy.readers.li_base_nc] Adding 12 datasets for 2-LFL input product.
[DEBUG: 2024-07-10 16:42:30 : satpy.readers.li_l2_nc] The current product 2-LFL is not an accumulated product so it will not be regridded.
[DEBUG: 2024-07-10 16:42:30 : satpy.composites.config_loader] Looking for composites config file li.yaml
[DEBUG: 2024-07-10 16:42:30 : satpy.composites.config_loader] Looking for composites config file visir.yaml
[DEBUG: 2024-07-10 16:42:30 : pyorbital.tlefile] Path to the Pyorbital configuration (where e.g. platforms.txt is found): /data/gholl/mambaforge/envs/py312/lib/python3.12/site-packages/pyorbital/etc
[DEBUG: 2024-07-10 16:42:31 : satpy.readers.yaml_reader] No coordinates found for DataID(name='longitude', modifiers=())
[DEBUG: 2024-07-10 16:42:31 : satpy.readers.yaml_reader] No coordinates found for DataID(name='latitude', modifiers=())
float64

Environment Info:

Additional context

The same for other integer variables in the dataset.

Sometimes this happens when a fill value is defined in the variable attributes, but that is not the case here:

    uint flash_id(flashes) ;
        flash_id:_Unsigned = "true" ;
        flash_id:long_name = "LI L2 Flash IDs" ;
mraspaud commented 3 months ago

@ameraner ^