fatiando / harmonica

Forward modeling, inversion, and processing gravity and magnetic data
https://www.fatiando.org/harmonica
BSD 3-Clause "New" or "Revised" License
208 stars 68 forks source link

Set hinge to zero in gallery example plot #408

Closed Esteban82 closed 1 year ago

Esteban82 commented 1 year ago

Set the hinge (white color) to zero in the gallery example plot for the global topo-free gravity disturbances.

At the beginnig of the scripts says: "The gravity disturbance is the observed gravity minus the normal gravity (boule.Ellipsoid.normal_gravity). The signal that is left is assumed to be due to the differences between the actual Earth and the reference ellipsoid." So, the value 0 has a special meaning.

But, in the figure the hinge (white color) of the CPT is around 100. I think that it should be in 0.

To fix it, I propose to force the hinge at 0 (+h0).

santisoler commented 1 year ago

Nice catch @Esteban82! Now I'm thinking if we should use the polar cmap instead, as it's the one being used for the gravity disturbance example (https://www.fatiando.org/harmonica/latest/gallery/gravity_disturbance.html#sphx-glr-gallery-gravity-disturbance-py).

santisoler commented 1 year ago

I just updated this branch after I merged #409 to main. Now tests should pass here as well.

Esteban82 commented 1 year ago

we should use the polar

Probably yes for a paper. But for the gallery I think it is better to have figures with differents colors.

santisoler commented 1 year ago

Thanks @Esteban82 for the contribution!

santisoler commented 9 months ago

@Esteban82 I was checking the most recent build of the topo-free disturbance and noticed that the hinge is not set to zero: https://www.fatiando.org/harmonica/dev/gallery/gravity_disturbance_topofree.html#sphx-glr-gallery-gravity-disturbance-topofree-py

I was wondering if there was any change in pygmt that makes the hinge not be centered around zero even when using cmap="vik+h0". Do you know what's going on?

Esteban82 commented 9 months ago

Hi Santi! Recently I had the same impression that something happened to the hinge. I will check it.

leouieda commented 9 months ago

I've also been having this issue in my classes. I think it may be a GMT bug. When using makcpt the hinge works but not when letting GMT make the cpt automatically.

Esteban82 commented 9 months ago

I already reported the bug (https://github.com/GenericMappingTools/gmt/issues/8102).

Esteban82 commented 9 months ago

@santisoler the bug was solved in the master version.

santisoler commented 9 months ago

Awesome response time! Thanks a lot @Esteban82!

I was also thinking that for PyGMT it would probably be nice to have some argument to set the hinge to zero, besides of adding "+h0" to the colormap. I think is hard to find out how to do it by reading the docs. But this should probably worth opening an issue on PyGMT.

Thanks again for taking care of this issue! Looking forward to see the next release of GMT and see the Harmonica docs updated.