Skip to content

Commit

Permalink
Update stac-load-e84-aws.py; remove config, update date, and update g…
Browse files Browse the repository at this point in the history
…ranule
  • Loading branch information
mehran66 authored and Kirill888 committed Nov 7, 2023
1 parent de56221 commit bce799e
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions notebooks/stac-load-e84-aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,6 @@ def convert_bounds(bbox, invert_y=False):
return ((y1, x1), (y2, x2))


# %%
cfg = {
"sentinel-s2-l2a-cogs": {
"assets": {
"*": {"data_type": "uint16", "nodata": 0},
"SCL": {"data_type": "uint8", "nodata": 0},
"visual": {"data_type": "uint8", "nodata": 0},
},
"aliases": {"red": "B04", "green": "B03", "blue": "B02"},
},
"*": {"warnings": "ignore"},
}

# %% [markdown]
# ## Start Dask Client
#
Expand All @@ -81,7 +68,7 @@ def convert_bounds(bbox, invert_y=False):
catalog = Client.open("https://earth-search.aws.element84.com/v1/")

query = catalog.search(
collections=["sentinel-2-l2a"], datetime="2020-01-01/2020-02-31", limit=100, bbox=bbox
collections=["sentinel-2-l2a"], datetime="2021-09-16", limit=100, bbox=bbox
)

items = list(query.get_items())
Expand All @@ -100,9 +87,9 @@ def convert_bounds(bbox, invert_y=False):

# Compute granule id from components
gdf["granule"] = (
gdf["sentinel:utm_zone"].apply(lambda x: f"{x:02d}")
+ gdf["sentinel:latitude_band"]
+ gdf["sentinel:grid_square"]
gdf["mgrs:utm_zone"].apply(lambda x: f"{x:02d}")
+ gdf["mgrs:latitude_band"]
+ gdf["mgrs:grid_square"]
)

fig = gdf.plot(
Expand Down Expand Up @@ -140,7 +127,6 @@ def convert_bounds(bbox, invert_y=False):
tooltip=[
"granule",
"datetime",
"sentinel:data_coverage",
"eo:cloud_cover",
],
popup=True,
Expand Down Expand Up @@ -172,7 +158,6 @@ def convert_bounds(bbox, invert_y=False):
resolution=10 * zoom,
chunks={}, # <-- use Dask
groupby="solar_day",
stac_cfg=cfg,
)
display(xx)

Expand Down Expand Up @@ -223,7 +208,6 @@ def convert_bounds(bbox, invert_y=False):
resolution=10,
chunks={}, # <-- use Dask
groupby="solar_day",
stac_cfg=cfg,
bbox=small_bbox,
)
display(yy.odc.geobox)
Expand Down

0 comments on commit bce799e

Please sign in to comment.