Skip to content

Commit

Permalink
wip: update Pangeo module; needs catalog search functions
Browse files Browse the repository at this point in the history
  • Loading branch information
annehaley authored and johnkit committed Apr 30, 2024
1 parent 210afb1 commit 231fed5
Showing 1 changed file with 7 additions and 29 deletions.
36 changes: 7 additions & 29 deletions pan3d/pangeo_forge.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 231fed5

Please sign in to comment.