Skip to content

FCI L2 reader returns categorical data as float #3338

@gerritholl

Description

@gerritholl

Describe the bug

Reading categorical data from FCI L2, such as cloud type, results in a float32.

This should be int8 or uint8.

To Reproduce

# Your code here
from satpy import Scene
from satpy.utils import debug_on; debug_on()
sc = Scene(
        filenames=["/media/nas/x23352/MTG/FCI/L2-cases/202602121200/W_XX-EUMETSAT-Darmstadt,IMG+SAT,MTI1+FCI-2-CT--FD------NC4E_C_EUMT_20260212121354_L2PF_OPE_20260212120000_20260212121000_N__C_0073_0000.nc"],
        reader="fci_l2_nc")
sc.load(["cloud_type"])
print(sc["cloud_type"].dtype)

Expected behavior

I expect an integer dtype.

Actual results

[DEBUG: 2026-02-13 10:31:47 : satpy.readers.core.yaml_reader] Reading ('/home/gholl/checkouts/satpy/satpy/etc/readers/fci_l2_nc.yaml',)
[DEBUG: 2026-02-13 10:31:47 : satpy.readers.core.yaml_reader] Assigning to fci_l2_nc: ['/media/nas/x23352/MTG/FCI/L2-cases/202602121200/W_XX-EUMETSAT-Darmstadt,IMG+SAT,MTI1+FCI-2-CT--FD------NC4E_C_EUMT_20260212121354_L2PF_OPE_20260212120000_20260212121000_N__C_0073_0000.nc']
[DEBUG: 2026-02-13 10:31:47 : rasterio.session] Could not import boto3, continuing with reduced functionality.
/home/gholl/checkouts/satpy/satpy/readers/fci_l2_nc.py:185: UserWarning: The specified chunks separate the stored chunks along dimension "number_of_rows" starting at index 4096. This could degrade performance. Instead, consider rechunking after loading.
  self.nc = xr.open_dataset(
/home/gholl/checkouts/satpy/satpy/readers/fci_l2_nc.py:185: UserWarning: The specified chunks separate the stored chunks along dimension "number_of_columns" starting at index 4096. This could degrade performance. Instead, consider rechunking after loading.
  self.nc = xr.open_dataset(
[DEBUG: 2026-02-13 10:31:47 : satpy.composites.config_loader] Looking for composites config file fci.yaml
[DEBUG: 2026-02-13 10:31:47 : pyorbital.tlefile] Path to the Pyorbital configuration (where e.g. platforms.txt is found): /home/gholl/miniforge3/envs/py313/lib/python3.13/site-packages/pyorbital/etc
[DEBUG: 2026-02-13 10:31:47 : satpy.composites.config_loader] Looking for composites config file visir.yaml
[DEBUG: 2026-02-13 10:31:47 : satpy.readers.fci_l2_nc] Reading in file to get dataset with key cloud_type.
[DEBUG: 2026-02-13 10:31:47 : satpy.readers.core.yaml_reader] Requested orientation for Dataset cloud_type is 'native' (default). No flipping is applied.
float32

Environment Info:

  • OS: openSUSE Leap 15.6
  • Satpy Version: v0.59.0-117-g5e5e33cbf

Additional context

When writing the output as mode L geotiff, trollimage will scale the pixel values. This results in pixel values that are wrong. This wouldn't happen if the data were int.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions