Commit a7d7728c authored by Benoit Bovy's avatar Benoit Bovy

.item() is not needed anymore (scalars are now set as inputs)

parent f44db4da
......@@ -142,8 +142,8 @@ class FlowRouterD8(object):
pits = xs.variable(dims=('y', 'x'), intent='out')
def initialize(self):
nx = self.x_size.item()
ny = self.y_size.item()
nx = self.x_size
ny = self.y_size
nnodes = ny * nx
self.nnodes = nnodes
......@@ -183,8 +183,8 @@ class FlowRouterD8(object):
flow_routing.compute_receivers_d8(
self._receivers, self._dist2receivers,
self._elevation,
self.x_size.item(), self.y_size.item(),
self.x_spacing.item(), self.y_spacing.item())
self.x_size, self.y_size,
self.x_spacing, self.y_spacing)
flow_routing.compute_donors(self._ndonors, self._donors,
self._receivers, self.nnodes)
flow_routing.compute_stack(self._stack,
......@@ -205,8 +205,8 @@ class FlowRouterD8(object):
self._stack, self._nbasins, self._basins,
self._outlets,
self._active_nodes, self._elevation,
self.x_size.item(), self.y_size.item(),
self.x_spacing.item(), self.y_spacing.item(),
self.x_size, self.y_size,
self.x_spacing, self.y_spacing,
method=self.pit_method)
self._nbasins = flow_routing.compute_basins(
self._basins, self._outlets,
......@@ -267,14 +267,13 @@ class StreamPower(object):
self._elevation = self.elevation.ravel()
def run_step(self, dt):
# TODO: check xarray-simlab issue #15
bedrock_channel.erode_spower(
self._erosion, self._elevation,
self._stack, self._receivers,
self._dist2receivers, self._area,
self.k_coef.item(),
self.m_exp.item(),
self.n_exp.item(),
self.k_coef,
self.m_exp,
self.n_exp,
dt, self.tolerance, self.nnodes)
......@@ -296,12 +295,11 @@ class LinearDiffusion(object):
self.erosion = np.zeros_like(self.elevation)
def run_step(self, dt):
# TODO: check xarray-simlab issue #15
hillslope_erosion.erode_linear_diffusion(
self.erosion, self.elevation,
self.k_coef.item(), dt,
self.dx.item(), self.dy.item(),
self.nx.item(), self.ny.item())
self.k_coef, dt,
self.dx, self.dy,
self.nx, self.ny)
@xs.process
......@@ -319,8 +317,8 @@ class BlockUplift(object):
def run_step(self, dt):
u_rate = self.u_coef
# TODO: check xarray-simlab issue #15
if u_rate.ndim:
if not np.isscalar(u_rate):
u_rate = u_rate[self.mask]
self.uplift[self.mask] = u_rate * dt
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment