You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sdap.apache.org by fg...@apache.org on 2018/09/22 01:34:50 UTC

[incubator-sdap-nexus] 01/01: Revert "SDAP-152 Error in nexus client (#41)"

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

fgreg pushed a commit to branch revert-41-SDAP-152
in repository https://gitbox.apache.org/repos/asf/incubator-sdap-nexus.git

commit 1502fb0f2058d06c1c3972202772ce92d8d8eb0b
Author: fgreg <fg...@gmail.com>
AuthorDate: Fri Sep 21 18:34:46 2018 -0700

    Revert "SDAP-152 Error in nexus client (#41)"
    
    This reverts commit 29a15f5815064a1c8889d51ee4ebdab1963dadf0.
---
 client/nexuscli/nexuscli.py           | 39 +++++++++++------------------------
 client/nexuscli/test/nexuscli_test.py |  6 ------
 2 files changed, 12 insertions(+), 33 deletions(-)

diff --git a/client/nexuscli/nexuscli.py b/client/nexuscli/nexuscli.py
index dd24310..8af07ba 100644
--- a/client/nexuscli/nexuscli.py
+++ b/client/nexuscli/nexuscli.py
@@ -53,7 +53,6 @@ __pdoc__['Point.longitude'] = "longitude value"
 __pdoc__['Point.variable'] = "dictionary of variable values"
 
 ISO_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
-PYTHON32_ISO_FORMAT = "%Y-%m-%dT%H:%M:%S%z"
 
 target = 'http://localhost:8083'
 
@@ -156,7 +155,7 @@ def daily_difference_average(dataset, bounding_box, start_datetime, end_datetime
     return time_series_result
 
 
-def time_series(datasets, bounding_box, start_datetime, end_datetime, spark=True):
+def time_series(datasets, bounding_box, start_datetime, end_datetime, spark=False):
     """
     Send a request to NEXUS to calculate a time series.
     
@@ -208,32 +207,18 @@ def time_series(datasets, bounding_box, start_datetime, end_datetime, spark=True
         time_series_data = np.array([tuple(each.values()) for each in [entry for entry in data if entry['ds'] == i]])
 
         if len(time_series_data) > 0:
-            if 'iso_time' in key_to_index:
-                time_series_result.append(
-                    TimeSeries(
-                        dataset=response['meta'][i]['shortName'],
-                        time=np.array([datetime.strptime(t, PYTHON32_ISO_FORMAT) for t in
-                                       time_series_data[:, key_to_index['iso_time']]]),
-                        mean=time_series_data[:, float(key_to_index['mean'])],
-                        standard_deviation=time_series_data[:, float(key_to_index['std'])],
-                        count=time_series_data[:, int(key_to_index['cnt'])],
-                        minimum=time_series_data[:, float(key_to_index['min'])],
-                        maximum=time_series_data[:, float(key_to_index['max'])],
-                    )
-                )
-            else:
-                time_series_result.append(
-                    TimeSeries(
-                        dataset=response['meta'][i]['shortName'],
-                        time=np.array([datetime.utcfromtimestamp(int(t)).replace(tzinfo=UTC) for t in
-                                       time_series_data[:, key_to_index['time']]]),
-                        mean=time_series_data[:, float(key_to_index['mean'])],
-                        standard_deviation=time_series_data[:, float(key_to_index['std'])],
-                        count=time_series_data[:, int(key_to_index['cnt'])],
-                        minimum=time_series_data[:, float(key_to_index['min'])],
-                        maximum=time_series_data[:, float(key_to_index['max'])],
-                    )
+            time_series_result.append(
+                TimeSeries(
+                    dataset=response['meta'][i]['shortName'],
+                    time=np.array([datetime.utcfromtimestamp(t).replace(tzinfo=UTC) for t in
+                                   time_series_data[:, key_to_index['time']]]),
+                    mean=time_series_data[:, key_to_index['mean']],
+                    standard_deviation=time_series_data[:, key_to_index['std']],
+                    count=time_series_data[:, key_to_index['cnt']],
+                    minimum=time_series_data[:, key_to_index['min']],
+                    maximum=time_series_data[:, key_to_index['max']],
                 )
+            )
 
     return time_series_result
 
diff --git a/client/nexuscli/test/nexuscli_test.py b/client/nexuscli/test/nexuscli_test.py
index 9dd083d..ec5c12e 100644
--- a/client/nexuscli/test/nexuscli_test.py
+++ b/client/nexuscli/test/nexuscli_test.py
@@ -33,12 +33,6 @@ class TestCli(unittest.TestCase):
 
         self.assertEqual(2, len(ts))
 
-    def test_time_series_spark(self):
-        ts = nexuscli.time_series("AVHRR_OI_L4_GHRSST_NCEI", box(-150, 45, -120, 60),
-                                  datetime(2005, 1, 1), datetime(2005, 1, 1), spark=True)
-
-        self.assertEqual(1, len(ts))
-
     def test_list(self):
         ds_list = nexuscli.dataset_list()