GenericMappingTools / pygmt

A Python interface for the Generic Mapping Tools.
https://www.pygmt.org
BSD 3-Clause "New" or "Revised" License
759 stars 220 forks source link

pygmt.Figure.grdcontour kills kernel after running for a long time #1927

Closed saeedmohanna closed 8 months ago

saeedmohanna commented 2 years ago

I am reading in a 722x480 array and trying to plot it with pygmt.Figure.grdcontour. The code runs for a long time before killing the kernel. I don't think this is a memory issue because I was able to plot a 360x240 array with grdcontour instantly. Is it stuck in some loop somewhere in the source code?

Please see attached. One shows the code outputting the desired result without contours (blocked out by white rectangle ) and the other shows the case with grdcontour being used.

Any help on this issue would be appreciated.

Without grdcontour:

Screen Shot 2022-05-22 at 12 40 00 AM

With grdcontour:

Screen Shot 2022-05-22 at 12 41 41 AM
welcome[bot] commented 2 years ago

👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. You might also want to take a look at our contributing guidelines and code of conduct.

seisman commented 2 years ago

@saeedmohanna Can you share with us the "src_inversion_5.nc" file, so that we can try to reproduce the issue?

saeedmohanna commented 2 years ago

@seisman Unfortunately github doesn't let me attach the file directly. Here is a google drive link: https://drive.google.com/file/d/1Ll2qYqeOM882mV3wrjuwYFSSSgSFwyDR/view?usp=sharing

seisman commented 2 years ago

Running the following GMT command, it also takes forever for me. gmt grdcontour src_inversion_5.nc -A2 -C2 -pdf map

@PaulWessel Is this an upstream bug or is there something wrong with the grid.

I see something weird like:

gmt [INFORMATION]: No range attribute, guessing registration to be pixel
gmt [INFORMATION]: netCDF grid src_inversion_5.nc has no default CPT.
gmt [INFORMATION]: netCDF grid src_inversion_5.nc information has zmin = zmax = NaN. Reset to 0/0.
gmt [INFORMATION]: Cartesian input grid
PaulWessel commented 2 years ago

I will have a look on the flight. It is probably a non-COARDS-compliant grid of some sort.

seisman commented 2 years ago

@saeedmohanna FYI, the upstream bug is being tracked in https://github.com/GenericMappingTools/gmt/issues/6738

seisman commented 8 months ago

I believe the upstream bug has been fixed in https://github.com/GenericMappingTools/gmt/issues/6738, and the command at https://github.com/GenericMappingTools/pygmt/issues/1927#issuecomment-1133914464 now works for me using the GMT dev version. Closing the issue.