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/20 21:51:12 UTC
[incubator-sdap-nexus] branch master updated: SDAP-150 Error
processing dailydifferenceaverage (#38)
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 467099a SDAP-150 Error processing dailydifferenceaverage (#38)
467099a is described below
commit 467099abc6ded68abe101c900714eaa31b89af63
Author: fgreg <fg...@gmail.com>
AuthorDate: Thu Sep 20 14:51:09 2018 -0700
SDAP-150 Error processing dailydifferenceaverage (#38)
* DDA was not passing in the metadata to the results object resulting in an Exception. Now it is passing in the metadata correctly. I also improved the logic so it will not error if no parameters are provided.
* moved build args to right before they are used to preserve cache.
* adding more broken
---
.../DailyDifferenceAverageSpark.py | 14 +++++++-----
analysis/webservice/webmodel.py | 26 ++++++++++++----------
docker/nexus-webapp/Dockerfile | 11 +++++----
3 files changed, 27 insertions(+), 24 deletions(-)
diff --git a/analysis/webservice/algorithms_spark/DailyDifferenceAverageSpark.py b/analysis/webservice/algorithms_spark/DailyDifferenceAverageSpark.py
index 1114a55..2bc511e 100644
--- a/analysis/webservice/algorithms_spark/DailyDifferenceAverageSpark.py
+++ b/analysis/webservice/algorithms_spark/DailyDifferenceAverageSpark.py
@@ -150,20 +150,22 @@ class DailyDifferenceAverageSparkImpl(SparkHandler):
average_and_std_by_day = spark_result
+ min_lon, min_lat, max_lon, max_lat = bounding_polygon.bounds
result = DDAResult(
results=[[{'time': dayms, 'mean': avg_std[0], 'std': avg_std[1], 'ds': 0}] for dayms, avg_std in
average_and_std_by_day],
- stats={},
- meta=self.get_meta(dataset))
-
- min_lon, min_lat, max_lon, max_lat = bounding_polygon.bounds
- result.extendMeta(min_lat, max_lat, min_lon, max_lon, "", start_time, end_time)
+ stats={}, meta=self.get_meta(dataset),
+ computeOptions=None, minLat=min_lat,
+ maxLat=max_lat, minLon=min_lon,
+ maxLon=max_lon, ds=dataset, startTime=start_seconds_from_epoch,
+ endTime=end_seconds_from_epoch)
+ result.meta()['climatology'] = climatology
return result
def get_meta(self, dataset):
# TODO yea this is broken
- if 'sst' in dataset.lower():
+ if 'sst' in dataset.lower() or 'mur' in dataset.lower():
meta = {
"title": "Sea Surface Temperature (SST) Anomalies",
"description": "SST anomalies are departures from the 5-day pixel mean",
diff --git a/analysis/webservice/webmodel.py b/analysis/webservice/webmodel.py
index 2b61b5f..feeb019 100644
--- a/analysis/webservice/webmodel.py
+++ b/analysis/webservice/webmodel.py
@@ -415,18 +415,20 @@ class NexusResults:
meta["shortName"] = ds
if "title" in meta and "units" in meta:
meta["label"] = "%s (%s)" % (meta["title"], meta["units"])
- meta["bounds"] = {
- "east": maxLon,
- "west": minLon,
- "north": maxLat,
- "south": minLat
- }
- meta["time"] = {
- "start": startTime,
- "stop": endTime,
- "iso_start": datetime.utcfromtimestamp(int(startTime)).replace(tzinfo=timezone('UTC')).strftime(ISO_8601),
- "iso_stop": datetime.utcfromtimestamp(int(endTime)).replace(tzinfo=timezone('UTC')).strftime(ISO_8601)
- }
+ if all(p is not None for p in [minLat, maxLat, minLon, maxLon]):
+ meta["bounds"] = {
+ "east": maxLon,
+ "west": minLon,
+ "north": maxLat,
+ "south": minLat
+ }
+ if startTime is not None and endTime is not None:
+ meta["time"] = {
+ "start": startTime,
+ "stop": endTime,
+ "iso_start": datetime.utcfromtimestamp(int(startTime)).replace(tzinfo=timezone('UTC')).strftime(ISO_8601),
+ "iso_stop": datetime.utcfromtimestamp(int(endTime)).replace(tzinfo=timezone('UTC')).strftime(ISO_8601)
+ }
return meta
def extendMeta(self, minLat, maxLat, minLon, maxLon, ds, startTime, endTime):
diff --git a/docker/nexus-webapp/Dockerfile b/docker/nexus-webapp/Dockerfile
index 9f7b21f..3b2d5f9 100644
--- a/docker/nexus-webapp/Dockerfile
+++ b/docker/nexus-webapp/Dockerfile
@@ -17,12 +17,6 @@ FROM centos:7
MAINTAINER Apache SDAP "dev@sdap.apache.org"
-ARG SPARK_VERSION=2.2.0
-ARG APACHE_NEXUSPROTO=https://github.com/apache/incubator-sdap-nexusproto.git
-ARG APACHE_NEXUSPROTO_BRANCH=master
-ARG APACHE_NEXUS=https://github.com/apache/incubator-sdap-nexus.git
-ARG APACHE_NEXUS_BRANCH=master
-
RUN yum -y update && \
yum -y install \
bzip2 \
@@ -34,6 +28,7 @@ RUN yum -y update && \
which && \
yum clean all
+ARG SPARK_VERSION=2.2.0
ENV SPARK_LOCAL_IP=127.0.0.1 \
CASSANDRA_CONTACT_POINTS=127.0.0.1 \
CASSANDRA_LOCAL_DATACENTER=datacenter1 \
@@ -83,6 +78,10 @@ RUN wget -q --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3
COPY *.sh /tmp/
# Install nexusproto and nexus
+ARG APACHE_NEXUSPROTO=https://github.com/apache/incubator-sdap-nexusproto.git
+ARG APACHE_NEXUSPROTO_BRANCH=master
+ARG APACHE_NEXUS=https://github.com/apache/incubator-sdap-nexus.git
+ARG APACHE_NEXUS_BRANCH=master
RUN /tmp/install_nexusproto.sh $APACHE_NEXUSPROTO $APACHE_NEXUSPROTO_BRANCH && \
/tmp/install_nexus.sh $APACHE_NEXUS $APACHE_NEXUS_BRANCH $NEXUS_SRC