OSOceanAcoustics / echopype

Enabling interoperability and scalability in ocean sonar data analysis
https://echopype.readthedocs.io/
Apache License 2.0
94 stars 73 forks source link

xarray/core/duck_array_ops.py RuntimeWarning during casting #1155

Closed emiliom closed 1 month ago

emiliom commented 12 months ago

In some circumstances which we haven't fully isolated, a warning is emitted by xarray:

... site-packages/xarray/core/duck_array_ops.py:188: RuntimeWarning: invalid value encountered in cast return data.astype(dtype, **kwargs)

Using a test OOI EK60 file, the warning is triggered by utils/coding.py:sanitize_dtypes on open_raw, here:

https://github.com/OSOceanAcoustics/echopype/blob/5abca87743ffeb3f5fba0a40f7989ef54c9d1d68/echopype/utils/coding.py#L69-L70

But I haven't gotten further in identifying the exact variable(s) and condition that lead to it.

This PR shows echopype-examples notebooks with this warning. See notebooks 2 & 3. The warning occurs on either open_raw or to_zarr. In notebook 2 (hake data) it only happens 3 times, which I assume means 3 files out of the total 170 raw files that are handled.

Originally reported in #1153

leewujung commented 1 month ago

This is the same as #1337 and fixed in #1135.