From 00866e7f888fc0f94356af6e816396d151c0cd96 Mon Sep 17 00:00:00 2001 From: wachsylon Date: Thu, 14 Sep 2023 09:39:51 +0200 Subject: [PATCH 1/2] Add an option for getting the dataset_id by parsing the url --- xpublish_intake/plugins.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xpublish_intake/plugins.py b/xpublish_intake/plugins.py index 006ef32..d0300bd 100644 --- a/xpublish_intake/plugins.py +++ b/xpublish_intake/plugins.py @@ -10,7 +10,7 @@ logger = logging.getLogger('intake_catalog') -def get_dataset_id(ds): +def get_dataset_id(ds,url): xpublish_id = ds.attrs.get(DATASET_ID_ATTR_KEY) cf_dataset_id = ".".join( [ @@ -19,11 +19,13 @@ def get_dataset_id(ds): ds.attrs.get('id') ] if x ] - ) + ) + dataset_by_url = url.split('/')[-2] dataset_id_options = [ xpublish_id, cf_dataset_id, + dataset_by_url, 'dataset' ] @@ -131,7 +133,7 @@ def get_dataset_catalog( request=Depends(get_request), dataset=Depends(deps.dataset), ): - xpublish_id = get_dataset_id(dataset) + xpublish_id = get_dataset_id(dataset,str(request.url)) sources = { 'zarr': get_zarr_source(xpublish_id, dataset, request) } From 8d0a49f23ca72b75d2414dd962f3ab29d6b05830 Mon Sep 17 00:00:00 2001 From: wachsylon Date: Thu, 14 Sep 2023 09:42:12 +0200 Subject: [PATCH 2/2] use better var name --- xpublish_intake/plugins.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xpublish_intake/plugins.py b/xpublish_intake/plugins.py index d0300bd..71278f7 100644 --- a/xpublish_intake/plugins.py +++ b/xpublish_intake/plugins.py @@ -20,12 +20,12 @@ def get_dataset_id(ds,url): ] if x ] ) - dataset_by_url = url.split('/')[-2] + dataset_id_by_url = url.split('/')[-2] dataset_id_options = [ xpublish_id, cf_dataset_id, - dataset_by_url, + dataset_id_by_url, 'dataset' ]