From a0686bdad24aae4312ba11e09f7678be61e5f852 Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Mon, 9 May 2022 15:59:21 +0200
Subject: [PATCH] L2SS-785: Fix geohash tests and precision

---
 tangostationcontrol/tangostationcontrol/beam/geo.py           | 2 +-
 tangostationcontrol/tangostationcontrol/test/beam/test_geo.py | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tangostationcontrol/tangostationcontrol/beam/geo.py b/tangostationcontrol/tangostationcontrol/beam/geo.py
index 0c541ef5c..a861ef661 100644
--- a/tangostationcontrol/tangostationcontrol/beam/geo.py
+++ b/tangostationcontrol/tangostationcontrol/beam/geo.py
@@ -55,6 +55,6 @@ def GEO_to_GEOHASH(GEO_coordinates: numpy.array) -> numpy.array:
     """ Convert an array of latitude/longitude (degrees) tuples to geohash strings. """
 
     def GEO_to_GEOHASH_fn(geo_coords):
-        return geohash.encode(geo_coords[0], geo_coords[1], precision=32)
+        return geohash.encode(geo_coords[0], geo_coords[1], precision=16)
 
     return _apply_fn_on_one_element_or_array(GEO_to_GEOHASH_fn, GEO_coordinates)
diff --git a/tangostationcontrol/tangostationcontrol/test/beam/test_geo.py b/tangostationcontrol/tangostationcontrol/test/beam/test_geo.py
index 0d2f5b0c6..d7c1f8ea9 100644
--- a/tangostationcontrol/tangostationcontrol/test/beam/test_geo.py
+++ b/tangostationcontrol/tangostationcontrol/test/beam/test_geo.py
@@ -77,14 +77,14 @@ class TestGEO_to_GEOHASH(base.TestCase):
         GEO_coords = numpy.array([1.0, 1.0])
         GEOHASH_coords = GEO_to_GEOHASH(GEO_coords)
 
-        self.assertEqual((1,), GEOHASH_coords.shape)
+        self.assertEqual(str, type(GEOHASH_coords.shape))
 
     def test_convert_array(self):
         """ Convert an array of coordinates. """
         GEO_coords = numpy.array([ [1.0, 1.0], [2.0, 2.0], [3.0, 3.0] ])
         GEOHASH_coords = GEO_to_GEOHASH(GEO_coords)
 
-        self.assertEqual((3,1), GEOHASH_coords.shape)
+        self.assertEqual((3,), GEOHASH_coords.shape)
 
     def test_CS001_LBA_regression(self):
         """ Verify if the calculated CS001LBA phase center match fixed values, to detect changes in computation. """
-- 
GitLab