You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sdap.apache.org by rk...@apache.org on 2024/02/02 21:06:37 UTC

(incubator-sdap-nexus) branch SDAP-508 created (now f4ad6e4)

This is an automated email from the ASF dual-hosted git repository.

rkk pushed a change to branch SDAP-508
in repository https://gitbox.apache.org/repos/asf/incubator-sdap-nexus.git


      at f4ad6e4  SDAP-508 report sat spatial extents

This branch includes the following new commits:

     new f4ad6e4  SDAP-508 report sat spatial extents

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(incubator-sdap-nexus) 01/01: SDAP-508 report sat spatial extents

Posted by rk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rkk pushed a commit to branch SDAP-508
in repository https://gitbox.apache.org/repos/asf/incubator-sdap-nexus.git

commit f4ad6e44f7dd22b14907e83e25198dae391b8a5b
Author: rileykk <ri...@jpl.nasa.gov>
AuthorDate: Fri Feb 2 13:06:28 2024 -0800

    SDAP-508 report sat spatial extents
---
 CHANGELOG.md                                       |  1 +
 .../webservice/algorithms/doms/DatasetListQuery.py |  2 +-
 data-access/nexustiles/dao/SolrProxy.py            | 28 ++++++++++++++++++++++
 3 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 94e2fa6..8db48ef 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 ### Added
 - SDAP-506:
   - Added STAC Catalog endpoint for matchup outputs
+- SDAP-508: Added spatial extents to the satellite dataset entries in `/list` and `/cdmslist`
 ### Changed
 - SDAP-493: 
   - Updated /job endpoint to use `executionId` terminology for consistency with existing `/cdmsresults` endpoint
diff --git a/analysis/webservice/algorithms/doms/DatasetListQuery.py b/analysis/webservice/algorithms/doms/DatasetListQuery.py
index 7c40d18..5427eb2 100644
--- a/analysis/webservice/algorithms/doms/DatasetListQuery.py
+++ b/analysis/webservice/algorithms/doms/DatasetListQuery.py
@@ -91,7 +91,7 @@ class DomsDatasetListQueryHandler(BaseDomsHandler.BaseDomsQueryCalcHandler):
     @cached(ttl=(60 * 60 * 1000))  # 1 hour cached
     def calc(self, computeOptions, **args):
 
-        satellitesList = self._get_tile_service().get_dataseries_list(simple=True)
+        satellitesList = self._get_tile_service().get_dataseries_list(simple=False)
 
         insituList = []
 
diff --git a/data-access/nexustiles/dao/SolrProxy.py b/data-access/nexustiles/dao/SolrProxy.py
index ca1033a..a072c6b 100644
--- a/data-access/nexustiles/dao/SolrProxy.py
+++ b/data-access/nexustiles/dao/SolrProxy.py
@@ -162,6 +162,27 @@ class SolrProxy(object):
 
         datasets = self.get_data_series_list_simple()
 
+        def get_spatial_bound(dataset, lat_lon, min_max):
+            search = f'dataset_s:{dataset}'
+
+            field = f'tile_{min_max}_{lat_lon}'
+
+            order = 'ASC' if min_max == 'min' else 'DESC'
+
+            params = dict(
+                rows=1,
+                sort=[f'{field} {order}']
+            )
+
+            results = self.do_query_raw(*(search, None, None, False, None), **params)
+
+            v = results.docs[0][field]
+
+            if isinstance(v, list):
+                v = v[0]
+
+            return v
+
         for dataset in datasets:
             min_date = self.find_min_date_from_tiles([], ds=dataset['title'])
             max_date = self.find_max_date_from_tiles([], ds=dataset['title'])
@@ -170,6 +191,13 @@ class SolrProxy(object):
             dataset['iso_start'] = min_date.strftime(ISO_8601)
             dataset['iso_end'] = max_date.strftime(ISO_8601)
 
+            min_lat = get_spatial_bound(dataset['title'], 'lat', 'min')
+            max_lat = get_spatial_bound(dataset['title'], 'lat', 'max')
+            min_lon = get_spatial_bound(dataset['title'], 'lon', 'min')
+            max_lon = get_spatial_bound(dataset['title'], 'lon', 'max')
+
+            dataset['spatial_extent'] = '{:0.2f},{:0.2f},{:0.2f},{:0.2f}'.format(min_lon, min_lat, max_lon, max_lat)
+
         return datasets
 
     def get_data_series_list_simple(self):