-
Notifications
You must be signed in to change notification settings - Fork 335
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
Unnecessary warnings when working with some netcdf files #8232
Comments
If I compile it with MSVC the result is correct. |
Different results with different compilers. The fmod function is more unpredictable than I thought. |
Or a GCC bug?
OK, it does nothing that line but is not the source of the problem either.
Do you mind to elaborate a bit more (I don't understand it)? And a grid to grid to reproduce the problem is ... you know. |
This is unlikely to be a bug of any compiler. More like undefined behavior.
I was too lazy to fill out another bug report )
Something like 0.5, 1.5, 2.5, etc.
ptemp-sal-pdens-u-v_HYCOM_2022-09-17-09_8.nc.tar.gz |
Thanks, I get the same warning with a MSVC built GMT. |
no time to look, how about @joa-quim ? |
Not fmod. GMT is a bit fickle when it comes to xmin or ymin not being a multiple of xinc and yinc. Here, the x min is 1724.96051879 times xinc and that interferes with the dumb check. I will see how to avoid this but big dinner to prep for today so... |
But also note that the y-vector we read from the file is junk: 69, 69.040000915527344, 69.080001831054688, ..., 70 So whatever tool write this file goofed and said yinc = 0.040000915527344 which makes no sense since the y-rage is 1 and 1 / 0.040000915527344 = 24.9994278085, a tad bit short of 25, no? |
HYCOM data obtained via OpenDAP. |
So ncdump -h tells me that the x and y vectors are floats:
and dumping just the vector to stdout gives
which does step 0.04, possibly due to formatting. However, in GMT we read that vector in via
where For fun I tried
Maybe @remkos has some information about these things. Hence, nothing to really fix here, but you could send a note to the HYCOM folks and ask why. |
|
We will improve that test, but not urgent. |
I get a warning when using grdinfo with some netcdf files:
Guessing of registration in conflict between x and y, using gridline
Reading the code showed that the problem is in line 826 of the gmt_nc.c file:
This check is incorrect for two reasons, firstly, it does not work correctly for grids that are offset relative to zero. Secondly, due to the use of the fmod function, which may give incorrect results due to rounding errors (see https://godbolt.org/z/KbdK4Yaa9).
Also, I read lines 818 and 819 with great interest )
The text was updated successfully, but these errors were encountered: