-
Notifications
You must be signed in to change notification settings - Fork 1
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
Change data IDs and make the STAC data store searchable #15
Conversation
4769adb
to
433a2a5
Compare
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.
Very good. See my couple of minor comments and suggestions.
xcube_stac/store.py
Outdated
): | ||
self._url = url | ||
self._data_id_delimiter = data_id_delimiter | ||
url_mod = url | ||
if url_mod[-12:] == "catalog.json": |
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.
Avoid magic numbers. Instead put "catalog..json" in a constant, then use -len(_CATALOG_JSON)
.
xcube_stac/store.py
Outdated
metadata = dict( | ||
bbox=item.bbox, | ||
time_range=time_range | ||
) | ||
return DatasetDescriptor(data_id, **metadata) |
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.
Inline metadata
.
xcube_stac/store.py
Outdated
DataStoreError( | ||
"Either 'start_datetime' and 'end_datetime' or 'datetime' " | ||
"needs to be determine in the STAC item." | ||
) |
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.
Make clear, it is not the user's fault, but an external problem.
xcube_stac/store.py
Outdated
item object | ||
""" | ||
response = requests.request(method="GET", url=self._url_mod + data_id) | ||
if response.status_code == 200: |
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.
if response.status_code == 200: | |
if response.ok: |
This is because 200 is not the only way to signal success. There are other success codes, that signal a cached result, etc.
Closes #6
Closes #13
data IDs
The data IDs are assigned to the the segment of the URL that follows the catalog's URL. This allows easy access to the item and read out of hrefs from the assets.
Make the STAC data store searchable
The search query parameters are given by STAC API Item Search. So far xcube-stac supports datetime, bbox, and collections.
If a catalog supports the item search conformance class, these query parameters are transferred to the server and the search is performed on the sever side. Otherwise, xcube-stac crawls through the catalog and selects the items where the search parameters are matched.
Note that the split between search and open data parameters is put on the item level. Search parameters are used to select items. Open parameters will be used to open the data. The parameter
asset_names
therefore is put to the open data parameters.