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
xarray v0.18 released on 6 May 2021 (see changelog at https://xarray.pydata.org/en/v0.18.0/whats-new.html) resulted in some API changes and this is breaking PyGMT tests that are trying to read from a *.grd file. Specifically the earth relief grids from the pygmt.datasets.load_earth_relief function don't work, and I think it also segfaults on Windows so it is a major issue.
For users: Temporary solution would be to downgrade to xarray v0.17.0 if you want to continue using the load_earth_relief function.
For PyGMT developers, we probably need to explicitly set an 'engine' in the xarray.open_dataarray() calls we make. Or we could post an upstream issue to xarray to handle *.grd files natively. Thoughts?
=================================== FAILURES ===================================
________________ [doctest] pygmt.accessors.GMTDataArrayAccessor ________________
011
012 This is the GMT extension for :class:`xarray.DataArray`.
013
014 You can access various GMT specific metadata about your grid as follows:
015
016 >>> from pygmt.datasets import load_earth_relief
017 >>> # Use the global Earth relief grid with 1 degree spacing
018 >>> grid = load_earth_relief(resolution="01d")
UNEXPECTED EXCEPTION: ValueError('cannot guess the engine, try passing one explicitly')
Traceback (most recent call last):
File "/usr/share/miniconda3/envs/pygmt/lib/python3.7/doctest.py", line 1337, in __run
compileflags, 1), test.globs)
File "<doctest pygmt.accessors.GMTDataArrayAccessor[1]>", line 1, in <module>
File "/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/pygmt/helpers/decorators.py", line 438, in new_modulereturn module_func(*args, **kwargs)
File "/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/pygmt/datasets/earth_relief.py", line 136, in load_earth_reliefwith xr.open_dataarray(fname) as dataarray:
File "/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/xarray/backends/api.py", line 673, in open_dataarray**kwargs,
File "/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/xarray/backends/api.py", line 485, in open_dataset
engine = plugins.guess_engine(filename_or_obj)
File "/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/xarray/backends/plugins.py", line 112, in guess_engineraiseValueError("cannot guess the engine, try passing one explicitly")
ValueError: cannot guess the engine, try passing one explicitly
/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/pygmt/accessors.py:18: UnexpectedException
_____________ [doctest] pygmt.clib.conversion.dataarray_to_matrix ______________
040 ------
041 GMTInvalidInput
042 If the grid has more than two dimensions or variable grid spacing.
043
044 Examples
045 --------
046
047 >>> from pygmt.datasets import load_earth_relief
048 >>> # Use the global Earth relief grid with 1 degree spacing
049 >>> grid = load_earth_relief(resolution="01d")
UNEXPECTED EXCEPTION: ValueError('cannot guess the engine, try passing one explicitly')
Traceback (most recent call last):
File "/usr/share/miniconda3/envs/pygmt/lib/python3.7/doctest.py", line 1337, in __run
compileflags, 1), test.globs)
File "<doctest pygmt.clib.conversion.dataarray_to_matrix[1]>", line 1, in <module>
File "/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/pygmt/helpers/decorators.py", line 438, in new_modulereturn module_func(*args, **kwargs)
File "/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/pygmt/datasets/earth_relief.py", line 136, in load_earth_reliefwith xr.open_dataarray(fname) as dataarray:
File "/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/xarray/backends/api.py", line 673, in open_dataarray**kwargs,
File "/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/xarray/backends/api.py", line 485, in open_dataset
engine = plugins.guess_engine(filename_or_obj)
File "/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/xarray/backends/plugins.py", line 112, in guess_engineraiseValueError("cannot guess the engine, try passing one explicitly")
ValueError: cannot guess the engine, try passing one explicitly
/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/pygmt/clib/conversion.py:49: UnexpectedException
_____________________ [doctest] pygmt.clib.session.Session _____________________
095 If you try to call a method outside of a 'with' block.
096 GMTVersionError
097 If the minimum required version of GMT is not found.
098
099 Examples
100 --------
101
102 >>> from pygmt.datasets import load_earth_relief
103 >>> from pygmt.helpers import GMTTempFile
104 >>> grid = load_earth_relief()
UNEXPECTED EXCEPTION: ValueError('cannot guess the engine, try passing one explicitly')
Traceback (most recent call last):
File "/usr/share/miniconda3/envs/pygmt/lib/python3.7/doctest.py", line 1337, in __run
compileflags, 1), test.globs)
File "<doctest pygmt.clib.session.Session[2]>", line 1, in <module>
File "/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/pygmt/helpers/decorators.py", line 438, in new_modulereturn module_func(*args, **kwargs)
File "/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/pygmt/datasets/earth_relief.py", line 136, in load_earth_reliefwith xr.open_dataarray(fname) as dataarray:
File "/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/xarray/backends/api.py", line 673, in open_dataarray**kwargs,
File "/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/xarray/backends/api.py", line 485, in open_dataset
engine = plugins.guess_engine(filename_or_obj)
File "/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/xarray/backends/plugins.py", line 112, in guess_engineraiseValueError("cannot guess the engine, try passing one explicitly")
ValueError: cannot guess the engine, try passing one explicitly
/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/pygmt/clib/session.py:104: UnexpectedException
__________ [doctest] pygmt.clib.session.Session.virtualfile_from_grid __________
277 fname : str
278 The name of virtual file. Pass this as a file name argument to a
279 GMT module.
280
281 Examples
282 --------
283
284 >>> from pygmt.datasets import load_earth_relief
285 >>> from pygmt.helpers import GMTTempFile
286 >>> data = load_earth_relief(resolution="01d")
UNEXPECTED EXCEPTION: ValueError('cannot guess the engine, try passing one explicitly')
Traceback (most recent call last):
File "/usr/share/miniconda3/envs/pygmt/lib/python3.7/doctest.py", line 1337, in __run
compileflags, 1), test.globs)
File "<doctest pygmt.clib.session.Session.virtualfile_from_grid[2]>", line 1, in <module>
File "/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/pygmt/helpers/decorators.py", line 438, in new_modulereturn module_func(*args, **kwargs)
File "/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/pygmt/datasets/earth_relief.py", line 136, in load_earth_reliefwith xr.open_dataarray(fname) as dataarray:
File "/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/xarray/backends/api.py", line 673, in open_dataarray**kwargs,
File "/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/xarray/backends/api.py", line 485, in open_dataset
engine = plugins.guess_engine(filename_or_obj)
File "/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/xarray/backends/plugins.py", line 112, in guess_engine**kwargs,
/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/xarray/backends/api.py:485: in open_dataset
engine = plugins.guess_engine(filename_or_obj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
store_spec = '/home/runner/.gmt/server/earth/earth_relief/earth_relief_30m_g.grd'
defguess_engine(store_spec):
engines = list_engines()
for engine, backend in engines.items():
try:
if backend.guess_can_open and backend.guess_can_open(store_spec):
return engine
exceptException:
warnings.warn(f"{engine!r} fails while guessing", RuntimeWarning)
> raise ValueError("cannot guess the engine, try passing one explicitly")
E ValueError: cannot guess the engine, try passing one explicitly
/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/xarray/backends/plugins.py:112: ValueError
_________________________________ test_grdinfo _________________________________
deftest_grdinfo():
"""
Make sure grdinfo works as expected.
"""
> grid = load_earth_relief(registration="gridline")
/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/pygmt/tests/test_grdinfo.py:15:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/pygmt/helpers/decorators.py:438: in new_module
return module_func(*args, **kwargs)
/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/pygmt/datasets/earth_relief.py:136: in load_earth_relief
with xr.open_dataarray(fname) as dataarray:
/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/xarray/backends/api.py:673: in open_dataarray
**kwargs,
/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/xarray/backends/api.py:485: in open_dataset
engine = plugins.guess_engine(filename_or_obj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
store_spec = '/home/runner/.gmt/server/earth/earth_relief/earth_relief_01d_g.grd'
defguess_engine(store_spec):
engines = list_engines()
for engine, backend in engines.items():
try:
if backend.guess_can_open and backend.guess_can_open(store_spec):
return engine
exceptException:
warnings.warn(f"{engine!r} fails while guessing", RuntimeWarning)
> raise ValueError("cannot guess the engine, try passing one explicitly")
E ValueError: cannot guess the engine, try passing one explicitly
/usr/share/miniconda3/envs/pygmt/lib/python3.7/site-packages/xarray/backends/plugins.py:112: ValueError
System information
Please paste the output of python -c "import pygmt; pygmt.show_versions()":
Description of the problem
xarray
v0.18 released on 6 May 2021 (see changelog at https://xarray.pydata.org/en/v0.18.0/whats-new.html) resulted in some API changes and this is breaking PyGMT tests that are trying to read from a *.grd file. Specifically the earth relief grids from thepygmt.datasets.load_earth_relief
function don't work, and I think it also segfaults on Windows so it is a major issue.For users: Temporary solution would be to downgrade to xarray v0.17.0 if you want to continue using the
load_earth_relief
function.For PyGMT developers, we probably need to explicitly set an 'engine' in the
xarray.open_dataarray()
calls we make. Or we could post an upstream issue toxarray
to handle *.grd files natively. Thoughts?Full code that generated the error
Full error message
https://github.com/GenericMappingTools/pygmt/runs/2523330164?check_suite_focus=true#step:11:1994
System information
Please paste the output of
python -c "import pygmt; pygmt.show_versions()"
:The text was updated successfully, but these errors were encountered: