Skip to content

Commit

Permalink
slight cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
philipc2 committed Jan 21, 2025
1 parent cc310ac commit 2486ecc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
10 changes: 5 additions & 5 deletions test/test_integrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from uxarray.grid.coordinates import _lonlat_rad_to_xyz
from uxarray.grid.integrate import _get_zonal_face_interval, _process_overlapped_intervals, \
_get_faces_constLat_intersection_info, get_non_conservative_zonal_face_weights_at_const_lat, \
get_non_conservative_zonal_face_weights_at_const_lat_overlap
get_non_conservative_zonal_face_weights_at_const_lat_original

current_path = Path(os.path.dirname(os.path.realpath(__file__)))

Expand Down Expand Up @@ -549,7 +549,7 @@ def test_get_zonal_faces_weight_at_constLat_equator():
# A error will be raise if we don't set is_latlonface=True since the face_2 will be concave if
# It's edges are all GCA
with pytest.raises(ValueError):
get_non_conservative_zonal_face_weights_at_const_lat_overlap(np.array([
get_non_conservative_zonal_face_weights_at_const_lat_original(np.array([
face_0_edge_nodes, face_1_edge_nodes, face_2_edge_nodes
]), np.deg2rad(20), latlon_bounds)

Expand Down Expand Up @@ -1007,7 +1007,7 @@ def test_get_zonal_faces_weight_at_constLat_latlonface():
})

# Assert the results is the same to the 3 decimal places
weight_df = get_non_conservative_zonal_face_weights_at_const_lat_overlap(np.array([
weight_df = get_non_conservative_zonal_face_weights_at_const_lat_original(np.array([
face_0_edge_nodes, face_1_edge_nodes, face_2_edge_nodes
]), np.sin(np.deg2rad(20)), latlon_bounds, is_latlonface=True)

Expand All @@ -1016,7 +1016,7 @@ def test_get_zonal_faces_weight_at_constLat_latlonface():
# A error will be raise if we don't set is_latlonface=True since the face_2 will be concave if
# It's edges are all GCA
with pytest.raises(ValueError):
get_non_conservative_zonal_face_weights_at_const_lat_overlap(np.array([
get_non_conservative_zonal_face_weights_at_const_lat_original(np.array([
face_0_edge_nodes, face_1_edge_nodes, face_2_edge_nodes
]), np.deg2rad(20), latlon_bounds)

Expand Down Expand Up @@ -1050,7 +1050,7 @@ def test_compare_zonal_weights():
n_nodes_per_face_candidate,
z)

existing_weights = get_non_conservative_zonal_face_weights_at_const_lat_overlap(
existing_weights = get_non_conservative_zonal_face_weights_at_const_lat_original(
faces_edge_nodes_xyz_candidate, z, bounds_candidate
)["weight"].to_numpy()

Expand Down
5 changes: 3 additions & 2 deletions uxarray/grid/integrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def _is_edge_gca(is_GCA_list, is_latlonface, edges_z):


# Correctly handles overlaps
def get_non_conservative_zonal_face_weights_at_const_lat_overlap(
def get_non_conservative_zonal_face_weights_at_const_lat_original(
faces_edges_cart_candidate: np.ndarray,
latitude_cart: float,
face_latlon_bound_candidate: np.ndarray,
Expand Down Expand Up @@ -610,9 +610,10 @@ def get_non_conservative_zonal_face_weights_at_const_lat(
z: float,
) -> np.ndarray:
"""TODO: Docstring"""

# If near equator, use original approach
if np.isclose(z, 0.0, atol=ERROR_TOLERANCE):
overlap_result = get_non_conservative_zonal_face_weights_at_const_lat_overlap(
overlap_result = get_non_conservative_zonal_face_weights_at_const_lat_original(
face_edges_xyz, z, face_bounds
)
return overlap_result["weight"].to_numpy()
Expand Down

0 comments on commit 2486ecc

Please sign in to comment.