This is an automated email from the ASF dual-hosted git repository.
nchung 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 6c2542b SDAP-466 - Matchup results should use platform.id if it is
available (#253)
6c2542b is described below
commit 6c2542b7683f63ab52104ae4d4ab9e83a3482269
Author: Riley Kuttruff <[email protected]>
AuthorDate: Thu May 18 11:15:05 2023 -0700
SDAP-466 - Matchup results should use platform.id if it is available (#253)
* SDAP-466 - Improved setting of platform field in secondary match points
* SDAP-466 - Improved setting of platform field in secondary match points
---------
Co-authored-by: rileykk <[email protected]>
---
CHANGELOG.md | 1 +
analysis/webservice/algorithms_spark/Matchup.py | 9 ++++++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index dfbea59..2e16b12 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,7 @@ and this project adheres to [Semantic
Versioning](https://semver.org/spec/v2.0.0
- Made the `output` parameter case-insensitive
- Improved speed of results insert
- Updated `id` field of insitu points to include depth. This solves an
issue with NetCDF result rendering where different insitu observations at the
same place & time but at different depths were being excluded for having the
same `id`.
+- SDAP-466: Matchup now defines secondary `platform` fields with `platform.id`
if it is available and not blank. It then uses `platform.code` and
`platform.type` as fallbacks, then just the value of `platform` if none work.
### Deprecated
### Removed
### Fixed
diff --git a/analysis/webservice/algorithms_spark/Matchup.py
b/analysis/webservice/algorithms_spark/Matchup.py
index 2099ade..f27612a 100644
--- a/analysis/webservice/algorithms_spark/Matchup.py
+++ b/analysis/webservice/algorithms_spark/Matchup.py
@@ -480,8 +480,15 @@ class DomsPoint(object):
point.file_url = edge_point.get('fileurl')
point.depth = edge_point.get('depth')
- if 'code' in point.platform:
+ def is_defined(key, d):
+ return key in d and d[key] is not None and d[key] != ''
+
+ if is_defined('id', point.platform):
+ point.platform = edge_point.get('platform')['id']
+ elif is_defined('code', point.platform):
point.platform = edge_point.get('platform')['code']
+ elif is_defined('type', point.platform):
+ point.platform = edge_point.get('platform')['type']
data_fields = [
'air_pressure',