This is an automated email from the ASF dual-hosted git repository. rkk pushed a commit to branch SDAP-479 in repository https://gitbox.apache.org/repos/asf/incubator-sdap-nexus.git
commit 6ca306405338d34dbc04747a1b0a354a2b9606cd Author: rileykk <[email protected]> AuthorDate: Mon Jul 31 13:40:35 2023 -0700 SDAP-479: Subset will not fail is standard/variable name not given (CSV) --- CHANGELOG.md | 1 + analysis/webservice/algorithms/doms/subsetter.py | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f2beb15..41e05ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - SDAP-465: Removed `climatology` directory. ### Fixed - SDAP-474: Fixed bug in CSV attributes where secondary dataset would be rendered as comma separated characters +- SDAP-479: Fixed `/cdmssubset` failure for variables without specified standard_name. ### Security ## [1.1.0] - 2023-04-26 diff --git a/analysis/webservice/algorithms/doms/subsetter.py b/analysis/webservice/algorithms/doms/subsetter.py index 0dca80f..60c3762 100644 --- a/analysis/webservice/algorithms/doms/subsetter.py +++ b/analysis/webservice/algorithms/doms/subsetter.py @@ -203,14 +203,22 @@ class DomsResultsRetrievalHandler(BaseDomsHandler.BaseDomsQueryCalcHandler): tile = tile[0] + def get_best_name(variable): + if variable.standard_name: + return variable.standard_name + elif variable.variable_name: + return variable.variable_name + else: + return 'UNNAMED_VARIABLE' + for nexus_point in tile.nexus_point_generator(): if tile.is_multi: data_points = { - tile.variables[idx].standard_name: nexus_point.data_vals[idx] + get_best_name(tile.variables[idx]): nexus_point.data_vals[idx] for idx in range(len(tile.variables)) } else: - data_points = {tile.variables[0].standard_name: nexus_point.data_vals} + data_points = {get_best_name(tile.variables[0]): nexus_point.data_vals} data.append({ 'latitude': nexus_point.latitude, 'longitude': nexus_point.longitude,
