diff --git a/quagmire/mesh/commonmesh.py b/quagmire/mesh/commonmesh.py index 6e73257..990d369 100644 --- a/quagmire/mesh/commonmesh.py +++ b/quagmire/mesh/commonmesh.py @@ -185,7 +185,7 @@ def get_label(self, label): pt_range = np.logical_and(labelIS.indices >= pStart, labelIS.indices < pEnd) indices = labelIS.indices[pt_range] - pStart else: - indices = np.zeros((0,), dtype=np.int) + indices = np.zeros((0,), dtype=PETSc.IntType) return indices diff --git a/quagmire/mesh/pixmesh.py b/quagmire/mesh/pixmesh.py index 834de5c..c7a8fac 100644 --- a/quagmire/mesh/pixmesh.py +++ b/quagmire/mesh/pixmesh.py @@ -259,10 +259,10 @@ def interpolate(self, xi, yi, zdata, order=1): """ grid = np.array(zdata).reshape(self.ny, self.nx) - icoords = np.array(np.c_[xi,yi], dtype=np.float) + icoords = np.array(np.c_[xi,yi], dtype=np.float32) # check if inside bounds - inside_bounds = np.zeros(icoords.shape[0], dtype=np.bool) + inside_bounds = np.zeros(icoords.shape[0], dtype=bool) inside_bounds += icoords[:,0] < self.minX inside_bounds += icoords[:,0] > self.maxX inside_bounds += icoords[:,1] < self.minY @@ -282,7 +282,7 @@ def interpolate(self, xi, yi, zdata, order=1): # now interpolate ival = _map_coordinates(grid.T, icoords.T, order=order, mode='nearest') - return ival, inside_bounds.astype(np.int) + return ival, inside_bounds.astype(PETSc.IntType) def derivatives(self, PHI, **kwargs): return self.derivative_grad(PHI, **kwargs) @@ -384,8 +384,8 @@ def construct_natural_neighbour_cloud(self): numpy array for efficient lookup. """ - natural_neighbours = np.empty((self.npoints, 9), dtype=np.int) - nodes = np.arange(0, self.npoints, dtype=np.int).reshape(self.ny,self.nx) + natural_neighbours = np.empty((self.npoints, 9), dtype=PETSc.IntType) + nodes = np.arange(0, self.npoints, dtype=PETSc.IntType).reshape(self.ny,self.nx) index = np.pad(nodes, (1,1), mode='constant', constant_values=-1) @@ -441,14 +441,14 @@ def construct_neighbour_cloud(self, size=25): corners = [0, self.nx-1, -self.nx, -1] # interior nodes have 3*3 neighbours (including self) - neighbours = np.full(self.npoints, 9, dtype=np.int) + neighbours = np.full(self.npoints, 9, dtype=PETSc.IntType) neighbours[~self.bmask] = 6 # walls have 3*2 neighbours neighbours[corners] = 4 # corners have 4 neighbours self.near_neighbours = neighbours + 2 self.extended_neighbours = np.full_like(neighbours, size) - # self.near_neighbour_mask = np.zeros_like(self.neighbour_cloud, dtype=np.bool) + # self.near_neighbour_mask = np.zeros_like(self.neighbour_cloud, dtype=bool) # for node in range(0,self.npoints): # self.near_neighbour_mask[node, 0:self.near_neighbours[node]] = True diff --git a/quagmire/mesh/strimesh.py b/quagmire/mesh/strimesh.py index fdfe26b..ee14519 100644 --- a/quagmire/mesh/strimesh.py +++ b/quagmire/mesh/strimesh.py @@ -494,7 +494,7 @@ def construct_natural_neighbour_cloud(self): lend = self.tri.lend lptr = self.tri.lptr - segments_array = np.empty((len(lptr),2),dtype=np.int) + segments_array = np.empty((len(lptr),2),dtype=PETSc.IntType) segments_array[:,0] = np.abs(lst[:]) - 1 segments_array[:,1] = np.abs(lst[lptr[:]-1]) - 1 @@ -511,7 +511,7 @@ def construct_natural_neighbour_cloud(self): istart = np.zeros_like(iend) istart[1:] = iend[:-1] - natural_neighbours = np.full((self.npoints, natural_neighbours_count.max()+1), -1, dtype=np.int) + natural_neighbours = np.full((self.npoints, natural_neighbours_count.max()+1), -1, dtype=PETSc.IntType) for j in range(0,self.npoints): natural_neighbours[j, 0] = j diff --git a/quagmire/mesh/trimesh.py b/quagmire/mesh/trimesh.py index f36d017..00d1dc0 100644 --- a/quagmire/mesh/trimesh.py +++ b/quagmire/mesh/trimesh.py @@ -358,7 +358,7 @@ def construct_natural_neighbour_cloud(self): lend = self.tri.lend lptr = self.tri.lptr - segments_array = np.empty((len(lptr),2),dtype=np.int) + segments_array = np.empty((len(lptr),2),dtype=PETSc.IntType) segments_array[:,0] = np.abs(lst[:]) - 1 segments_array[:,1] = np.abs(lst[lptr[:]-1]) - 1 @@ -375,7 +375,7 @@ def construct_natural_neighbour_cloud(self): istart = np.zeros_like(iend) istart[1:] = iend[:-1] - natural_neighbours = np.full((self.npoints, natural_neighbours_count.max()+1), -1, dtype=np.int) + natural_neighbours = np.full((self.npoints, natural_neighbours_count.max()+1), -1, dtype=PETSc.IntType) for j in range(0,self.npoints): natural_neighbours[j, 0] = j diff --git a/quagmire/tools/meshtools.py b/quagmire/tools/meshtools.py index 01e0b64..4e1a1b2 100644 --- a/quagmire/tools/meshtools.py +++ b/quagmire/tools/meshtools.py @@ -581,10 +581,10 @@ def _create_DMPlex(points, simplices, boundary_vertices=None, refinement_levels= mesh_type = {2: "TriMesh", 3: "sTriMesh"} if PETSc.COMM_WORLD.rank == 0: - coords = _np.array(points, dtype=_np.float) + coords = _np.array(points, dtype=_np.float32) cells = simplices.astype(PETSc.IntType) else: - coords = _np.zeros((0,ndim), dtype=_np.float) + coords = _np.zeros((0,ndim), dtype=_np.float32) cells = _np.zeros((0,3), dtype=PETSc.IntType) dim = 2 @@ -1011,6 +1011,6 @@ def map_global_raster_to_strimesh(mesh, latlongrid, order=3, origin="lower", uni icoords = np.array((ilons, ilats)) - mvals = ndimage.map_coordinates(raster, icoords , order=order, mode='nearest').astype(np.float) + mvals = ndimage.map_coordinates(raster, icoords , order=order, mode='nearest').astype(np.float32) return mvals \ No newline at end of file diff --git a/quagmire/topomesh/topomesh.py b/quagmire/topomesh/topomesh.py index a0fe233..e30a7ea 100644 --- a/quagmire/topomesh/topomesh.py +++ b/quagmire/topomesh/topomesh.py @@ -677,7 +677,7 @@ def _node_walk_downhill(self, node): """ """ - chain = -np.ones(self.npoints, dtype=np.int32) + chain = -np.ones(self.npoints, dtype=PETSc.IntType32) idx = 0 max_idx = self.npoints @@ -717,7 +717,7 @@ def build_node_chains(self): """ """ - self.node_chain_lookup = -np.ones(self.npoints, dtype=np.int32) + self.node_chain_lookup = -np.ones(self.npoints, dtype=PETSc.IntType32) self.node_chain_list = [] node_chain_idx = 1 @@ -852,7 +852,7 @@ def low_points_swamp_fill(self, its=1000, saddles=None, ref_height=0.0, ref_grad my_glow_points = self.lgmap_row.apply(my_low_points.astype(PETSc.IntType)) t = perf_counter() - ctmt = self.uphill_propagation(my_low_points, my_glow_points, its=its, fill=-999999).astype(np.int) + ctmt = self.uphill_propagation(my_low_points, my_glow_points, its=its, fill=-999999).astype(PETSc.IntType) height = self.topography.data.copy() @@ -1077,7 +1077,7 @@ def identify_low_points(self, include_shadows=False, ref_height=0): # from petsc4py import PETSc - nodes = np.arange(0, self.npoints, dtype=np.int) + nodes = np.arange(0, self.npoints, dtype=PETSc.IntType) gnodes = self.lgmap_row.apply(nodes.astype(PETSc.IntType)) low_nodes = self.down_neighbour[1] @@ -1142,7 +1142,7 @@ def identify_outflow_points(self): Identify the (boundary) outflow points and return an array of (local) node indices """ - # nodes = np.arange(0, self.npoints, dtype=np.int) + # nodes = np.arange(0, self.npoints, dtype=PETSc.IntType) # low_nodes = self.down_neighbour[1] # mask = np.logical_and(nodes == low_nodes, self.bmask == False) #