fgreg closed pull request #38: SDAP-150 Error processing dailydifferenceaverage
URL: https://github.com/apache/incubator-sdap-nexus/pull/38
 
 
   

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_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 @@ def calc(self, request, **args):
 
         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 @@ def _extendMeta(self, meta, minLat, maxLat, minLon, 
maxLon, ds, startTime, endTi
         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 "[email protected]"
 
-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
 


 

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to