Skip to content
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

Leakage in contourf filled contours? #470

Closed
rafael-guerra-www opened this issue Oct 31, 2020 · 5 comments
Closed

Leakage in contourf filled contours? #470

rafael-guerra-www opened this issue Oct 31, 2020 · 5 comments

Comments

@rafael-guerra-www
Copy link
Contributor

rafael-guerra-www commented Oct 31, 2020

There seems to be some leakage in GMT's contourf filled contours, as per code below and attached picture with result.
I have GMT "6.2.0_6f6d002-dirty_2020.10.19" installed in Windows 10 and I am running Julia 1.5.2 using VS Code.

using GMT
G = GMT.peaks(N=100)
zmin, zmax = floor(minimum(G)), ceil(maximum(G))
colorstep = 0.1; contstep = 1; annotstep = 2;
C = makecpt(T=(zmin,zmax,colorstep), cmap=:geo);
contourf(G, C, cont=contstep, annot=annotstep, conf=(MAP_GRID_PEN_PRIMARY=0.1,),
        frame=(axes=(:left_full, :bot_full),),
        xaxis=(grid=1, annot=1, ticks=:auto, label="X [km]"),
        yaxis=(grid=1, annot=1, ticks=:auto, label="Y [km]") )
colorbar!(pos=(paper=true,anchor=(13,1),size=(10,0.5), vertical=true),
        frame=(annot=1, ticks=1, xlabel="Elevation [m]"), fmt=:png, show=true)

GMTjl_contourf_fill_leaks

@joa-quim
Copy link
Member

joa-quim commented Nov 2, 2020

Hmm, don't know what is going on but it's on the pure GMT side. Saving the peaks grid and

makecpt -Cgeo -T-7.0/9.0/0.1 > lixo.cpt
grdview peaks.grd -JX12c/0 -Bpa1fg1 -BWS -Qs -R-3/3/-3/3 -Clixo.cpt -P  > lixo.ps

shows the same effect
@PaulWessel

@PaulWessel
Copy link
Member

PaulWessel commented Nov 3, 2020

Just letting you know I am looking at this. Not visible with -Qidpi.

@PaulWessel
Copy link
Member

grdview has lots of comments regarding past problems (near line 1660), which is very helpful. We are making sure small (the noise we add to prevent a contour from going exactly through a node) is not smaller then floating point EPS, but it can be larger. Here it was 0.000364651 based on

small = GMT_CONV4_LIMIT * (Z->header->z_max - Z->header->z_min);

I wonder why it cannot just (always) be just slightly larger than EPS (e.g., 1.0e-7). When I set small to that value the problem went away. So I understand the problem and will work on a solution.

PaulWessel added a commit to GenericMappingTools/gmt that referenced this issue Nov 3, 2020
See GenericMappingTools/GMT.jl#470 for context.  The issue was that small was too large.
PaulWessel added a commit to GenericMappingTools/gmt that referenced this issue Nov 3, 2020
* Use FLT_EPSILON to move contour from corner

See GenericMappingTools/GMT.jl#470 for context.  The issue was that small was too large.

* Check node use

* Update grdview.c
@joa-quim
Copy link
Member

joa-quim commented Nov 17, 2020

This is now solved in GMT.

@rafael-guerra-www
Copy link
Contributor Author

rafael-guerra-www commented Nov 18, 2020

Dear Joaquim and Paul, just a word of recognition for your follow up and for the very fast code fix. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants