Repository navigation
Description
Since 17 April 2026, sentinel-2-l2a COGs written by the ingest pipeline do not carry the GDAL_NODATA
tag; files written before it carry nodata=0. Nothing else in the files changed (CRS, overviews 2/4/8/16,
512 px tiles, DEFLATE, data type), and DN 0 still marks empty pixels: on the untagged item below, DN 0
covers 54.18 % of B04, the item's s2:nodata_pixel_percentage is 54.19 % and SCL class 0 covers 54.18 %.
Nothing in the STAC items tells the two kinds of file apart (same processing centres, baselines and
asset layout).
How often (B04 of random items from 28 regions; the first IFD read from the raw bytes):
| Item generated | Items | B04 without the nodata tag |
|---|---|---|
| Jan–Mar 2026 | 126 | 0 |
| Apr 2026 | 35 | 8 |
| May 2026 | 40 | 5 |
| Jun–Oct 2026 | 199 | 199 |
Day by day, the first untagged file was generated on 2026-04-17 at 19:57 UTC
(S2A_MSIL2A_20260417T110711_R137_T30TWN_20260417T195723), the day ingest stopped (#473). Tagged and
untagged files are mixed until 2026-06-05; every file since 2026-06-05 10:19 UTC is untagged. B04, B08,
SCL and the visual asset change together. All three platforms are affected. landsat-c2-l2,
sentinel-1-rtc and hls2-s30 files from September 2026 still carry the tag.
Example pair
- tagged:
S2B_MSIL2A_20260213T040759_R047_T47RLN_20260213T062015(B04 header:GDAL_NODATA = "0") - untagged:
S2B_MSIL2A_20260619T160819_R140_T16QCE_20260619T200250(no GDAL_NODATA tag; 54 % empty)
Effect. Tools that take no-data from the file count the empty area as valid zeros. Compared with a
tagged item that also has a large empty area (S2C_MSIL2A_20260124T015401_R117_T51JTM_20260124T055208,
62 % empty):
| B04 | tagged, 62 % empty | untagged, 54 % empty |
|---|---|---|
Data API item/statistics (max_size 256) |
valid_percent 38.46, masked 40,330 | valid_percent 100, masked 0, median 0 |
| odc-stac 0.5.3, zeros loaded as data | 0.0 % | 53.6 % |
| stackstac 0.5.1, zeros loaded as data | 0.0 % | 20.2 % |
With the documented baseline harmonisation (subtract 1000) applied to unmasked data, those pixels become
−0.1 reflectance; on the untagged item (half-resolution overview) the tile mean red reflectance comes
out −0.024 instead of 0.066.
The rendered previews and tiles look right because their links pass nodata=0.
Reproduce
import planetary_computer, pystac_client, rasterio
cat = pystac_client.Client.open("https://planetarycomputer.microsoft.com/api/stac/v1",
modifier=planetary_computer.sign_inplace)
for iid in ["S2B_MSIL2A_20260213T040759_R047_T47RLN_20260213T062015",
"S2B_MSIL2A_20260619T160819_R140_T16QCE_20260619T200250"]:
item = cat.get_collection("sentinel-2-l2a").get_item(iid)
with rasterio.open(item.assets["B04"].href) as ds:
print(iid, item.properties["s2:generation_time"][:10], "nodata =", ds.nodata)prints nodata = 0.0 for the first and nodata = None for the second.
Suggestion. Write nodata=0 again when converting to COG, and add it to the files written since
2026-04-17 (a header change; the pixels are fine). Until then, users can mask DN 0 themselves.
Related: #460 (missing nodata on some older files), #134 (BOA_ADD_OFFSET). We found this with the daily
data checks of an open-source water-quality project (AquaLens) that reads these files.
Activity
ghidalgo3 commentedon Oct 28, 2026
We have deployed the fix to the COG generation and will retroactively fix the incorrect COGs, thank you for reporting this.
talhaabidj commentedon Oct 28, 2026
Thanks for the quick fix. I re-checked today: files generated from about 21:00 UTC on 27 Oct declare nodata=0 again (25 of 25 sampled). Files acquired June to 27 Oct still read None, including T16QCE 19 Jun from the report. Interestingly, May files I sampled already read 0. Happy to re-run the check once the backfill is done, and could you note here when it is?