fatmur Claude Opus 5.5 commited on
Commit
61ab4a9
·
1 Parent(s): b2b341a

ingest: name packing rule after its source, ESA

Browse files

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Files changed (1) hide show
  1. scripts/ingest_dynamic_world.py +4 -4
scripts/ingest_dynamic_world.py CHANGED
@@ -27,7 +27,7 @@ from geosave.geodata.stac import StacClient, StacQuery
27
 
28
  from modules.segmentation.supervised.datasets import DATA, SOURCES, find_labels
29
 
30
- # Planetary Computer's L2A; its STAC states no scale or offset (see read_baseline_packing).
31
  COLLECTION = "sentinel-2-l2a"
32
 
33
  # The 10 m and 20 m bands the Dynamic World model reads (Brown et al., 2022).
@@ -83,8 +83,8 @@ def drop_superseded(items: list[pystac.Item]) -> list[pystac.Item]:
83
  return kept
84
 
85
 
86
- def read_baseline_packing(items: list[pystac.Item]) -> attrs.CFPacking:
87
- """Derive how the items' digital numbers decode to reflectance from their baseline.
88
 
89
  Planetary Computer's STAC states no scale or offset, only the ESA
90
  processing baseline (`s2:processing_baseline`, the `N0500` of a product
@@ -110,7 +110,7 @@ def load_image(client: StacClient, label_path: Path, date: pd.Timestamp) -> xr.D
110
  """
111
  label = io.open_geotiff(label_path, chunks=None)
112
  items = drop_superseded(search_items(client, label, date))
113
- packing = read_baseline_packing(items)
114
 
115
  image = stac.load_dataset(
116
  items,
 
27
 
28
  from modules.segmentation.supervised.datasets import DATA, SOURCES, find_labels
29
 
30
+ # Planetary Computer's L2A; its STAC states no scale or offset (see read_esa_packing).
31
  COLLECTION = "sentinel-2-l2a"
32
 
33
  # The 10 m and 20 m bands the Dynamic World model reads (Brown et al., 2022).
 
83
  return kept
84
 
85
 
86
+ def read_esa_packing(items: list[pystac.Item]) -> attrs.CFPacking:
87
+ """Derive reflectance decoding from ESA's product format and processing baseline.
88
 
89
  Planetary Computer's STAC states no scale or offset, only the ESA
90
  processing baseline (`s2:processing_baseline`, the `N0500` of a product
 
110
  """
111
  label = io.open_geotiff(label_path, chunks=None)
112
  items = drop_superseded(search_items(client, label, date))
113
+ packing = read_esa_packing(items)
114
 
115
  image = stac.load_dataset(
116
  items,