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
{{ message }}
Repository navigation
Consistent (non-common) aliases between modules #1042
The -C arguments (parameters) in contour and grdcontour do essentially the same thing. But, PyGMT uses different aliases for these parameters in the two methods (interval and level). I think it would be better to use the same aliases for options that are very similar across the various modules. This is harder to track for non-common options, so perhaps we can also create a tool for identifying similar GMT arguments across modules.
I'm not familiar with the use of the -C in contour or grdcontour and don't want to cause any breaking changes before v0.3.1, but they have very different documentation. In the future I think we should standardize names, but for now, should we copy the interval documentation from grdcontour.py and copy it into levels in contour.py? I notice that interval states it can accept an integer or string, while levels just states that it can accept a string. I'm assuming that levels can accept an integer as well?
I'm not familiar with the use of the -C in contour or grdcontour and don't want to cause any breaking changes before v0.3.1, but they have very different documentation. In the future I think we should standardize names, but for now, should we copy the interval documentation from grdcontour.py and copy it into levels in contour.py? I notice that interval states it can accept an integer or string, while levels just states that it can accept a string. I'm assuming that levels can accept an integer as well?
Works for me:
import pygmt
import numpy as np
np.random.seed(42)
region = [0, 10, 0, 12]
x = np.random.uniform(region[0], region[1], 100)
y = np.random.uniform(region[2], region[3], 100)
z = np.sqrt(x)*np.sqrt(y)
fig = pygmt.Figure()
fig.basemap(region=region, projection="X15c", frame=True)
pygmt.makecpt(cmap="viridis", series=[z.min(),z.max()])
fig.plot(x, y, style="c0.2c", cmap=True, color=z)
fig.contour(x, y, z, levels=1,pen="thin")
fig.show()
Let's continue the discussions at #2706 (comment). It would be better if we can reach an agreement about the consistent parameter name and deprecate the old name in v0.12.0 and fully remove it in v0.16.0 considering that grdcontour/contour are commonly used. Ping @GenericMappingTools/pygmt-maintainers
Let's continue the discussions at #2706 (comment). It would be better if we can reach an agreement about the consistent parameter name and deprecate the old name in v0.12.0 and fully remove it in v0.16.0 considering that grdcontour/contour are commonly used. Ping @GenericMappingTools/pygmt-maintainers
Yes, I also thought about getting this in v0.12.0.
I think the important point is to have the same alias for C of Figure.grdcontour and Figure.contour. levels is already used for Figure.contour, GMT Julia also supports this alias, and matplotlib uses levels. So, I think I am OK with this alias for C if the other @GenericMappingTools/pygmt-maintainers prefer it.
Let's continue the discussions at #2706 (comment). It would be better if we can reach an agreement about the consistent parameter name and deprecate the old name in v0.12.0 and fully remove it in v0.16.0 considering that grdcontour/contour are commonly used. Ping @GenericMappingTools/pygmt-maintainers
Yes, I also thought about getting this in v0.12.0. I think the important point is to have the same alias for C of Figure.grdcontour and Figure.contour. levels is already used for Figure.contour, GMT Julia also supports this alias, and matplotlib uses levels. So, I think I am OK with this alias for C if the other @GenericMappingTools/pygmt-maintainers prefer it.
Yep, ok with using levels across both contour and grdcontour.
Activity
willschlitzer commentedon Mar 12, 2021
I'm not familiar with the use of the -C in
contourorgrdcontourand don't want to cause any breaking changes before v0.3.1, but they have very different documentation. In the future I think we should standardize names, but for now, should we copy theintervaldocumentation fromgrdcontour.pyand copy it intolevelsincontour.py? I notice thatintervalstates it can accept an integer or string, whilelevelsjust states that it can accept a string. I'm assuming thatlevelscan accept an integer as well?maxrjones commentedon Mar 12, 2021
Works for me:
willschlitzer commentedon Mar 12, 2021
Sounds good. I'll open a PR to copy the documentation.
seisman commentedon Apr 28, 2024
Let's continue the discussions at #2706 (comment). It would be better if we can reach an agreement about the consistent parameter name and deprecate the old name in v0.12.0 and fully remove it in v0.16.0 considering that
grdcontour/contourare commonly used. Ping @GenericMappingTools/pygmt-maintainersyvonnefroehlich commentedon Apr 28, 2024
Yes, I also thought about getting this in v0.12.0.
I think the important point is to have the same alias for C of
Figure.grdcontourandFigure.contour.levelsis already used forFigure.contour, GMT Julia also supports this alias, and matplotlib useslevels. So, I think I am OK with this alias for C if the other @GenericMappingTools/pygmt-maintainers prefer it.weiji14 commentedon Apr 28, 2024
Yep, ok with using
levelsacross bothcontourandgrdcontour.seisman commentedon Apr 29, 2024
@yvonnefroehlich Could you please open a PR to deprecate
intervaltolevelsinFigure.grdcontour?yvonnefroehlich commentedon Apr 29, 2024
Submitted PR #3209 for this.