Running GMT 6.2.0 on macos 11.6 (Big Sur) with X11 (XQuartz 2.8.1), I fail to find the folder location to place a .cpt Master file from cpt-city. My script succeeds executing “gmt makecpt -Crainbow …” but it fails “gmt makecpt -CRdBu_08 …” which gives me the error “makecpt [ERROR]: GMT_Read_Data: File not found: RdBu_08” Both Master files “rainbow.cpt” and “RdBu_08.cpt” are in the same directory “/usr/local/Cellar/gmt/6.2.0_1/share/gmt/cpt/” and have identical file permissions and attributes. I installed GMT 6.2.0 via “brew install gmt” from the command line. A search of my hard-drive reveals only a single copy at a single location for rainbow.cpt which is where I placed cpt-city .cpt files, but GMT does not see them there. Does anyone have an idea or pointer on what I am doing wrong? [Using GMT for ~20 years in physical oceanography research and teaching.]
GMT does not look for non-GMT master CPTs in the installation share directory. It may have by accident in the past but that was never the intention. It is not a good place anyway since a new installation will wipe those files. You should place them in the ~/.gmt directory or probably any directory you include in the GMT_DATA defaults setting (where you may add a specific directory just for your own master CPTs to organize things better). Let us now if none of that is working for you.
Thank you for the very quick and helpful response:
Yes, the new 6.2 installation wiped those files, so restored them from a back-up and now placed the .cpt files into the $HOME/.gmt/cpt directory that I set to become the $GMT_DATADIR. Now the execution “gmt makecpt -CRdBu_08 …” does not work, however, the call “gmt makecpt -C$GMT_DATADIR/RdBu_08.cpt …” works as does the explicit call “gmt makecpt -C/User/a2/.gmt/cpt/RdBu_08.cpt …” This tells me, that I must specify the full and explicit path with the full file name including the extension. Perhaps this was different in GMT 4 and 5, but I would not know, because I placed external .cpt files in the same directory as the GMT Master .cpt files. So, my problem is solved, albeit not in as elegant a way as prior GMT versions permitted [accidentally]
As I understand it, you have to append the suffix “.cpt” if you want to use your own CPT files. For example, gmt makecpt -CRdBU_08.cpt
should work, but gmt makecpt -CRdBU_08
won’t.
The file RdBu_08.cpt is in the directory $HOME/.gmt/cpt which I also set as the global variable $GMT_DATADIR in my $HOME/.cshrc (my default shell is the csh). Then I find
- “gmt makecpt -CRdBu_08.cpt …” does NOT work;
- “gmt makecpt -CRdBu_08 …” does not work;
- "gmt makecpt -C$GMT_DATADIR/RdBu_08.cpt works;
- "gmt makecpt -C/Users/a2/.gmt/cpt/RdBu_08.cpt works
So, the command works only if I specify the specific path and full filename. This tells me, that the code for makecpt does not use the global variable $GMT_DATADIR to look for .cpt files external to those that ship with the GMT installation. Perhaps it requires another global variable that I have not set or it requires the full path and name.
I just made a subdir ~/subdir and placed a cpt file called junk.cpt there.
- If I add that dir to the GMT_DATADIR environmental variable then -Cjunk.cpt is found
- If I remove the environmental setting and use gmt set DATA_DIR /Users/pwessel/subdir to update my gmtconf file then -Cjunk.cpt is found
- If I just place it in my ~/.gmt directory then -Cjunk.cpt works fine as well.
So something is not quite right on your end I think. Admittedly I am running off master (6.3.0 wannabe) but I do not think this area has changed.