You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sdap.apache.org by sk...@apache.org on 2023/02/14 00:07:30 UTC
[incubator-sdap-nexus] branch master updated: cdmssubset bugfix (#220)
This is an automated email from the ASF dual-hosted git repository.
skperez pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-sdap-nexus.git
The following commit(s) were added to refs/heads/master by this push:
new 52b8685 cdmssubset bugfix (#220)
52b8685 is described below
commit 52b86857d06e814c221dfacc348842a6135e27aa
Author: Stepheny Perez <sk...@users.noreply.github.com>
AuthorDate: Mon Feb 13 16:07:24 2023 -0800
cdmssubset bugfix (#220)
* Remove platform requirement from subsetter. Platform can be any value, not just int
* Updated changelog
* Updated changelog
* Add insitu meta to id field in cdmssubset result
* Only add id to subsetter csv results if id is present in output. Won't be in some cases.
* Re-add missing check for id in header
---
CHANGELOG.md | 10 ++++++++++
analysis/webservice/algorithms/doms/subsetter.py | 20 +++++++++-----------
analysis/webservice/apidocs/openapi.yml | 9 +++------
3 files changed, 22 insertions(+), 17 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0e6f7c8..394318f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [Unreleased]
+### Added
+### Changed
+### Deprecated
+### Removed
+### Fixed
+- Made `platforms` param optional in `/cdmssubset`, and removed int requirement
+- Updated OpenAPI specification for `/cdmssubset` to accurately reflect `platforms` and `parameter` field options.
+### Security
+
## [1.0.0] - 2022-12-05
### Added
- SDAP-388: Enable SDAP to proxy/redirect to alternate SDAP
diff --git a/analysis/webservice/algorithms/doms/subsetter.py b/analysis/webservice/algorithms/doms/subsetter.py
index 97b7569..0dca80f 100644
--- a/analysis/webservice/algorithms/doms/subsetter.py
+++ b/analysis/webservice/algorithms/doms/subsetter.py
@@ -119,9 +119,6 @@ class DomsResultsRetrievalHandler(BaseDomsHandler.BaseDomsQueryCalcHandler):
matchup_ds_names = []
parameter_s = request.get_argument('parameter', None)
- if parameter_s is None and len(matchup_ds_names) > 0:
- raise NexusProcessingException(
- reason='Parameter must be provided for insitu subset.' % parameter_s, code=400)
try:
start_time = request.get_start_datetime()
@@ -159,13 +156,6 @@ class DomsResultsRetrievalHandler(BaseDomsHandler.BaseDomsQueryCalcHandler):
reason='Depth Min should be less than Depth Max', code=400)
platforms = request.get_argument('platforms', None)
- if platforms is not None:
- try:
- p_validation = platforms.split(',')
- p_validation = [int(p) for p in p_validation]
- del p_validation
- except:
- raise NexusProcessingException(reason='platforms must be a comma-delimited list of integers', code=400)
return primary_ds_name, matchup_ds_names, parameter_s, start_time, end_time, \
bounding_polygon, depth_min, depth_max, platforms
@@ -262,6 +252,7 @@ class DomsResultsRetrievalHandler(BaseDomsHandler.BaseDomsQueryCalcHandler):
data.append({
'latitude': result['latitude'],
'longitude': result['longitude'],
+ 'id': result['meta'],
'time': (datetime.strptime(result['time'], '%Y-%m-%dT%H:%M:%SZ') - datetime.fromtimestamp(0)).total_seconds(),
'data': data_points
})
@@ -309,6 +300,10 @@ class SubsetResult(NexusResults):
]
data_variables = list(set([keys for result in results for keys in result['data'].keys()]))
data_variables.sort()
+
+ if 'id' in list(set([keys for result in results for keys in result.keys()])):
+ headers.append('id')
+
headers.extend(data_variables)
for i, result in enumerate(results):
cols = []
@@ -317,8 +312,11 @@ class SubsetResult(NexusResults):
cols.append(result['latitude'])
cols.append(datetime.utcfromtimestamp(result['time']).strftime('%Y-%m-%dT%H:%M:%SZ'))
+ if 'id' in headers:
+ cols.append(result.get('id'))
+
for var in data_variables:
- cols.append(result['data'][var])
+ cols.append(result['data'].get(var))
if i == 0:
rows.append(','.join(headers))
rows.append(','.join(map(str, cols)))
diff --git a/analysis/webservice/apidocs/openapi.yml b/analysis/webservice/apidocs/openapi.yml
index 06150f9..5d90037 100644
--- a/analysis/webservice/apidocs/openapi.yml
+++ b/analysis/webservice/apidocs/openapi.yml
@@ -433,12 +433,10 @@ paths:
- in: query
name: parameter
description: |
- The parameter of interest. One of 'sst', 'sss', 'wind'
- required: true
+ The parameter of interest.
schema:
type: string
- enum: ['sst', 'sss', 'wind']
- example: sss
+ example: sea_surface_salinity
- in: query
name: depthMin
description: |
@@ -463,8 +461,7 @@ paths:
required: false
schema:
type: string
- default: 1,2,3,4,5,6,7,8,9
- example: 1,2,3,4,5,6,7,8,9
+ example: 3B,23
- in: query
name: output
description: |