Hello,
In opendrift/elements/elements.py, there are a few places where the variable dtype is not preserved. This happens whenever np.ones is called. I am wondering if this is by design and if so why that is.
For instance:
# Status must always be array
if not type(self.status) == np.ndarray:
self.status = self.status*np.ones(self.lon.shape)
could become
# Status must always be array
if not isinstance(self.status, np.ndarray):
dtype = self.variables['status']['dtype']
self.status = self.status*np.ones(self.lon.shape, dtype=dtype)
This prevents self.status from being an np.float64.
I am attaching a file showing all instances (please diff against current version of this file).
elements.txt
Thanks
Hello,
In opendrift/elements/elements.py, there are a few places where the variable dtype is not preserved. This happens whenever
np.onesis called. I am wondering if this is by design and if so why that is.For instance:
could become
This prevents
self.statusfrom being annp.float64.I am attaching a file showing all instances (please diff against current version of this file).
elements.txt
Thanks