Skip to content

Commit

Permalink
CHG: Unpinning NumPy version for GitHub CI; fix for syntax that works…
Browse files Browse the repository at this point in the history
… for latest version of NumPy
  • Loading branch information
TidbitSoftware committed Dec 14, 2024
1 parent 5bb9734 commit da6d594
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/common-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down Expand Up @@ -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')
Expand Down
8 changes: 4 additions & 4 deletions src/m/geometry/GetAreas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit da6d594

Please sign in to comment.