Skip to content

Commit

Permalink
Converting inpux x,y,z to ndarrays. This could also be done centrally…
Browse files Browse the repository at this point in the history
… instead of in each reader.
  • Loading branch information
knutfrode authored and gauteh committed Nov 30, 2020
1 parent bb40c78 commit ad7771c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions opendrift/readers/reader_netCDF_CF_unstructured.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,16 @@ def get_variables(self,
* salinity
"""
logger.debug("Requested variabels: %s, lengths: %d, %d, %d" %
(requested_variables, len(x), len(y), len(z)))

x = np.atleast_1d(x)
y = np.atleast_1d(y)
z = np.atleast_1d(z)
if len(z) == 1:
z = z[0]*np.ones(x.shape)


logger.debug("Requested variabels: %s, lengths: %d, %d, %d" %
(requested_variables, len(x), len(y), len(z)))

requested_variables, time, x, y, z, outside = \
self.check_arguments(requested_variables, time, x, y, z)
Expand Down

0 comments on commit ad7771c

Please sign in to comment.