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

Wrapper for makecpt #214

Closed
mlmarius opened this issue Jul 18, 2018 · 1 comment · Fixed by #329
Closed

Wrapper for makecpt #214

mlmarius opened this issue Jul 18, 2018 · 1 comment · Fixed by #329
Labels
feature request New feature wanted
Milestone

Comments

@mlmarius
Copy link

mlmarius commented Jul 18, 2018

cpt = gmt.makecpt(C='jet', T=[mag.min(), mag.max()])

AttributeError: module 'gmt' has no attribute 'makecpt'

Python 3.6, GMT 6

  • Operating system:
  • Python installation: system (inside docker container):
  • Version of GMT/Python: 6, 3.6
  • How you installed GMT/Python: Docker image

Apparently the examples shown here: https://www.gmtpython.xyz/latest/design.html#the-gmt-python-api are not working. How do i generate a colorbar and a legend for my plot ? Is there a way to work directly with the gmt modules ?

@leouieda
Copy link
Member

Hi @mlmarius, the "Design" page was more of a roadmap for us than a tutorial. Sadly, we let it get out of date. We're working on updating the documentation (#201).

We haven't implemented makecpt yet because there are still some issues with how we're communicating with the C API. Right now, there is no way to call GMT modules directly.

We'll update this issue when we have makecpt implemented, so you'll get a notification.

@leouieda leouieda changed the title Missing makecpt Wrapper for makecpt Jul 24, 2018
@leouieda leouieda added the feature request New feature wanted label Jul 24, 2018
weiji14 referenced this issue in weiji14/pygmt Sep 28, 2019
Initial commit for wrapping the makecpt function raised at #214, tentatively implemented here under the mathops.py file which will hold functions for "Mathematical operations on tables or grids", but with documentation placed under 'Plotting'. Original GMT `makecpt` documentation can be found at https://docs.generic-mapping-tools.org/latest/makecpt.html.

Tests are stored under test_makecpt.py, and there are now some basic tests ensuring that we can change the color when plotting points and grids. Current implementation uses 'cmap' and 'series' as aliases for 'C' and 'T' respectively.
@weiji14 weiji14 mentioned this issue Sep 28, 2019
20 tasks
@weiji14 weiji14 added this to the 0.1.0 milestone Oct 4, 2019
@liamtoney liamtoney mentioned this issue Oct 8, 2019
5 tasks
weiji14 added a commit that referenced this issue Oct 10, 2019
* Wrap makecpt

Initial commit for wrapping the makecpt function raised at #214, tentatively implemented here under the mathops.py file which will hold functions for "Mathematical operations on tables or grids", but with documentation placed under 'Plotting'. Original GMT `makecpt` documentation can be found at https://docs.generic-mapping-tools.org/latest/makecpt.html.

Tests are stored under test_makecpt.py, and there are now some basic tests ensuring that we can change the color when plotting points and grids. Current implementation uses 'cmap' and 'series' as aliases for 'C' and 'T' respectively.

* Enable makecpt to save to a cpt file via output (H) parameter

Allow makecpt to save the generated color palette table to a file via the output (H) argument. The 'H' setting in GMT upstream (see https://docs.generic-mapping-tools.org/latest/makecpt.html#h) is actually a flag to force the creation of an output (to stdout) in modern mode. Here we use it to set the filename too.

See also GenericMappingTools/gmt#827 and GenericMappingTools/gmt#823

* Add truncate (G) alias for makecpt

With rainbow cmap checks to test various zlow/zhigh combinations.

* Add reverse (I) alias for makecpt

Used 'earth' cmap to test various reversed colormap examples.

* Alias continuous (Z) for makecpt

Included one test to create a continuous cpt from blue to white. Also updated link to the full list of GMT's color palette tables due to documentation reorganization during GenericMappingTools/gmt#1594.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants