Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GRIDEDIT-1343: remove_macos12, use macos_latest #200

Merged
merged 6 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test-feature-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fail-fast: false
matrix:
platform:
- macos-12 # x86_64 (free)
- macos-13 # x86_64 (free)
- macos-14 # arm64 (free)
build_type:
- Release
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/build-and-test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
fail-fast: false
matrix:
platform:
- macos-12 # x86_64 (free)
- macos-13 # x86_64 (free)
- macos-13-xlarge # arm64 (billable)
- macos-14 # arm64 (free)
Expand Down
14 changes: 5 additions & 9 deletions meshkernel/meshkernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1648,40 +1648,36 @@ def mesh2d_get_orthogonality(self) -> GeometryList:

return geometry_list_out

def mesh2d_get_property(self, property: Mesh2d.Property) -> GeometryList:
def mesh2d_get_property(
self, mesh2d_location: Mesh2dLocation, property: Mesh2d.Property
) -> GeometryList:
"""Gets the polygons matching the metric value within the minimum and maximum value.

Args:

mesh2d_location (Mesh2dLocation): Location of the property
property (Mesh2d.Property): The property to retrieve

Returns:
GeometryList: The resulting geometry list containing the value of the properties
"""

c_geometry_list_dimension = c_int()

self._execute_function(
self.lib.mkernel_mesh2d_get_property_dimension,
self._meshkernelid,
c_int(property),
byref(c_geometry_list_dimension),
)

n_coordinates = c_geometry_list_dimension.value
x_coordinates = np.empty(n_coordinates, dtype=np.double)
y_coordinates = np.empty(n_coordinates, dtype=np.double)
values = np.empty(n_coordinates, dtype=np.double)

property_list = GeometryList(
x_coordinates=x_coordinates, y_coordinates=y_coordinates, values=values
)
c_property_list = CGeometryList.from_geometrylist(property_list)

self._execute_function(
self.lib.mkernel_mesh2d_get_property,
self._meshkernelid,
c_int(property),
c_int(mesh2d_location.value),
byref(c_property_list),
)

Expand Down
4 changes: 3 additions & 1 deletion scripts/install_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ scl enable "${DEVTOOLSET}" bash || error "[scl] Failed to enable ${DEVTOOLSET}"
# install boost
BOOST_LIB=boost_"${BOOST_VERSION//./_}"
# Official mirror
BOOST_MIRROR=https://boostorg.jfrog.io/artifactory/main/release/"${BOOST_VERSION}"/source/"${BOOST_LIB}".tar.gz
# BOOST_MIRROR=https://boostorg.jfrog.io/artifactory/main/release/"${BOOST_VERSION}"/source/"${BOOST_LIB}".tar.gz
# Alternative mirror to use if the official mirror is down
# BOOST_MIRROR=https://mirror.bazel.build/boostorg.jfrog.io/artifactory/main/release/"${BOOST_VERSION}"/source/"${BOOST_LIB}".tar.gz
# sourceforge
BOOST_MIRROR=https://sourceforge.net/projects/boost/files/boost/"${BOOST_VERSION}"/"${BOOST_LIB}".tar.gz
wget "${BOOST_MIRROR}" || error "[boost] ${BOOST_LIB}.tar.gz download failed"
export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/usr/local/lib64:/usr/lib64:"$LD_LIBRARY_PATH"
tar -xzf "${BOOST_LIB}".tar.gz || error "[boost] ${BOOST_LIB}.tar.gz extraction failed"
Expand Down
4 changes: 2 additions & 2 deletions tests/test_curvilinear_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,8 +548,8 @@ def test_curvilinear_line_attraction_repulsion():
# Get the result
curvilinear_grid = mk.curvilineargrid_get()

# Test a node on the third grid line was shifted from 20 to 15
assert curvilinear_grid.node_x[2] == 15.0
# Test a node on the third grid line was shifted from 20 to 25
assert curvilinear_grid.node_x[2] == 25.0


def test_curvilinear_line_mirror():
Expand Down
11 changes: 7 additions & 4 deletions tests/test_mesh2d_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,8 +660,8 @@ def test_mesh2d_make_global():
mk.mesh2d_make_global(num_longitude_nodes, num_latitude_nodes)
mesh2d = mk.mesh2d_get()

assert mesh2d.edge_x.size == 1233
assert mesh2d.node_x.size == 629
assert mesh2d.edge_x.size == 1225
assert mesh2d.node_x.size == 621


def test_mesh2d_make_global_with_cartesian_coordinates_should_throw():
Expand Down Expand Up @@ -2311,6 +2311,7 @@ def test_mesh2d_deletion_and_get_orthogonality(
cases_get_property = [
(
Mesh2d.Property.ORTHOGONALITY,
Mesh2dLocation.EDGES,
np.array(
[
-999.0,
Expand Down Expand Up @@ -2343,6 +2344,7 @@ def test_mesh2d_deletion_and_get_orthogonality(
),
(
Mesh2d.Property.EDGE_LENGTHS,
Mesh2dLocation.EDGES,
np.array(
[
100.0,
Expand Down Expand Up @@ -2377,20 +2379,21 @@ def test_mesh2d_deletion_and_get_orthogonality(


@pytest.mark.parametrize(
"property, expected_values",
"property, location, expected_values",
cases_get_property,
)
def test_mesh2d_get_property(
meshkernel_with_mesh2d: MeshKernel,
property: Mesh2d.Property,
location: Mesh2dLocation,
expected_values: ndarray,
):
"""Test mesh2d_get_property,
getting the mesh2d property values
"""
mk = meshkernel_with_mesh2d(rows=3, columns=3, spacing_x=50.0, spacing_y=100.0)

property_list = mk.mesh2d_get_property(property)
property_list = mk.mesh2d_get_property(location, property)

assert property_list.values == approx(expected_values, abs=1e-6)

Expand Down
Loading