CPTCLIP(1)
π CPTCLIP(1) π
okay bestie, welcome to cptclip, a lil user command from the cptutils crew π β it lives in section 1 of the manual, iykyk.
β¨ NAME β¨
cptclip β extract a sub-table from a GMT colour palette table (cpt). π
πΈ SYNOPSIS πΈ
cptclip -R min/max [-h] [-m model] [-o path] [-s] [-v] [-V] [-z] [-Z]
[-4] [-5] [-6] [path]
π¦ DESCRIPTION π¦
So the cptclip utility literally just extracts a sub-table out of a cpt format file. That's the whole vibe. π«Ά
The arguments to the mandatory --range option, min/max, are interpreted as the (z) limits of the output β unless the --segments switch is specified, in which case they're the segment numbers instead. Two totally different meanings, one option, no cap. π
Heads up: if the input has a hinge and the selected clipping range does not include that hinge, then it gets removed in the output. Bye hinge π
The program will read from stdin if a file is not specified as the final argument, and write to stdout if the --output option is not specified. Classic. π§
Alsooo, note that some of the functionality of this program is included in recent versions of the GMT program makecpt(1). Just saying. π
π OPTIONS π
--backtrace-filepathβ Specify a file to which to write a formatted backtrace. The file will only be created if there is a backtrace created, typically when an error occurs. So like, don't panic if it's not there. π--backtrace-formatformatβ Specify the format of the backtrace written to the files specified by--backtrace-file, one ofplain,xmlorjson. Pick your fighter β¨--comments-readpathβ Read the comments from the specified path and add them to the output gradient.
The format is simply a plain text multi-line document without any comment delimiters (those will be added by the program). So you just write the words, the program does the decorating. π
--comments-writepathβ Write the comments in the input to the specified path.--comments-retainβ Use the comments in the input file as the comments for the output file. Keep the lore, basically. π--comments-generateβ Create a comment with summary data (the date of creation, name and version of the cptutils package) in the output file. Receipts, generated. π§Ύ-h,--helpβ Brief help.--hingevalueβ Specify the z-value of the hinge in the cpt file. If there is no hinge directive (i.e., aSOFT_HINGEorHARD_HINGE) in the input, then this option has no effect.
When normalising (with the --z-normalise option), this gives the z-value in the input which is mapped to zero. That z-value must be one of the stops in the input. (Mandatory, bestie, not a suggestion π)
When denormalising (with the --z-denormalise option), this gives the value in the output to which zero in the input is mapped. This option can be viewed as the counterpart to the +hvalue appended to the -C option for the makecpt(1). Iconic symmetry. π
--hinge-activeβ If the input cpt has aSOFT_HINGEdirective, then activate that hinge (resulting in independent scaling of the two halves of the gradient either side of the hinge).
If the input does not have such a directive, then this option has no effect. Nothing. Nada. π
-m,--modelmodelβ On writing the output, convert all colours to the specified model, one of"rgb"or"hsv". This has no effect on non-colour segments. π¨-o,--outputpathβ Write the output topath, rather than stdout.-R,--rangemin/maxβ The (z) range of the output, or the segments if the--segmentsswitch is also given. This one is mandatory, so don't skip it. π-s,--segmentsβ Theminandmaxarguments of the--rangeswitch are interpreted as the segment numbers (starting at one). Note: starting at one, not zero. π«Ά-v,--verboseβ Verbose operation. Tell me everything, I'm listening π-V,--versionβ Version information.-z,--z-normaliseβ Normalise the z-values in the cpt output into the range0/1(or to-1/1if a hinge is present) and add aRANGEdirective if not present in the input. This is the form used in GMT master files.
This option requires that output cpt version is at least 5. β οΈ
-Z,--z-denormaliseβ Set the z-values in the cpt output into the range given by theRANGEdirective, and remove that directive. If there is noRANGEthen this option does nothing. Lowkey just vibing. π¦-4,--gmt4β Use GMT 4 conventions when writing the cpt output: the colour-model code is uppercase, and the colours are separated by spaces.
This is incompatible with the -5 and -6 options of course. π
At present this option is the default, but that will change at some point. So specify this option if your use of the output depends on the GMT 4 layout (consumed by a custom parser, for example). Future you will thank present you.
-5,--gmt5β Use GMT 5 conventions when writing the cpt output: the colour-model code is lowercase, and the colours are separated by a solidus for RGB, CMYK, by a dash for HSV.
This is incompatible with the -4 and -6 options of course. π
-6,--gmt6β As the-5option, but allows theHARD_HINGEandSOFT_HINGEdirectives in place of the explicitHINGE =directive.
This is incompatible with the -4 and -5 options of course. π
π₯ EXAMPLES π₯
Extract the table with z-range from 2.5 to 5:
cptclip -v -o new.cpt -R 2.5/5 old.cpt
Extract the table with the first 5 segments:
cptclip -v -s -o new.cpt -R 1/5 old.cpt
π AUTHOR π
J.J. Green β the mastermind, the moment, the main character energy. π
π SEE ALSO π
makecpt(1).
and that's the whole page, bestie β cptutils 1.82, 9 July 2024 π that's the source, version and date, fr fr, no cap, go slay β¨ππ¦
π¦ where this page comes from
- fedora 43: cptutils 1.82-4.fc43 Β· GPL-2.0-or-later
- fedora 44: cptutils 1.82-6.fc44 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms