1010import uxarray as ux
1111
1212from uxarray .grid .coordinates import _lonlat_rad_to_xyz
13- from uxarray .grid .arcs import point_within_gca , _point_within_gca_cartesian
13+ from uxarray .grid .arcs import point_within_gca
1414
1515try :
1616 import constants
@@ -31,29 +31,29 @@ class TestIntersectionPoint(TestCase):
3131 def test_pt_within_gcr (self ):
3232 # The GCR that's eexactly 180 degrees will have Value Error raised
3333
34- gcr_180degree_cart = [
34+ gcr_180degree_cart = np . asarray ( [
3535 _lonlat_rad_to_xyz (0.0 , np .pi / 2.0 ),
3636 _lonlat_rad_to_xyz (0.0 , - np .pi / 2.0 )
37- ]
37+ ])
38+ pt_same_lon_in = np .asarray (_lonlat_rad_to_xyz (0.0 , 0.0 ))
3839
39- pt_same_lon_in = _lonlat_rad_to_xyz (0.0 , 0.0 )
4040 with self .assertRaises (ValueError ):
41- _point_within_gca_cartesian (pt_same_lon_in , gcr_180degree_cart )
42-
41+ point_within_gca (pt_same_lon_in , gcr_180degree_cart [ 0 ], gcr_180degree_cart [ 1 ] )
42+ #
4343 # Test when the point and the GCA all have the same longitude
44- gcr_same_lon_cart = [
44+ gcr_same_lon_cart = np . asarray ( [
4545 _lonlat_rad_to_xyz (0.0 , 1.5 ),
4646 _lonlat_rad_to_xyz (0.0 , - 1.5 )
47- ]
48- pt_same_lon_in = _lonlat_rad_to_xyz (0.0 , 0.0 )
49- self .assertTrue (_point_within_gca_cartesian (pt_same_lon_in , gcr_same_lon_cart ))
47+ ])
48+ pt_same_lon_in = np . asarray ( _lonlat_rad_to_xyz (0.0 , 0.0 ) )
49+ self .assertTrue (point_within_gca (pt_same_lon_in , gcr_same_lon_cart [ 0 ], gcr_same_lon_cart [ 1 ] ))
5050
51- pt_same_lon_out = _lonlat_rad_to_xyz (0.0 , 1.5000001 )
52- res = _point_within_gca_cartesian (pt_same_lon_out , gcr_same_lon_cart )
51+ pt_same_lon_out = np . asarray ( _lonlat_rad_to_xyz (0.0 , 1.5000001 ) )
52+ res = point_within_gca (pt_same_lon_out , gcr_same_lon_cart [ 0 ], gcr_same_lon_cart [ 1 ] )
5353 self .assertFalse (res )
5454
55- pt_same_lon_out_2 = _lonlat_rad_to_xyz (0.1 , 1.0 )
56- res = _point_within_gca_cartesian (pt_same_lon_out_2 , gcr_same_lon_cart )
55+ pt_same_lon_out_2 = np . asarray ( _lonlat_rad_to_xyz (0.1 , 1.0 ) )
56+ res = point_within_gca (pt_same_lon_out_2 , gcr_same_lon_cart [ 0 ], gcr_same_lon_cart [ 1 ] )
5757 self .assertFalse (res )
5858
5959 def test_pt_within_gcr_antimeridian (self ):
@@ -64,13 +64,13 @@ def test_pt_within_gcr_antimeridian(self):
6464 pt_cart = np .array (
6565 [0.9438777657502077 , 0.1193199333436068 , 0.922714737029319 ])
6666 self .assertTrue (
67- _point_within_gca_cartesian (pt_cart , gcr_cart ))
67+ point_within_gca (pt_cart , gcr_cart [ 0 ], gcr_cart [ 1 ] ))
6868
6969 gcr_cart_flip = np .array ([[0.617 , 0.672 , 0.410 ], [0.351 , - 0.724 ,
7070 0.593 ]])
7171 # If we flip the gcr in the undirected mode, it should still work
7272 self .assertTrue (
73- _point_within_gca_cartesian (pt_cart , gcr_cart_flip ))
73+ point_within_gca (pt_cart , gcr_cart_flip [ 0 ], gcr_cart_flip [ 1 ] ))
7474
7575 # 2nd anti-meridian case
7676 # GCR vertex0 in radian : [4.104711496596806, 0.5352983676533828],
@@ -81,7 +81,7 @@ def test_pt_within_gcr_antimeridian(self):
8181 pt_cart_within = np .array (
8282 [0.6136726305712109 , 0.28442243941920053 , - 0.365605190899831 ])
8383 self .assertFalse (
84- _point_within_gca_cartesian (pt_cart_within , gcr_cart_1 ))
84+ point_within_gca (pt_cart_within , gcr_cart_1 [ 0 ], gcr_cart_1 [ 1 ] ))
8585
8686
8787
@@ -93,5 +93,4 @@ def test_pt_within_gcr_cross_pole(self):
9393 # Normalize the point abd the GCA
9494 pt_cart = pt_cart / np .linalg .norm (pt_cart )
9595 gcr_cart = np .array ([x / np .linalg .norm (x ) for x in gcr_cart ])
96- self .assertTrue (_point_within_gca_cartesian (pt_cart , gcr_cart ))
97-
96+ self .assertTrue (point_within_gca (pt_cart , gcr_cart [0 ], gcr_cart [1 ]))
0 commit comments