From da6d594e1994bc9fce1fc485d797a48bf4fe252f Mon Sep 17 00:00:00 2001 From: Tidbit Software Date: Sat, 14 Dec 2024 12:04:57 -0800 Subject: [PATCH] CHG: Unpinning NumPy version for GitHub CI; fix for syntax that works for latest version of NumPy --- .github/workflows/common-workflow.yml | 4 ++-- src/m/geometry/GetAreas.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/common-workflow.yml b/.github/workflows/common-workflow.yml index 6327b2b5..4cbb2277 100644 --- a/.github/workflows/common-workflow.yml +++ b/.github/workflows/common-workflow.yml @@ -78,7 +78,7 @@ jobs: sudo apt-get install python3-dev python -m pip install --upgrade pip sudo apt-get update && sudo apt-get install -y python-tk python3-tk - python -m pip install numpy==2.1.0 scipy matplotlib nose + python -m pip install numpy scipy matplotlib nose - name: Build ISSM run: | @@ -172,7 +172,7 @@ jobs: run: | python -m pip install --upgrade pip sudo apt-get update && sudo apt-get install -y python-tk python3-tk - python -m pip install numpy==2.1.0 scipy matplotlib nose netCDF4 + python -m pip install numpy scipy matplotlib nose netCDF4 - name: Run Python tests if: contains(inputs.interface, 'python') diff --git a/src/m/geometry/GetAreas.py b/src/m/geometry/GetAreas.py index 8f2815be..74f3580d 100644 --- a/src/m/geometry/GetAreas.py +++ b/src/m/geometry/GetAreas.py @@ -20,13 +20,13 @@ def GetAreas(index, x, y, z=np.array([])): nods = np.shape(x)[0] # Some checks - if np.shape(y)[0] != nods or (z and np.shape(z)[0] != nods): + if (np.shape(y)[0] != nods) or (z.size > 0 and np.shape(z)[0] != nods): raise TypeError('GetAreas error message: x, y and z do not have the same length.') if np.max(index) > nods: raise TypeError('GetAreas error message: index should not have values above {}.'.format(nods)) - if (not z and np.shape(index)[1] != 3): + if z.size == 0 and np.shape(index)[1] != 3: raise TypeError('GetAreas error message: index should have 3 columns for 2d meshes.') - if (z and np.shape(index)[1] != 6): + if z.size > 0 and np.shape(index)[1] != 6: raise TypeError('GetAreas error message: index should have 6 columns for 3d meshes.') # Initialization @@ -39,7 +39,7 @@ def GetAreas(index, x, y, z=np.array([])): y3 = y[index[:, 2] - 1] # Compute the volume of each element - if not z: + if z.size == 0: # Compute the surface of the triangle areas = (0.5 * ((x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1))) else: