@@ -11,22 +11,22 @@ def sort_mesh(mesh):
1111 """
1212 Sort cells, edges and duals in the mesh
1313 to improve cache-locality
14-
14+
1515 Parameters
1616 ----------
1717 mesh : xarray.Dataset
1818 A dataset containing an MPAS mesh to sort
19-
19+
2020 Returns
2121 -------
2222 mesh : xarray.Dataset
2323 A dataset containing the sorted MPAS mesh
2424 """
2525 # Authors: Darren Engwirda
2626
27- ncells = mesh .dims ["nCells" ]
28- nedges = mesh .dims ["nEdges" ]
29- nduals = mesh .dims ["nVertices" ]
27+ ncells = mesh .sizes ["nCells" ]
28+ nedges = mesh .sizes ["nEdges" ]
29+ nduals = mesh .sizes ["nVertices" ]
3030
3131 cell_fwd = np .arange (0 , ncells ) + 1
3232 cell_rev = np .arange (0 , ncells ) + 1
@@ -110,8 +110,8 @@ def sort_mesh(mesh):
110110 mesh ["indexToEdgeID" ][:] = np .arange (nedges ) + 1
111111
112112 return mesh
113-
114-
113+
114+
115115def main ():
116116 parser = argparse .ArgumentParser (
117117 description = __doc__ ,
@@ -135,7 +135,7 @@ def main():
135135 args .sort_file ), "graph.info" ), "w" ) as fptr :
136136 cellsOnCell = mesh ["cellsOnCell" ].values
137137
138- ncells = mesh .dims ["nCells" ]
138+ ncells = mesh .sizes ["nCells" ]
139139 nedges = np .count_nonzero (cellsOnCell ) // 2
140140
141141 fptr .write (f"{ ncells } { nedges } \n " )
@@ -152,15 +152,15 @@ def main():
152152def _sort_fwd (data , fwd ):
153153 """
154154 Apply a forward permutation to a mesh array
155-
155+
156156 Parameters
157157 ----------
158158 data : array-like
159159 An MPAS mesh array to permute
160-
160+
161161 fwd : numpy.ndarray
162- An array of integers defining the permutation
163-
162+ An array of integers defining the permutation
163+
164164 Returns
165165 -------
166166 data : numpy.ndarray
@@ -174,15 +174,15 @@ def _sort_fwd(data, fwd):
174174def _sort_rev (data , rev ):
175175 """
176176 Apply a reverse permutation to a mesh array
177-
177+
178178 Parameters
179179 ----------
180180 data : array-like
181181 An MPAS mesh array to permute
182-
182+
183183 rev : numpy.ndarray
184- An array of integers defining the permutation
185-
184+ An array of integers defining the permutation
185+
186186 Returns
187187 -------
188188 data : numpy.ndarray
@@ -197,17 +197,17 @@ def _sort_rev(data, rev):
197197def _cell_del2 (mesh ):
198198 """
199199 Form cell-to-cell sparse adjacency graph
200-
200+
201201 Parameters
202202 ----------
203203 mesh : xarray.Dataset
204204 A dataset containing an MPAS mesh to sort
205-
205+
206206 Returns
207207 -------
208208 del2 : scipy.sparse.csr_matrix
209209 The cell-to-cell adjacency graph as a sparse matrix
210- """
210+ """
211211 xvec = np .array ([], dtype = np .int8 )
212212 ivec = np .array ([], dtype = np .int32 )
213213 jvec = np .array ([], dtype = np .int32 )
@@ -236,6 +236,6 @@ def _cell_del2(mesh):
236236
237237 return csr_matrix ((xvec , (ivec , jvec )))
238238
239-
239+
240240if (__name__ == "__main__" ):\
241241 main ()
0 commit comments