Skip to content

Commit

Permalink
Merge pull request #70 from nismod/fix/68-numpy
Browse files Browse the repository at this point in the history
Fix numpy 2.0.0 compatibility
  • Loading branch information
tomalrussell authored Jun 27, 2024
2 parents 1c330be + cc8616d commit 7f9152e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
[![Build](https://github.com/nismod/snail/actions/workflows/build.yml/badge.svg)](https://github.com/nismod/snail/actions/workflows/build.yml)
[![License](https://img.shields.io/pypi/l/nismod-snail.svg)](https://opensource.org/licenses/MIT)

> This code is under early development
# 🤔 What is this?

This is a Python package to help with analysis of the potential impacts of
Expand Down Expand Up @@ -108,7 +106,7 @@ Change directory into the root of the project:

To create and activate a conda environment with snail's dependencies installed:

conda env create -f .environment.yml
conda env create -f environment.yml
conda activate snail-dev

Run this to install the source code as a package:
Expand Down
16 changes: 8 additions & 8 deletions .environment.yml → environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ dependencies:
- matplotlib
- nbstripout
- networkx
- numpy <2.0.0
- numpy
- openpyxl
- pandera
- pip
- pyarrow
- pyogrio
Expand All @@ -25,9 +24,10 @@ dependencies:
- shapely
- scipy
- pip:
- hilbertcurve
- irv_autopkg_client
- python-igraph
- snkit
- tqdm
- -e .
- hilbertcurve
- irv_autopkg_client
- pandera>=0.20.0
- python-igraph
- snkit
- tqdm
- -e .
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ requires-python = ">=3.8"
dependencies = [
"geopandas",
"matplotlib",
"numpy<2.0.0",
"numpy",
"openpyxl",
"pandera",
"pyarrow",
Expand Down
3 changes: 2 additions & 1 deletion tests/test_damages.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test damage assessment"""

import os

import numpy
Expand Down Expand Up @@ -115,7 +116,7 @@ def test_linear_curve_interpolation(curve):
def test_linear_curve_out_of_bounds(curve):
# sense-check out-of-bounds
intensities = numpy.array(
[numpy.NINF, -999, numpy.NZERO, 0, 30, 999, numpy.inf, numpy.nan]
[-numpy.inf, -999, -0.0, 0, 30, 999, numpy.inf, numpy.nan]
)
expected = numpy.array([0, 0, 0, 0, 1, 1, 1, numpy.nan])
actual = curve.damage_fraction(intensities)
Expand Down

0 comments on commit 7f9152e

Please sign in to comment.