You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sdap.apache.org by nc...@apache.org on 2018/03/13 21:34:40 UTC

[incubator-sdap-nexus] branch master updated: SDAP-42 Fix NEXUS tile service find_tiles_by_metadata (#9)

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 ca74029  SDAP-42 Fix NEXUS tile service find_tiles_by_metadata (#9)
ca74029 is described below

commit ca740290c43a9844e09577b13eea8a936a11f693
Author: Nga Quach <ng...@gmail.com>
AuthorDate: Tue Mar 13 14:34:38 2018 -0700

    SDAP-42 Fix NEXUS tile service find_tiles_by_metadata (#9)
    
    * SDAP-42 Fix NEXUS tile service find_tiles_by_metadata
    
    * SDAP-42 Fix NEXUS tile service find_tiles_by_metadata
    
    * SDAP-42 Fix NEXUS tile service find_tiles_by_metadata
---
 data-access/nexustiles/nexustiles.py | 16 +++++++++++++++-
 data-access/tests/nexustiles_test.py |  5 +++++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/data-access/nexustiles/nexustiles.py b/data-access/nexustiles/nexustiles.py
index 6ecb033..1330c03 100644
--- a/data-access/nexustiles/nexustiles.py
+++ b/data-access/nexustiles/nexustiles.py
@@ -166,7 +166,7 @@ class NexusTileService(object):
     @tile_data()
     def find_tiles_by_metadata(self, metadata, ds=None, start_time=0, end_time=-1, **kwargs):
         """
-        Return list of tiles that matches the specified metadata, start_time, end_time.
+        Return list of tiles whose metadata matches the specified metadata, start_time, end_time.
         :param metadata: List of metadata values to search for tiles e.g ["river_id_i:1", "granule_s:granule_name"]
         :param ds: The dataset name to search
         :param start_time: The start time to search for tiles
@@ -174,6 +174,20 @@ class NexusTileService(object):
         :return: A list of tiles
         """
         tiles = self._metadatastore.find_all_tiles_by_metadata(metadata, ds, start_time, end_time, **kwargs)
+
+        return tiles
+
+    def get_tiles_by_metadata(self, metadata, ds=None, start_time=0, end_time=-1, **kwargs):
+        """
+        Return list of tiles that matches the specified metadata, start_time, end_time with tile data outside of time
+        range properly masked out.
+        :param metadata: List of metadata values to search for tiles e.g ["river_id_i:1", "granule_s:granule_name"]
+        :param ds: The dataset name to search
+        :param start_time: The start time to search for tiles
+        :param end_time: The end time to search for tiles
+        :return: A list of tiles
+        """
+        tiles = self.find_tiles_by_metadata(metadata, ds, start_time, end_time, **kwargs)
         tiles = self.mask_tiles_to_time_range(start_time, end_time, tiles)
 
         return tiles
diff --git a/data-access/tests/nexustiles_test.py b/data-access/tests/nexustiles_test.py
index 9b2901e..9f533a8 100644
--- a/data-access/tests/nexustiles_test.py
+++ b/data-access/tests/nexustiles_test.py
@@ -76,6 +76,11 @@ store=cassandra""")
         for tile in tiles:
             print tile.get_summary()
 
+    def test_get_tiles_by_metadata(self):
+        tiles = self.tile_service.get_tiles_by_metadata(['id:60758e00-5721-3a6e-bf57-78448bb0aeeb'],
+                                                        "MUR-JPL-L4-GLOB-v4.1", 1514764800, 1514764800)
+        for tile in tiles:
+            print tile.get_summary()
 
 # from nexustiles.model.nexusmodel import get_approximate_value_for_lat_lon
 # import numpy as np

-- 
To stop receiving notification emails like this one, please contact
nchung@apache.org.