-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test failure on RISC-V platform #9815
Comments
Thanks for opening your first issue here at xarray! Be sure to follow the issue template! |
Thanks. I suspect this is an issue with the underlying dependency, given it only occurs in netcdf tests. We could skip the tests when running under that arch? |
I'm not sure what test this is, but xarray passes all other tests in riscv64. |
Yes great, we would take a PR to skip them (doesn't have to be from you tbc, I know you're already being generous by packaging this...) |
These four tests actually fail on all non- It seems like a -1 is replaced by a 10; is that some kind of fill value, or something else? |
If I've understood this roundtrip test correctly, it starts with a dataset of My guess is that somewhere is using plain Is this encoding done in xarray or in netCDF? |
Ah, looking through more of the code, I've found the encoding in
So the error occurs during encoding, not decoding necessarily. Given that the test has in the encoding For example, on
but on
So either this test, or xarray itself is doing something incorrect in this encoding mode. |
PS, here is the backtrace if I make the
|
@QuLogic Thanks for diving into this. From the stack trace and your examples that looks like something like this: So, if we change this line: coding/variables.py:429: in encode
data = duck_array_ops.astype(duck_array_ops.around(data), dtype) to coding/variables.py:429: in encode
data = duck_array_ops.astype(duck_array_ops.around(data), dtype, casting="safe") We will also see this issue in our test suite. @QuLogic In the linked issue they suggested to do something like this: coding/variables.py:429: in encode
signed_dtype = np.dtype(f"i{dtype.itemsize}")
data = duck_array_ops.astype(duck_array_ops.astype(duck_array_ops.around(data), signed_dtype), dtype, casting="safe") Will this help in your setup? Update: Nevermind, this might still break. Can we somehow use |
Unfortunately, that won't work with But then, I have to ask, is this test actually correct? If you want to encode some floating-point data that might include negative values to an unsigned type, don't you want to shift things to be all positive and not rely on casting rules that may differ between types? In other words, should Though actually trying that, the 22.7 would overflow, so something like However, this breaks in a different way because the reader appears to incorrectly read as |
Some Xref on the
|
OK, so netCDF3 didn't support unsigned data types, and some people hacked around it with an attribute OK, I think you can only have that work with unsafe casting then. Namely, your suggestion with unsafe:
or relying on the default:
or, if you do
|
@QuLogic Yes, that's how it is, unfortunately. |
What happened?
I am a Fedora packager
When I run pytest on the RISC-V platform, I got four failures
What did you expect to happen?
No response
Minimal Complete Verifiable Example
MVCE confirmation
Relevant log output
Anything else we need to know?
TestNetCDF4ViaDaskData::test_roundtrip_mask_and_scale
TestNetCDF4Data::test_roundtrip_mask_and_scale
Environment
commit: 1bb867d
python: 3.13.0 (main, Oct 8 2024, 00:00:00) [GCC 14.2.1 20240912 (Red Hat 14.2.1-3)]
python-bits: 64
OS: Linux
OS-release: 6.1.55
machine: riscv64
processor:
byteorder: little
LC_ALL: None
LANG: C.UTF-8
LOCALE: ('C', 'UTF-8')
libhdf5: 1.12.1
libnetcdf: 4.9.2
xarray: 2024.11.0
pandas: 2.2.1
numpy: 1.26.4
scipy: 1.11.3
netCDF4: 1.7.1
pydap: None
h5netcdf: None
h5py: None
zarr: 2.18.3
cftime: 1.6.4
nc_time_axis: None
iris: None
bottleneck: 1.3.7
dask: 2024.9.1
distributed: None
matplotlib: 3.9.1
cartopy: None
seaborn: 0.13.2
numbagg: None
fsspec: 2024.3.1
cupy: None
pint: 0.24.4
sparse: None
flox: None
numpy_groupies: None
setuptools: 69.2.0
pip: 24.2
conda: None
pytest: 8.3.3
mypy: None
IPython: None
sphinx: 7.3.7
The text was updated successfully, but these errors were encountered: