[ 
https://issues.apache.org/jira/browse/SDAP-43?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16397702#comment-16397702
 ] 

ASF GitHub Bot commented on SDAP-43:
------------------------------------

ntquach closed pull request #10: SDAP-43 Update datainbounds algorithm to 
handle multiple time steps p…
URL: https://github.com/apache/incubator-sdap-nexus/pull/10
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/analysis/webservice/algorithms/DataInBoundsSearch.py 
b/analysis/webservice/algorithms/DataInBoundsSearch.py
index 2942649..80f0416 100644
--- a/analysis/webservice/algorithms/DataInBoundsSearch.py
+++ b/analysis/webservice/algorithms/DataInBoundsSearch.py
@@ -46,7 +46,7 @@ class DataInBoundsSearchHandlerImpl(NexusHandler):
             "name": "Bounding box",
             "type": "comma-delimited float",
             "description": "Minimum (Western) Longitude, Minimum (Southern) 
Latitude, "
-                           "Maximum (Eastern) Longitude, Maximum (Northern) 
Latitude. Required"
+                           "Maximum (Eastern) Longitude, Maximum (Northern) 
Latitude. Required if 'metadataFilter' not provided"
         },
         "startTime": {
             "name": "Start Time",
@@ -57,6 +57,11 @@ class DataInBoundsSearchHandlerImpl(NexusHandler):
             "name": "End Time",
             "type": "string",
             "description": "Ending time in format YYYY-MM-DDTHH:mm:ssZ or 
seconds since EPOCH. Required"
+        },
+        "metadataFilter": {
+            "name": "Metadata Filter",
+            "type": "string",
+            "description": "Filter in format key:value. Required if 'b' not 
provided"
         }
     }
     singleton = True
@@ -100,27 +105,36 @@ def parse_arguments(self, request):
                     request.get_start_datetime().strftime(ISO_8601), 
request.get_end_datetime().strftime(ISO_8601)),
                 code=400)
 
+        bounding_polygon = metadata_filter = None
         try:
             bounding_polygon = request.get_bounding_polygon()
         except:
-            raise NexusProcessingException(
-                reason="'b' argument is required. Must be comma-delimited 
float formatted as Minimum (Western) Longitude, Minimum (Southern) Latitude, 
Maximum (Eastern) Longitude, Maximum (Northern) Latitude",
-                code=400)
+            metadata_filter = request.get_metadata_filter()
+            if 0 == len(metadata_filter):
+                raise NexusProcessingException(
+                    reason="'b' or 'metadataFilter' argument is required. 'b' 
must be comma-delimited float formatted "
+                           "as Minimum (Western) Longitude, Minimum (Southern) 
Latitude, Maximum (Eastern) Longitude, "
+                           "Maximum (Northern) Latitude. 'metadataFilter' must 
be in the form key:value",
+                    code=400)
 
-        return ds, parameter_s, start_time, end_time, bounding_polygon
+        return ds, parameter_s, start_time, end_time, bounding_polygon, 
metadata_filter
 
     def calc(self, computeOptions, **args):
-        ds, parameter, start_time, end_time, bounding_polygon = 
self.parse_arguments(computeOptions)
+        ds, parameter, start_time, end_time, bounding_polygon, metadata_filter 
= self.parse_arguments(computeOptions)
 
         includemeta = computeOptions.get_include_meta()
 
-        min_lat = bounding_polygon.bounds[1]
-        max_lat = bounding_polygon.bounds[3]
-        min_lon = bounding_polygon.bounds[0]
-        max_lon = bounding_polygon.bounds[2]
+        min_lat = max_lat = min_lon = max_lon = None
+        if bounding_polygon:
+            min_lat = bounding_polygon.bounds[1]
+            max_lat = bounding_polygon.bounds[3]
+            min_lon = bounding_polygon.bounds[0]
+            max_lon = bounding_polygon.bounds[2]
 
-        tiles = self._tile_service.get_tiles_bounded_by_box(min_lat, max_lat, 
min_lon, max_lon, ds, start_time,
-                                                            end_time)
+            tiles = self._tile_service.get_tiles_bounded_by_box(min_lat, 
max_lat, min_lon, max_lon, ds, start_time,
+                                                                end_time)
+        else:
+            tiles = self._tile_service.get_tiles_by_metadata(metadata_filter, 
ds, start_time, end_time)
 
         data = []
         for tile in tiles:
@@ -148,7 +162,7 @@ def calc(self, computeOptions, **args):
                     except (KeyError, IndexError):
                         pass
                 else:
-                    pass
+                    point['variable'] = nexus_point.data_val
 
                 data.append({
                     'latitude': nexus_point.latitude,
diff --git a/analysis/webservice/webmodel.py b/analysis/webservice/webmodel.py
index 3f01eac..e75ac01 100644
--- a/analysis/webservice/webmodel.py
+++ b/analysis/webservice/webmodel.py
@@ -51,6 +51,7 @@ class RequestParameters(object):
     PLOT_SERIES = "plotSeries"
     PLOT_TYPE = "plotType"
     SPARK_CFG = "spark"
+    METADATA_FILTER = "metadataFilter"
 
 
 class StandardNexusErrors:
@@ -246,6 +247,9 @@ def get_dataset(self):
         else:
             return ds.split(",")
 
+    def get_metadata_filter(self):
+        return 
self.requestHandler.get_arguments(RequestParameters.METADATA_FILTER)
+
     def get_environment(self):
         env = self.get_argument(RequestParameters.ENVIRONMENT, None)
         if env is None and "Origin" in self.requestHandler.request.headers:


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Update datainbounds algorithm to handle multiple time steps per tile
> --------------------------------------------------------------------
>
>                 Key: SDAP-43
>                 URL: https://issues.apache.org/jira/browse/SDAP-43
>             Project: Apache Science Data Analytics Platform
>          Issue Type: Improvement
>            Reporter: Nga Chung
>            Assignee: Nga Chung
>            Priority: Major
>
> To date, NEXUS has partitioned data to have 1 time step per tile.  For SWOT 
> we want to have multiple time steps per tile for efficiency of the 
> computations.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to