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

Adding cmocean colour maps #6446

Merged
merged 20 commits into from
Jun 8, 2022
Merged

Adding cmocean colour maps #6446

merged 20 commits into from
Jun 8, 2022

Conversation

remkos
Copy link
Contributor

@remkos remkos commented Mar 14, 2022

Description of proposed changes

This PR implements issue #6284

  • Spreading colormaps over new cpt subdirectories: gmt, cpt-city, cmocean, crameri, etc.
  • Adjusting code to search for color map based on or /
  • Updating the descriptions in the cpt file headers
  • Updating the gmt_cpt_headers.h
  • Updating the cookbook documentation regarding the color maps

Fixes #6284

Reminders

  • Make sure that your code follows our style. Use the other functions/files as a basis.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Describe changes to function behavior and arguments in a comment below the function declaration.
  • If adding new functionality, add a detailed description to the documentation and/or an example.

@maxrjones
Copy link
Member

Should we ping Fabio to find out if he has a preference for the group name for Scientific Colour Maps before moving forward with them under 'Crameri'? For context, the readme suggests that those cpts are used under the namespace 'SCM7' in Python.

@PaulWessel
Copy link
Member

Actually, it sounds like SCM7 is a better name than just Crameri anyway since it will allow some name recognition with python/matplotlib.

@remkos remkos changed the title Adding cmocean colour maps WIP Adding cmocean colour maps Mar 14, 2022
@remkos
Copy link
Contributor Author

remkos commented Mar 14, 2022

Actually, it sounds like SCM7 is a better name than just Crameri anyway since it will allow some name recognition with python/matplotlib.

Is there a preference for SCM7 or scm7?

@PaulWessel
Copy link
Member

@meghanrjones what does matplotlib do, upper or lower case? Hopefully upper case since an abbreviation, no?

@remkos
Copy link
Contributor Author

remkos commented Mar 14, 2022

@meghanrjones what does matplotlib do, upper or lower case? Hopefully upper case since an abbreviation, no?

They actually use ScientificColourMaps7 in python, so I'll use uppercase

@remkos
Copy link
Contributor Author

remkos commented Mar 14, 2022

Does any of you understand why the deployment to Preview fails?

@PaulWessel
Copy link
Member

I dont, but it does seem to happen from time to time and I have kind of ignored it.

@remkos
Copy link
Contributor Author

remkos commented Mar 15, 2022

Then I think this is ready, so I'll remove the "WIP".
@meghanrjones: This has a new script to make an image for the cookbook (GMT_App_M_1e.sh). I have not fully understood how the documentation is made now ("make docs_html" no longer works since the PS files are no longer there), you will have to explain me some time. The other GMT_App_M_1?.sh have also changed to sort the colour maps properly among the various images.

@remkos remkos changed the title WIP Adding cmocean colour maps Adding cmocean colour maps Mar 15, 2022
@PaulWessel
Copy link
Member

Hi @remkos, I am sure @meghanrjones can help with this later. If you are interested, the COntribution Guide on the top GitHub page talks about the steps involved in updating plots via dvc. I just successfully made my first update a few days ago, with some hand-holding....

@maxrjones
Copy link
Member

Yes, the contributing guide lists instructions for building the docs after installing dvc and I could provide further clarification as needed.

