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 baede7b  Added ReadTimeout exception to redirect, applied hofmoeller 
point data_vals bugfix (#203)
baede7b is described below

commit baede7b488f00f191dac2f77cae39a6d566e92e7
Author: Kevin <[email protected]>
AuthorDate: Wed Oct 5 09:33:28 2022 -0700

    Added ReadTimeout exception to redirect, applied hofmoeller point data_vals 
bugfix (#203)
---
 analysis/webservice/algorithms/HofMoeller.py            | 4 ++--
 analysis/webservice/algorithms_spark/HofMoellerSpark.py | 2 +-
 analysis/webservice/redirect/RemoteSDAPCache.py         | 9 ++++-----
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/analysis/webservice/algorithms/HofMoeller.py 
b/analysis/webservice/algorithms/HofMoeller.py
index 012bdea..6bb805a 100644
--- a/analysis/webservice/algorithms/HofMoeller.py
+++ b/analysis/webservice/algorithms/HofMoeller.py
@@ -55,7 +55,7 @@ class LongitudeHofMoellerCalculator(object):
         points_by_lon = itertools.groupby(data, key=lambda p: p.longitude)
 
         for lon, points_at_lon in points_by_lon:
-            values_at_lon = np.array([point.data_val for point in 
points_at_lon])
+            values_at_lon = np.array([point.data_vals for point in 
points_at_lon])
             stat['lons'].append({
                 'longitude': float(lon),
                 'cnt': len(values_at_lon),
@@ -81,7 +81,7 @@ class LatitudeHofMoellerCalculator(object):
         points_by_lat = itertools.groupby(data, key=lambda p: p.latitude)
 
         for lat, points_at_lat in points_by_lat:
-            values_at_lat = np.array([point.data_val for point in 
points_at_lat])
+            values_at_lat = np.array([point.data_vals for point in 
points_at_lat])
 
             stat['lats'].append({
                 'latitude': float(lat),
diff --git a/analysis/webservice/algorithms_spark/HofMoellerSpark.py 
b/analysis/webservice/algorithms_spark/HofMoellerSpark.py
index b26a009..6231bdb 100644
--- a/analysis/webservice/algorithms_spark/HofMoellerSpark.py
+++ b/analysis/webservice/algorithms_spark/HofMoellerSpark.py
@@ -71,7 +71,7 @@ class HofMoellerCalculator(object):
             points_by_coord = itertools.groupby(data, key=lambda p: 
p.longitude)
 
         for coord, points_at_coord in points_by_coord:
-            values_at_coord = np.array([[p.data_val,
+            values_at_coord = np.array([[p.data_vals,
                                          np.cos(np.radians(p.latitude))]
                                         for p in points_at_coord])
             vals = np.nan_to_num(values_at_coord[:, 0])
diff --git a/analysis/webservice/redirect/RemoteSDAPCache.py 
b/analysis/webservice/redirect/RemoteSDAPCache.py
index 2568ab1..e60cc72 100644
--- a/analysis/webservice/redirect/RemoteSDAPCache.py
+++ b/analysis/webservice/redirect/RemoteSDAPCache.py
@@ -31,9 +31,9 @@ class RemoteSDAPCache:
                     outdated_at=datetime.now()+timedelta(seconds=max_age)
                 )
             else:
-                raise CollectionNotFound("url %s was not reachable, responded 
with status %s", list_url, r.status_code)
-        except requests.exceptions.ConnectTimeout as e:
-            raise CollectionNotFound("url %s was not reachable in %i s",  
list_url, timeout)
+                raise CollectionNotFound(f"url {list_url} was not reachable, 
responded with status {r.status_code}")
+        except (requests.exceptions.ConnectTimeout, 
requests.exceptions.ReadTimeout) as e:
+            raise CollectionNotFound(f"url {list_url} was not reachable in 
{timeout} s")
 
     def get(self, url, short_name):
         stripped_url = url.strip('/')
@@ -44,5 +44,4 @@ class RemoteSDAPCache:
             if 'shortName' in collection and collection['shortName'] == 
short_name:
                 return collection
 
-        raise CollectionNotFound("collection %s has not been found in url %s", 
short_name, stripped_url)
-
+        raise CollectionNotFound(f"collection {short_name} has not been found 
in url {stripped_url}")
\ No newline at end of file

Reply via email to