-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support STAC 1.0 - part 0 #96
Support STAC 1.0 - part 0 #96
Conversation
This prepares for STAC 1.0 support by updating the tests to use files from the PyStac repo. Supporting STAC 1.0 will involve updating to the latest versions of those files. col passing wip
Thanks for starting this @TomAugspurger ! I left some comments trying to figure out whether to use external examples for testing, or if we might want to put our own example STAC=1.0 examples in this repository (with valid asset / subcatalog links) |
I think having our own STAC catalogs, with just the data we need for testing, makes sense. Now that we're at STAC 1.0, this seems more feasible. I'll look into that. |
OK, updated to use some local files, rather than opening STAC objects from remote URLs. I think the In [1]: import rasterio
In [2]: import pystac, planetary_computer, intake
In [3]: item = planetary_computer.sign_assets(pystac.read_file("https://planetarycomputer.microsoft.com/api/stac/v1/collections/sentinel-2-l2a/items/S2B_MSIL2A_20210610T115639_N0212_R066_T33
...: XWC_20210613T190000.SAFE"))
In [5]: intake_item = intake.open_stac_item(item)
In [6]: ds = intake_item.stack_bands(["B02", "B03"])().to_dask()
In [7]: ds
Out[7]:
<xarray.DataArray (band: 2, y: 10980, x: 10980)>
dask.array<concatenate, shape=(2, 10980, 10980), dtype=uint16, chunksize=(1, 10980, 10980), chunktype=numpy.ndarray>
Coordinates:
* band (band) int64 1 1
* y (y) float64 8.3e+06 8.3e+06 8.3e+06 ... 8.19e+06 8.19e+06 8.19e+06
* x (x) float64 5e+05 5e+05 5e+05 ... 6.098e+05 6.098e+05 6.098e+05
Attributes:
transform: (10.0, 0.0, 499980.0, 0.0, -10.0, 8300040.0)
crs: +init=epsg:32633
res: (10.0, 10.0)
is_tiled: 1
nodatavals: (nan,)
scales: (1.0,)
offsets: (0.0,)
AREA_OR_POINT: Area |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great @TomAugspurger ! Would be happy to merge this as is. We can add some additional tests in future PRs and hopefully release 1.0.0 shortly after pystac 1.0.0 ?
Yeah, releasing shortly after pystac 1.0 is my hope.
|
This is a precursor PR to supporting STAC 1.0. It just updates the tests to use files from the PyStac repo, rather than sat-stac.
A followup PR will update the URLs to point to the STAC 1.0.0 versions of those files while updating the code to use PyStac 1.0.
The first two commits are just #94 and can be ignored. fbf84a2 has the actual changes.