Skip to content
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

Merged
merged 5 commits into from
Jul 10, 2024

Conversation

konstntokas
Copy link
Collaborator

@konstntokas konstntokas commented May 29, 2024

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.

@konstntokas konstntokas force-pushed the konstntokas-013-change_data_id_url_part branch from 4769adb to 433a2a5 Compare May 30, 2024 09:15
@konstntokas konstntokas requested review from forman and pont-us May 30, 2024 09:20
@konstntokas konstntokas removed the request for review from pont-us July 1, 2024 09:08
Copy link
Member

@forman forman left a 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.

):
self._url = url
self._data_id_delimiter = data_id_delimiter
url_mod = url
if url_mod[-12:] == "catalog.json":
Copy link
Member

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).

Comment on lines 188 to 192
metadata = dict(
bbox=item.bbox,
time_range=time_range
)
return DatasetDescriptor(data_id, **metadata)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inline metadata.

Comment on lines 383 to 386
DataStoreError(
"Either 'start_datetime' and 'end_datetime' or 'datetime' "
"needs to be determine in the STAC item."
)
Copy link
Member

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.

item object
"""
response = requests.request(method="GET", url=self._url_mod + data_id)
if response.status_code == 200:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

@konstntokas konstntokas requested a review from forman July 10, 2024 08:16
@forman forman merged commit bdaaeb9 into main Jul 10, 2024
1 check passed
@konstntokas konstntokas deleted the konstntokas-013-change_data_id_url_part branch July 10, 2024 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change data ID to item url part, which comes after the catalog url Make the STAC data store searchable
2 participants