From 3a625ea00e653d688d13b2d4d42ea0c7136d5d18 Mon Sep 17 00:00:00 2001 From: Matthew Iannucci Date: Thu, 21 Nov 2024 10:30:54 -0500 Subject: [PATCH] Better parameter filtering --- tests/test_cf_router.py | 4 ++++ xpublish_edr/plugin.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_cf_router.py b/tests/test_cf_router.py index 5d729fb..76cf29e 100644 --- a/tests/test_cf_router.py +++ b/tests/test_cf_router.py @@ -108,6 +108,10 @@ def test_cf_metadata_query(cf_client): ], "Spatial bbox is incorrect" assert data["extent"]["spatial"]["crs"] == "EPSG:4326", "Spatial CRS is incorrect" + assert "air" in data["parameter_names"], "Air parameter should be present" + assert "lat" not in data["parameter_names"], "lat should not be present" + assert "lon" not in data["parameter_names"], "lon should not be present" + def test_cf_metadata_query_temp_smoke_test(cf_client): response = cf_client.get("/datasets/temp/edr/") diff --git a/xpublish_edr/plugin.py b/xpublish_edr/plugin.py index 2275c5c..a83123e 100644 --- a/xpublish_edr/plugin.py +++ b/xpublish_edr/plugin.py @@ -177,7 +177,7 @@ def get_collection_metadata(dataset: xr.Dataset = Depends(deps.dataset)): parameters = { k: variable_description(v) - for k, v in dataset.variables.items() + for k, v in projected_ds.variables.items() if "axis" not in v.attrs }