From 231fed50c7b684c60af46e7725688a2a60c1e043 Mon Sep 17 00:00:00 2001 From: Anne Haley Date: Fri, 23 Feb 2024 14:45:29 +0000 Subject: [PATCH] wip: update Pangeo module; needs catalog search functions --- pan3d/pangeo_forge.py | 36 +++++++----------------------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/pan3d/pangeo_forge.py b/pan3d/pangeo_forge.py index 375b049b..9b71082d 100644 --- a/pan3d/pangeo_forge.py +++ b/pan3d/pangeo_forge.py @@ -16,35 +16,13 @@ def get_catalog(): - print("fetching Pangeo Forge catalog...") - catalog = [] - feedstocks = requests.get("https://api.pangeo-forge.org/feedstocks/").json() - for feedstock in feedstocks: - if feedstock["provider"] == "github": - data = requests.get( - f"https://api.pangeo-forge.org/feedstocks/{feedstock['id']}/datasets" - ).json() - for item in data: - if ( - not item["is_test"] - and item["dataset_public_url"] - and "https://" in item["dataset_public_url"] - and item["dataset_type"] == "zarr" - ): - item_name = feedstock["spec"].split("/")[-1] - if len(data) > 1: - item_name += f' - {item["recipe_id"]}' - if item_name not in [i["name"] for i in catalog]: - catalog.append( - { - "name": item_name, - "id": item["id"], - "value": item["dataset_public_url"], - "more_info": f'https://pangeo-forge.org/dashboard/feedstock/{feedstock["id"]}', - } - ) - print(f"Retrieved {len(catalog)} viable datasets.") - return catalog + return { + 'name': 'Pangeo Forge', + 'id': 'pangeo', + 'search_terms': [ + {'key': 'id', 'options': []} + ] + } def get_group_datasets(group_id):