Skip to content

Commit

Permalink
Merge pull request #32 from eodash/disable-collection
Browse files Browse the repository at this point in the history
feat: Introduce `Disable` Collection
  • Loading branch information
santilland authored Feb 11, 2025
2 parents 0aaf92c + 29e570e commit bf63d15
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
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

0 comments on commit bf63d15

Please sign in to comment.