Skip to content

Commit

Permalink
Merge pull request landlab#1956 from landlab/mcflugen/numpy-2
Browse files Browse the repository at this point in the history
Update for numpy v2
  • Loading branch information
mcflugen authored Sep 4, 2024
2 parents 303310f + 762a741 commit d426786
Show file tree
Hide file tree
Showing 90 changed files with 1,837 additions and 1,224 deletions.
4 changes: 4 additions & 0 deletions landlab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
:URL: https://landlab.readthedocs.io/en/release/
:License: MIT
"""
import numpy as np

from landlab._registry import registry
from landlab._version import __version__
from landlab.core.errors import MissingKeyError
Expand All @@ -33,6 +35,8 @@
from landlab.plot.imshowhs import imshowhs_grid
from landlab.plot.imshowhs import imshowhs_grid_at_node

np.set_printoptions(legacy="1.25")

cite_as = registry.format_citations

__all__ = [
Expand Down
4 changes: 3 additions & 1 deletion landlab/ca/boundaries/hex_lattice_tectonicizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,9 @@ def shift_link_and_transition_data_upward(self, ca, current_time):
tns = self.node_state[self.grid.node_at_link_head[lk]]
orientation = ca.link_orientation[lk]
new_link_state = (
orientation * ca.num_node_states_sq + fns * ca.num_node_states + tns
int(orientation) * ca.num_node_states_sq
+ fns * ca.num_node_states
+ tns
)

# Schedule a new transition, if applicable
Expand Down
8 changes: 5 additions & 3 deletions landlab/ca/celllab_cts.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,8 @@ def __init__(
# are tracked.
self.propid = np.arange(self.grid.number_of_nodes)
if prop_data is None:
self.prop_data = np.zeros(self.grid.number_of_nodes)
self.prop_reset_value = 0.0
self.prop_data = np.zeros(self.grid.number_of_nodes, dtype=int)
self.prop_reset_value = 0
else:
self.prop_data = prop_data
self.prop_reset_value = prop_reset_value
Expand Down Expand Up @@ -681,7 +681,9 @@ def update_link_state_new(self, link, new_link_state, current_time):
tns = self.node_state[self.grid.node_at_link_head[link]]
orientation = self.link_orientation[link]
new_link_state = int(
orientation * self.num_node_states_sq + fns * self.num_node_states + tns
int(orientation) * self.num_node_states_sq
+ fns * self.num_node_states
+ tns
)

self.link_state[link] = new_link_state
Expand Down
Loading

0 comments on commit d426786

Please sign in to comment.