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

feat: Introduce Disable Collection #32

Merged
merged 3 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/eodash_catalog/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ def add_visualization_info(
data_projection = str(endpoint_config.get("DataProjection", 3857))
epsg_prefix = "" if "EPSG:" in data_projection else "EPSG:"
crs = f"{epsg_prefix}{data_projection}"
time = stac_object.get_datetime() if isinstance(stac_object,Item) else "{{time}}"
time = stac_object.get_datetime() if isinstance(stac_object, Item) else "{{time}}"
target_url = (
"{}/tiles/{}/{}/{{z}}/{{y}}/{{x}}" "?crs={}&time={}&vmin={}&vmax={}&cbar={}"
).format(
Expand Down
15 changes: 12 additions & 3 deletions src/eodash_catalog/generate_indicators.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ def process_indicator_file(
f"{options.collectionspath}/{collection}.yaml",
parent_indicator,
options,
"Disable" in indicator_config and collection in indicator_config["Disable"],
)
else:
# we assume that collection files can also be loaded directly
Expand All @@ -200,7 +201,11 @@ def process_indicator_file(

@retry((Exception), tries=3, delay=5, backoff=2, logger=LOGGER)
def process_collection_file(
catalog_config: dict, file_path: str, catalog: Catalog | Collection, options: Options
catalog_config: dict,
file_path: str,
catalog: Catalog | Collection,
options: Options,
disable=False,
):
LOGGER.info(f"Processing collection: {file_path}")
with open(file_path) as f:
Expand Down Expand Up @@ -270,7 +275,9 @@ def process_collection_file(
if collection:
add_single_item_if_collection_empty(collection)
add_projection_info(endpoint_config, collection)
add_to_catalog(collection, catalog, endpoint_config, collection_config)
add_to_catalog(
collection, catalog, endpoint_config, collection_config, disable
)
else:
raise Exception(
f"No collection was generated for resource {endpoint_config}"
Expand Down Expand Up @@ -362,7 +369,7 @@ def process_collection_file(


def add_to_catalog(
collection: Collection, catalog: Catalog, endpoint: dict, collection_config: dict
collection: Collection, catalog: Catalog, endpoint: dict, collection_config: dict, disable=False
):
# check if already in catalog, if it is do not re-add it
# TODO: probably we should add to the catalog only when creating
Expand Down Expand Up @@ -392,6 +399,8 @@ def add_to_catalog(
if "Themes" in collection_config:
link.extra_fields["themes"] = collection_config["Themes"]
# Check for summaries and bubble up info
if disable:
link.extra_fields["roles"] = ["disable"]
if collection.summaries.lists:
for summary in collection.summaries.lists:
link.extra_fields[summary] = collection.summaries.lists[summary]
Expand Down