Skip to content

[BUG] apply_scale_offset=True with earthdaily.Sentinel2 results in materialized tifs where pixels are all zero and no NoData value #547

@robmarkcole

Description

@robmarkcole

Root cause is a dtype/nodata interaction bug in rslearn materialization, triggered by apply_scale_offset=True

  • Sentinel2 scale/offset converts pixels to float reflectance
  • During materialization, rslearn force-casts source pixels to the layer band dtype (uint16 in my config)
  • If scaled reflectance is in [0, 1), casting to uint16 makes most pixels 0.
  • rslearn defaults nodata_vals to 0 when unset
  • Output GeoTIFF nodata metadata is not written because encode_raster(...) is called without nodata_val:

So the “all zeros + no nodata” behavior is explained by this chain.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions