You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Passing xarray.DataArray to grdfilter gives incorrect results #859
Was starting to look using my new M1 laptop but first have to install miniconda and that got me this far:
bash ~/Downloads/Miniconda3-py39_4.9.2-MacOSX-x86_64.sh
WARNING:
Your operating system appears not to be 64-bit, but you are trying to
install a 64-bit version of Miniconda3.
Are sure you want to continue the installation? [yes|no]
Some googling talks about condo running in emulation mode but not sure about miniconda. I guess this is all work in progress. Not sure how to proceed. Perhaps just not do this on laptop but do it on the old Mac Pro Intel...
(base) pwessel@macnut:~/GMTdev/pygmt-> git checkout master
Switched to branch 'master'
Your branch is behind 'origin/master' by 277 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
git pull (lots of updates).
(base) pwessel@macnut:~/GMTdev/pygmt-> python
Python 3.8.3 (default, May 19 2020, 13:54:14)
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygmt
>>> pygmt.show_versions()
PyGMT information:
version: v0.3.2.dev78+ga4eec49d
System information:
python: 3.8.3 (default, May 19 2020, 13:54:14) [Clang 10.0.0 ]
executable: /Users/pwessel/opt/miniconda3/bin/python
machine: macOS-10.16-x86_64-i386-64bit
Dependency information:
numpy: 1.19.2
pandas: 1.1.2
xarray: 0.16.1
netCDF4: 1.5.4
packaging: 20.4
ghostscript: 9.53.3
gmt: 6.2.0_2eab897-dirty_2021.04.05
GMT library information:
binary dir: /Users/pwessel/opt/miniconda3/bin
cores: 24
grid layout: rows
library path: /Users/pwessel/GMTdev/gmt-dev/rbuild/gmt6/lib/libgmt.dylib
padding: 2
plugin dir: /Users/pwessel/GMTdev/gmt-dev/rbuild/gmt6/lib/gmt/plugins
share dir: /Users/pwessel/GMTdev/gmt-dev/rbuild/gmt6/share
version: 6.2.0
>>> grid = pygmt.grdcut("@earth_relief_01d_p", region=[0, 10, 0, 10])
>>> print(grid.data.max(), grid.data.min())
821.5 -4852.0
>>>
>>> result = pygmt.grdfilter(grid, filter='b300', distance='4')
>>> print(result.data.max(), result.data.min())
nan nan
I assume the only thing that changed here is pyGMT and that the shared GMT lib stayed the same? So perhaps this is an issue in how the gmt info call is done? Can you check the intermediate grid in /tmp?
OK, and this is with GMT_IN, and with REFERENCE it works OK? Not sure why grdinfo would return NaN in the limits since the grid clearly has non-NaN values.
Sorry, I wrote it backwards but meant what you wrote above (!).
I can look at grdfilter and see if there are places where we change any input grid value (thus requiring GMT_IN) or if it ought to work with reference (not changing any values).
Activity
seisman commentedon Mar 17, 2021
@PaulWessel It looks like a GMT bug. Please see if you can fix it when you have time.
PaulWessel commentedon Mar 17, 2021
To keep it as simple as possible, can you demonstrate the same mismatch with -Fg300 or even better, -Fb300 ?
seisman commentedon Mar 17, 2021
CLI:
Python:
the output is even worse:
PaulWessel commentedon Mar 17, 2021
How would you do the equivalent of
in python, and does it differ then too (trying to make as small test as possible)
seisman commentedon Mar 17, 2021
output:
seisman commentedon Mar 27, 2021
Ping @PaulWessel just in case you forget it.
PaulWessel commentedon Mar 28, 2021
Was starting to look using my new M1 laptop but first have to install miniconda and that got me this far:
bash ~/Downloads/Miniconda3-py39_4.9.2-MacOSX-x86_64.sh
WARNING:
Your operating system appears not to be 64-bit, but you are trying to
install a 64-bit version of Miniconda3.
Are sure you want to continue the installation? [yes|no]
Some googling talks about condo running in emulation mode but not sure about miniconda. I guess this is all work in progress. Not sure how to proceed. Perhaps just not do this on laptop but do it on the old Mac Pro Intel...
PaulWessel commentedon Apr 6, 2021
Hi @seisman, is this still failing after the last API fixes today/yesterday?
seisman commentedon Apr 6, 2021
It's still failing.
PaulWessel commentedon Apr 6, 2021
Odd, I just stepped through the whole grdfilter example above (the 10x10 case) and I got the same result as CLI. Sure you rebuilt etc?
seisman commentedon Apr 6, 2021
I think I'm using the latest GMT version (
6.2.0_c673720_2021.04.05) and all three examples still fail.What happens if you just run the examples, not in Xcode debugging.
PaulWessel commentedon Apr 6, 2021
Same result with release build or xbuild.
seisman commentedon Apr 6, 2021
This is my output:
Can you show your output of
pygmt.show_versions()?3 remaining items
seisman commentedon Apr 6, 2021
Can @meghanrjones or @weiji14 check if it works for you (you need to build the latest GMT dev).
maxrjones commentedon Apr 6, 2021
I can check it out.
maxrjones commentedon Apr 6, 2021
I'm getting the same results as @seisman. I do not understand why pygmt.show_versions shows v0.3.2 for me:
While @PaulWessel's has 0.3.1:
If that's not the issue, perhaps it would be worth trying to sync the dependencies since it seems that @seisman and I are using later xarray versions.
PaulWessel commentedon Apr 6, 2021
I do not understand either, but cannot see how this can be a bug in GMT if it steps through and does all the right things?
seisman commentedon Apr 6, 2021
The version difference is due to a known limitation of setuptools_scm (#912).
seisman commentedon Apr 6, 2021
I just created a new conda environment and install the package versions @PaulWessel is using. I still have the same problem.
@PaulWessel Your PyGMT version
v0.3.1.dev120+gb1f4133fdoesn't make sense.Could you please follow the instructions below:
and then check
pygmt.show_versions()again.PaulWessel commentedon Apr 6, 2021
OK:
git pull (lots of updates).
I assume the only thing that changed here is pyGMT and that the shared GMT lib stayed the same? So perhaps this is an issue in how the gmt info call is done? Can you check the intermediate grid in /tmp?
seisman commentedon Apr 6, 2021
Good to know that we're on the same page.
I think the old version you were using (
v0.3.1.dev120+gb1f4133f) is from this branch (#517), in which I change "GMT_IN|GMT_IS_REFERENCE" to "GMT_IN".I just switched to that PR, and it works for me. So, it fails for "GMT_IN|GMT_IS_REFERENCE", but works for "GMT_IN".
PaulWessel commentedon Apr 6, 2021
Which step is failing? the filtering or the hidden grdinfo on the temp file?
seisman commentedon Apr 6, 2021
The
resultvariable is:PaulWessel commentedon Apr 6, 2021
OK, and this is with GMT_IN, and with REFERENCE it works OK? Not sure why grdinfo would return NaN in the limits since the grid clearly has non-NaN values.
seisman commentedon Apr 6, 2021
No, PyGMT is using
GMT_IN|GMT_IS_REFERENCE, and it fails. If I change it toGMT_IN, it works.The min and max values are not obtained from the grdinfo call. So any NaN values in data can cause:
PaulWessel commentedon Apr 6, 2021
Sorry, I wrote it backwards but meant what you wrote above (!).
I can look at grdfilter and see if there are places where we change any input grid value (thus requiring GMT_IN) or if it ought to work with reference (not changing any values).