I am working on an alternative to using dvc that will generate the postscript files as part of make docs_depends (#6356). I'll see if I can get this working today in case you do not want to use dvc. I will use this option for the Vercel preview as well to prevent the random failures associated with pulling the images.

Regardless of the path for building the documentation, pushing the new images would require dvc. But Paul or I could do this for you if you don't want to spend time installing dvc and setting up authentication for DAGsHub.

@maxrjones
Copy link
Member

@meghanrjones what does matplotlib do, upper or lower case? Hopefully upper case since an abbreviation, no?

They actually use ScientificColourMaps7 in python, so I'll use uppercase

Is this in matplotlib? Uppercase sounds good to me, but I am unclear about where to find ScientificColourMaps7.

@seisman
Copy link
Member

seisman commented Mar 15, 2022

Actually, it sounds like SCM7 is a better name than just Crameri anyway since it will allow some name recognition with python/matplotlib.

Is there a preference for SCM7 or scm7?

Is SCM7 a good long-term name? SCM7 stands for "ScientificColourMaps v7.x". Do we need to change it to SCM8 if SCM v8.v is released? Or should we simply use "SCM"?

@maxrjones
Copy link
Member

maxrjones commented Mar 15, 2022

@meghanrjones what does matplotlib do, upper or lower case? Hopefully upper case since an abbreviation, no?

They actually use ScientificColourMaps7 in python, so I'll use uppercase

Is this in matplotlib? Uppercase sounds good to me, but I am unclear about where to find ScientificColourMaps7.

It's a bit confusing. The package is called cmcrameri, but the directory in which it installs appears to be called ScientificColourMaps7. At least that appears from Fabio's doc: https://www.fabiocrameri.ch/ws/media-library/b4664473fcd0485c9139b3d7c93bf9b8/readme_scientificcolourmaps.pdf

Ah I see, we were looking at the same section. The init file uses ScientificColourMaps7 and is imported as SCM7.

@maxrjones
Copy link
Member

Is SCM7 a good long-term name? SCM7 stands for "ScientificColourMaps v7.x". Do we need to change it to SCM8 if SCM v8.v is released? Or should we simply use "SCM"?

Good point, +1 for SCM.

@PaulWessel
Copy link
Member

Yep, Fabio cranks these out very frequently so I agree we should avoid the version number. We will simply supply whatever the most recent version has (and we have a CI test that alerts us when he releases something new).

@maxrjones
Copy link
Member

Sounds like we're settled on SCM. Sorry for the hassle @remkos and thanks for being willing to update the directories again.

FYI I need more time to add an option to build docs without dvc (issues reported at #6356). Let me know if you decide to try DVC and need any help getting set up.

@maxrjones maxrjones added new feature PR that implements a new feature or capability in GMT add-changelog Add PR to the changelog labels Mar 18, 2022
@maxrjones maxrjones added this to the 6.4.0 milestone Mar 23, 2022
@gd-a
Copy link
Contributor

gd-a commented Apr 24, 2022

For plot consistency and backward compatibility, could a footnote be added on the palette doc to refer to previous versions?

@remkos
Copy link
Contributor Author

remkos commented May 14, 2022

For plot consistency and backward compatibility, could a footnote be added on the palette doc to refer to previous versions?

Things work fully backward compatible. You can use a colormap name with or without the directory name. Of course, this will not work when there are overlapping names in separate directories.

@PaulWessel
Copy link
Member

I will need to fix a few tests. For instance, this happens:

 gmt makecpt -T0/3/1 -Ccubhelix -F+c > t.cpt
ERROR: Caught signal number 11 (Segmentation fault: 11) at
0   libsystem_platform.dylib            0x00000001bb1a33cc _platform_strchr + 12
1   ???                                 0x0000000000000000 0x0 + 0
Stack backtrace:
0   libgmt.6.4.0.dylib                  0x0000000101ac69dc sig_handler_unix + 248
1   libsystem_platform.dylib            0x00000001bb1a34a4 _sigtramp + 56
2   libgmt.6.4.0.dylib                  0x0000000101a6178c gmtsupport_cpt_master_index + 84
3   libgmt.6.4.0.dylib                  0x0000000101a616ec gmt_is_cpt_master + 360
4   libgmt.6.4.0.dylib                  0x0000000101958f9c GMT_Read_Data + 2116
5   libgmt.6.4.0.dylib                  0x0000000101d74688 GMT_makecpt + 988
6   libgmt.6.4.0.dylib                  0x0000000101970798 GMT_Call_Module + 1336
7   gmt                                 0x0000000100e29d18 main + 976
8   dyld                                0x000000010117108c start + 520

@PaulWessel
Copy link
Member

OK, the crash (even just running gmt makecpt) was because a missing comma after the last cmocean entry in gmt_master.h. Now working.

@PaulWessel
Copy link
Member

Hi @remkos perhaps you can either help add some minimal documentation changes to makecpt/grd2cpt and cookbook or point me to where you might already have added things or where you think we need to add something. We can then wrap this up as things seems to be working fine after 003ccf5

@maxrjones maxrjones mentioned this pull request Jun 7, 2022
51 tasks
@remkos
Copy link
Contributor Author

remkos commented Jun 7, 2022

I can certainly add documentation to makecpt and grd2cpt. That part should be easy.
I never got the dvc implemented, so I it will not be so easy for me to update the cookbook (at least I cannot run it to the end). But I can supply the text update.

@PaulWessel
Copy link
Member

No worries, I think I already updated the plots in dvc for this, so if you can help with some text then we are good. We hope to release 6.4 really soon so just do the basics.

@remkos
Copy link
Contributor Author

remkos commented Jun 7, 2022

I've implemented new wording in makecpt and grd2cpt man pages and reviewed the section in the cookbook.

@maxrjones
Copy link
Member

@remkos, can you please add the new cmap source to the acknowledgement section of the readme as part of this PR - https://github.com/GenericMappingTools/gmt#acknowledgment?

remkos added a commit that referenced this pull request Jun 8, 2022
@remkos
Copy link
Contributor Author

remkos commented Jun 8, 2022

@remkos, can you please add the new cmap source to the acknowledgement section of the readme as part of this PR - https://github.com/GenericMappingTools/gmt#acknowledgment?

@meghanrjones: Done with commit 85458cb

@remkos remkos merged commit 030bdcc into master Jun 8, 2022
@remkos remkos deleted the cmocean-cpt branch June 8, 2022 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add-changelog Add PR to the changelog new feature PR that implements a new feature or capability in GMT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding cmocean colour maps
5 participants