About pygmt.test()

Hello everyone,

My name is Ozgur, and I installed pygmt. I followed the instructions on to install GMT 6 using the Anaconda Python distribution. When I tested my installation by running “pygmt.test()” command, I received the following assertion error:

> ============================================================== short test summary info ===============================================================
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/clib/session.py::pygmt.clib.session.Session
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/clib/session.py::pygmt.clib.session.Session.virtualfile_from_grid
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_basemap.py::test_basemap_list_region - pygmt.exceptions.GMTCLibError: Modu...
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_basemap.py::test_basemap_loglog - pygmt.exceptions.GMTCLibError: Module 'p...
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_basemap.py::test_basemap_power_axis - pygmt.exceptions.GMTCLibError: Modul...
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_datasets.py::test_earth_relief_60 - AssertionError: 
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_datasets.py::test_earth_relief_30 - AssertionError: 
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_grdcontour.py::test_grdcontour
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_grdcontour.py::test_grdcontour_labels
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_grdcontour.py::test_grdcontour_slice
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_grdcontour.py::test_grdcontour_file
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_grdcontour.py::test_grdcontour_interval_file_full_opts
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_grdimage.py::test_grdimage
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_grdimage.py::test_grdimage_slice
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_grdimage.py::test_grdimage_file
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_grdtrack.py::test_grdtrack_input_dataframe_and_dataarray - AssertionError: 
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_grdtrack.py::test_grdtrack_input_csvfile_and_dataarray - AssertionError: 
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_grdtrack.py::test_grdtrack_input_dataframe_and_ncfile - AssertionError: 
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_grdtrack.py::test_grdtrack_input_csvfile_and_ncfile - AssertionError: 
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_grdview.py::test_grdview_with_perspective_and_zscale
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_grdview.py::test_grdview_with_perspective_and_zsize
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_grdview.py::test_grdview_with_cmap_for_image_plot
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_grdview.py::test_grdview_with_cmap_for_surface_monochrome_plot
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_grdview.py::test_grdview_with_cmap_for_perspective_surface_plot
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_grdview.py::test_grdview_on_a_plane
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_grdview.py::test_grdview_on_a_plane_with_colored_frontal_facade
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_grdview.py::test_grdview_with_perspective_and_zaxis_frame
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_grdview.py::test_grdview_surface_plot_styled_with_contourpen
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_grdview.py::test_grdview_surface_mesh_plot_styled_with_meshpen
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_grdview.py::test_grdview_on_a_plane_styled_with_facadepen
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_grdview.py::test_grdview_drapegrid_dataarray
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_info.py::test_grdinfo - AssertionError: assert '-180 180 -90 90 -8425 5551...
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_info.py::test_grdinfo_file - AssertionError: assert '-180 180 -90 90 -8425...
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_makecpt.py::test_makecpt_to_plot_grid
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_makecpt.py::test_makecpt_to_plot_grid_scaled_with_series
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_makecpt.py::test_makecpt_truncated_to_zlow_zhigh
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_makecpt.py::test_makecpt_truncated_at_zlow_only
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_makecpt.py::test_makecpt_truncated_at_zhigh_only
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_makecpt.py::test_makecpt_reverse_zsign_only
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_makecpt.py::test_makecpt_reverse_color_and_zsign
FAILED anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/tests/test_makecpt.py::test_makecpt_continuous
=============================================== 41 failed, 209 passed, 1 skipped in 106.61s (0:01:46) ================================================
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/qudocco/anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/__init__.py", line 101, in test
    assert status == 0, "Some tests have failed."
AssertionError: Some tests have failed.”

I tried almost all the exercises on the gallery and they all worked easily. So, is there any problem with my installation? Should I be worried about these fails/errors?

Regards,

Hi @ozgur_k, thanks for trying PyGMT out!

The failures you see are a known issue (see https://github.com/GenericMappingTools/pygmt/issues/451), and we’re working on a fix. Without going into too much detail, there was an update to the earth_relief grid used in those tests, and that’s why you’re seeing those test failures.

If you’re using PyGMT just for vector data (e.g. points, line, polygons), then you can safely ignore those failures. But if you’re using PyGMT for raster grids, I would recommend passing in grids as filenames at the moment, as there’s a bug with xarray.DataArray inputs (unless you don’t care about half a pixel, in which case it’s fine).

1 Like

Hi @weiji14,

thanks for your reply. I’m a seismologist and I want to install GMT on our workstation in the lab. I am trying to find which is better for us directly installing version 6.0 or installing PyGMT.
I worked with GMT during my PhD starting in 2010 and then I continued with gmt-python for a short while. Using a Python implementation is a modern way and easier for me. So I decided to install it on my laptop for trial purposes last night, and joined your party :partying_face:

PyGMT still relies on GMT, so either way, GMT will have to be installed. The team is working on releasing GMT 6.1.0, and there should be a PyGMT v0.1.2 release (maybe even v0.2.0) sometime this month too.

I’m not sure how easy it is for you to upgrade software in your lab (in my research centre, it could take an hour if a server restart isn’t needed, otherwise a week), but GMT v6.0/PyGMT v0.1.1 should be fine for most purposes. We also have conda packages available that might make for easier installation/upgrades.

1 Like