Skip to content

Commit

Permalink
Merge pull request #30 from ocefpaf/convert_connectivity_to_int
Browse files Browse the repository at this point in the history
convert connectivity to int
  • Loading branch information
rsignell-usgs authored Mar 26, 2018
2 parents 1333bbb + d91ab23 commit faff7e0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion gridgeo/ugrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"""

import numpy as np


def _valid_x(var):
names = ['longitude', 'grid_longitude', 'projection_x_coordinate']
Expand Down Expand Up @@ -54,6 +56,8 @@ def _mandatory_attr(var, attribute):
def connectivity_array(connectivity, num_ind):

array = connectivity[:]
if not issubclass(array.dtype.type, np.integer):
array = np.int_(array)
if array.shape[0] == num_ind:
array = array.T

Expand Down Expand Up @@ -112,7 +116,7 @@ def ugrid(nc):
elif _valid_y(nc[name]):
y = nc[name][:]
else:
raise ValueError(f'Could not recoginize axis for {nc[name]}')
raise ValueError(f'Could not recognize axis for {nc[name]}')
grid.update({key: {'x': x, 'y': y}})
if key in valid_connectivity.keys():
connectivity = nc[mesh_var.getncattr(key).strip()]
Expand Down

0 comments on commit faff7e0

Please sign in to comment.