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:32:05 UTC
[incubator-sdap-nexus] branch master updated: Revert "SDAP-152
Error in nexus client (#39)" (#40)
This is an automated email from the ASF dual-hosted git repository.
fgreg 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 52ff437 Revert "SDAP-152 Error in nexus client (#39)" (#40)
52ff437 is described below
commit 52ff437672a54ab9f9d2e5e167c463cd1e07cd55
Author: fgreg <fg...@gmail.com>
AuthorDate: Fri Sep 21 18:32:00 2018 -0700
Revert "SDAP-152 Error in nexus client (#39)" (#40)
This reverts commit a888889f825c363aba8df43f0a94b3eec9a7dd22.
---
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 3369a70..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[:, 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']],
- )
- )
- 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[:, 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']],
- )
+ 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()