Skip to content

Commit 0c82fce

Browse files
committed
Remove numpy.NAN alias, fix mambaforge deprecation in actions
1 parent 2748de0 commit 0c82fce

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

.github/workflows/hazimp-tests.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
strategy:
1717
matrix:
18-
python-version: ['3.7', '3.8', '3.9', '3.10']
18+
python-version: ['3.8', '3.9', '3.10', '3.11']
1919
defaults:
2020
run:
2121
shell: bash -l {0}
@@ -34,7 +34,8 @@ jobs:
3434
- name: Set up environment
3535
uses: conda-incubator/setup-miniconda@v2
3636
with:
37-
miniforge-variant: Mambaforge
37+
miniforge-version: latest
38+
auto-update-conda: false
3839
channels: conda-forge,defaults
3940
channel-priority: true
4041
python-version: ${{ matrix.python-version }}

hazimp/jobs/jobs.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ def __call__(self, context, attribute_label, file_list,
675675
file_data, extent = raster_module.files_raster_data_at_points(
676676
context.exposure_long,
677677
context.exposure_lat, file_list)
678-
file_data[file_data == no_data_value] = np.NAN
678+
file_data[file_data == no_data_value] = np.nan
679679

680680
context.exposure_att[attribute_label] = file_data
681681

hazimp/raster.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def raster_data_at_points(self, lon, lat):
110110
assert lon.size == lat.size
111111

112112
values = numpy.empty(lon.size)
113-
values[:] = numpy.NAN
113+
values[:] = numpy.nan
114114

115115
# get an index of all the values inside the grid
116116
# there has to be a better way...
@@ -147,7 +147,7 @@ def read_cell(i, x, y):
147147
row_offset[index].item())
148148

149149
# Change NODATA_value to NAN
150-
values = numpy.where(values == self.no_data_value, numpy.NAN,
150+
values = numpy.where(values == self.no_data_value, numpy.nan,
151151
values)
152152

153153
return values

tests/jobs/test_jobs.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ def test_load_raster_clipping(self, mock_used):
450450
f.write('7.9, 1.5, 2, -9999\n') # Out of Haz area
451451
f.write('8.9, 2.9, 3, 6\n')
452452
f.write('8.9, 3.1, 4, -9999.\n') # Out of Haz area
453-
f.write('9.9, 2.9, 5, NaN\n') # In no data area
453+
f.write('9.9, 2.9, 5, nan\n') # In no data area
454454
f.close()
455455

456456
inst = JOBS[LOADCSVEXPOSURE]
@@ -482,7 +482,7 @@ def test_load_raster_clipping(self, mock_used):
482482
inst(con_in, **test_kwargs)
483483
the_nans = isnan(con_in.exposure_att[haz_v])
484484

485-
con_in.exposure_att.loc[the_nans, (haz_v,)] = numpy.NAN
485+
con_in.exposure_att.loc[the_nans, (haz_v,)] = numpy.nan
486486
msg = ("con_in.exposure_att[haz_v] \n" +
487487
str(con_in.exposure_att[haz_v].values))
488488
msg += "\n not = con_in.exposure_att['haz_actual'] \n" + \

tests/jobs/test_vulnerability_model.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,14 @@ def test_realised_vulnerability_curves2(self):
206206
vulnerability_set_id,
207207
default_loss)
208208

209-
intensities = asarray([[0.5, numpy.NAN], [0.1, numpy.NAN]])
209+
intensities = asarray([[0.5, numpy.nan], [0.1, numpy.nan]])
210210
loss = rvc1.look_up(intensities)
211211
actual = asarray([[0.5, 10], [0.01, 10]])
212212
msg = 'got: ' + str(loss) + '\n actual: ' + str(actual)
213213
self.assertTrue(allclose(loss,
214214
actual), msg)
215215

216-
intensities = asarray([0.5, numpy.NAN])
216+
intensities = asarray([0.5, numpy.nan])
217217
loss = rvc1.look_up(intensities)
218218
self.assertTrue(allclose(loss,
219219
asarray([0.5, 10.0])), 'got ' + str(loss))

0 commit comments

Comments
 (0)