.\" Man page generated from reStructuredText. . .TH "GRD2CPT" "1gmt" "Nov 05, 2016" "5.3.1" "GMT" .SH NAME grd2cpt \- Make linear or histogram-equalized color palette table from grid . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH SYNOPSIS .sp \fBgrd2cpt\fP \fIgrid\fP [ \fB\-A\fP[\fB+\fP]\fItransparency\fP ] [ \fB\-C\fP\fIcpt\fP ] [ \fB\-D\fP[\fBi\fP|\fBo\fP] ] [ \fB\-E\fP[\fInlevels\fP] ] [ \fB\-F\fP[\fBR\fP|\fBr\fP|\fBh\fP|\fBc\fP ][\fB+c\fP]] [ \fB\-G\fP\fIzlo\fP/\fIzhi\fP ] [ \fB\-I\fP ] [ \fB\-L\fP\fIminlimit/maxlimit\fP ] [ \fB\-M\fP ] [ \fB\-N\fP ] [ \fB\-Q\fP[\fBi\fP|\fBo\fP] ] [ \fB\-R\fP\fIregion\fP ] [ \fB\-S\fP\fIzstart/zstop/zinc\fP ] [ \fB\-T\fP\fB\-\fP|\fB+\fP|\fB_\fP|\fB=\fP ] [ \fB\-V\fP[\fIlevel\fP] ] [ \fB\-W\fP ] [ \fB\-Z\fP ] .sp \fBNote:\fP No space is allowed between the option flag and the associated arguments. .SH DESCRIPTION .sp \fBgrd2cpt\fP reads one or more grid files and writes a static color palette (CPT) file to standard output. The CPT is based on an existing dynamic master CPT of your choice, and the mapping from data value to colors is through the data\(aqs cumulative distribution function (CDF), so that the colors are histogram equalized. Thus if the grid(s) and the resulting CPT are used in grdimage with a linear projection, the colors will be uniformly distributed in area on the plot. Let z be the data values in the grid. Define CDF(Z) = (# of z < Z) / (# of z in grid). (NaNs are ignored). These z\-values are then normalized to the master CPT and colors are sampled at the desired intervals. .sp The color palette includes three additional colors beyond the range of z\-values. These are the background color (B) assigned to values lower than the lowest \fIz\fP\-value, the foreground color (F) assigned to values higher than the highest \fIz\fP\-value, and the NaN color (N) painted wherever values are undefined. For color tables beyond the standard GMT offerings, visit cpt\-city: \fI\%http://soliton.vm.bytemark.co.uk/pub/cpt\-city/\fP\&. .sp If the master CPT includes B, F, and N entries, these will be copied into the new master file. If not, the parameters COLOR_BACKGROUND, COLOR_FOREGROUND, and COLOR_NAN from the gmt.conf file or the command line will be used. This default behavior can be overruled using the options \fB\-D\fP, \fB\-M\fP or \fB\-N\fP\&. .sp The color model (RGB, HSV or CMYK) of the palette created by makecpt will be the same as specified in the header of the master CPT. When there is no COLOR_MODEL entry in the master CPT, the COLOR_MODEL specified in the gmt.conf file or on the command line will be used. .SH REQUIRED ARGUMENTS .INDENT 0.0 .TP .B \fIgrid\fP Names of one or more grid files used to derive the color palette table. All grids need to have the same size and dimensions. (See GRID FILE FORMATS below). .UNINDENT .SH OPTIONAL ARGUMENTS .INDENT 0.0 .TP \fB\-A\fP[\fB+\fP]\fItransparency\fP Sets a constant level of transparency (0\-100) for all color slices. Prepend \fB+\fP to also affect the fore\-, back\-, and nan\-colors [Default is no transparency, i.e., 0 (opaque)]. .UNINDENT .INDENT 0.0 .TP \fB\-C\fP\fIcpt\fP Selects the master color table to use in the interpolation. Choose among the built\-in tables (type \fBgrd2cpt\fP to see the list) or give the name of an existing CPT [Default gives a rainbow CPT]. Yet another option is to specify \-Ccolor1,color2[,color3,...] to build a linear continuous CPT from those colors automatically. In this case \fIcolor\fP\fBn\fP can be a r/g/b triplet, a color name, or an HTML hexadecimal color (e.g. #aabbcc ). .UNINDENT .INDENT 0.0 .TP \fB\-D\fP[\fBi\fP|\fBo\fP] Select the back\- and foreground colors to match the colors for lowest and highest \fIz\fP\-values in the output CPT [Default uses the colors specified in the master file, or those defined by the parameters COLOR_BACKGROUND, COLOR_FOREGROUND, and COLOR_NAN]. Append \fBi\fP to match the colors for the lowest and highest values in the input (instead of the output) CPT. .UNINDENT .INDENT 0.0 .TP \fB\-E\fP[\fInlevels\fP] Create a linear color table by using the grid z\-range as the new limits in the CPT. Alternatively, append \fInlevels\fP and we will resample the color table into \fInlevels\fP equidistant slices. .UNINDENT .INDENT 0.0 .TP \fB\-F\fP[\fBR\fP|\fBr\fP|\fBh\fP|\fBc\fP][\fB+c\fP]] Force output CPT to written with r/g/b codes, gray\-scale values or color name (\fBR\fP, default) or r/g/b codes only (\fBr\fP), or h\-s\-v codes (\fBh\fP), or c/m/y/k codes (\fBc\fP). Optionally or alternatively, append \fB+c\fP to write discrete palettes in categorical format. .UNINDENT .INDENT 0.0 .TP \fB\-G\fP\fIzlo\fP/\fIzhi\fP Truncate the incoming CPT so that the lowest and highest z\-levels are to \fIzlo\fP and \fIzhi\fP\&. If one of these equal NaN then we leave that end of the CPT alone. The truncation takes place before any resampling. .UNINDENT .INDENT 0.0 .TP \fB\-I\fP Reverses the sense of color progression in the master CPT. Also exchanges the foreground and background colors, including those specified by the parameters COLOR_BACKGROUND and COLOR_FOREGROUND\&. .UNINDENT .INDENT 0.0 .TP \fB\-L\fP\fIminlimit/maxlimit\fP Limit range of CPT to \fIminlimit/maxlimit\fP, and don\(aqt count data outside this range when estimating CDF(Z). [Default uses min and max of data.] .UNINDENT .INDENT 0.0 .TP \fB\-M\fP Overrule background, foreground, and NaN colors specified in the master CPT with the values of the parameters COLOR_BACKGROUND, COLOR_FOREGROUND, and COLOR_NAN specified in the gmt.conf file or on the command line. When combined with \fB\-D\fP, only COLOR_NAN is considered. .UNINDENT .INDENT 0.0 .TP \fB\-N\fP Do not write out the background, foreground, and NaN\-color fields [Default will write them]. .UNINDENT .INDENT 0.0 .TP \fB\-Q\fP[\fBi\fP|\fBo\fP] Selects a logarithmic interpolation scheme [Default is linear]. \fB\-Qi\fP expects input z\-values to be log10(z), assigns colors, and writes out z [Default]. \fB\-Qo\fP takes log10(z) first, assigns colors, and writes out z. .UNINDENT .INDENT 0.0 .TP \fB\-R\fP[\fIunit\fP]\fIxmin\fP/\fIxmax\fP/\fIymin\fP/\fIymax\fP[\fBr\fP] (more ...) Specify the region of interest. .UNINDENT .INDENT 0.0 .TP \fB\-S\fP\fIzstart/zstop/zinc\fP or \fB\-S\fP\fIn\fP Set steps in CPT. Calculate entries in CPT from \fIzstart\fP to \fIzstop\fP in steps of (\fIzinc\fP). Default chooses arbitrary values by a crazy scheme based on equidistant values for a Gaussian CDF. Use \fB\-S\fP\fIn\fP to select \fIn\fP points from such a cumulative normal distribution [11]. .UNINDENT .INDENT 0.0 .TP \fB\-T\fP\fB\-\fP|\fB+\fP|\fB_\fP|\fB=\fP Force the color table to be symmetric about zero (from \-R to +R). Append flag to set the range R: \fB\-\fP for R =|zmin|, \fB+\fP for R = |zmax|, \fB_\fP for R = min(|zmin|, |zmax|), or \fB=\fP for R = max(|zmin|, |zmax|). .UNINDENT .INDENT 0.0 .TP \fB\-V\fP Verbose operation. This will write CDF(Z) estimates to stderr. [Default is silent.] .UNINDENT .INDENT 0.0 .TP \fB\-W\fP Do not interpolate the input color table but pick the output colors starting at the beginning of the map. This is particularly useful in combination with a categorical color table. Cannot be used in combination with \fB\-Z\fP\&. .UNINDENT .INDENT 0.0 .TP \fB\-Z\fP Will create a continuous color palette. [Default is discontinuous, i.e., constant color intervals] .UNINDENT .INDENT 0.0 .TP \fB\-^\fP or just \fB\-\fP Print a short message about the syntax of the command, then exits (NOTE: on Windows use just \fB\-\fP). .TP \fB\-+\fP or just \fB+\fP Print an extensive usage (help) message, including the explanation of any module\-specific option (but not the GMT common options), then exits. .TP \fB\-?\fP or no arguments Print a complete usage (help) message, including the explanation of options, then exits. .UNINDENT .SH GRID FILE FORMATS .sp By default GMT writes out grid as single precision floats in a COARDS\-complaint netCDF file format. However, GMT is able to produce grid files in many other commonly used grid file formats and also facilitates so called "packing" of grids, writing out floating point data as 1\- or 2\-byte integers. (more ...) .SH NOTES ON TRANSPARENCY .sp The \fIPostScript\fP language originally had no accommodation for transparency. However, Adobe added an extension that allows developers to encode some forms of transparency using the \fIPostScript\fP language model but it is only realized when converting the \fIPostScript\fP to PDF (and via PDF to any raster image format). GMT uses this model but there are some limitations: Transparency can only be controlled on a per\-object or per\-layer basis. This means that a color specifications (such as those in CPTs of given via command\-line options) only apply to vector graphic items (i.e., text, lines, polygon fills) or to an entire layer (which could include items such as \fIPostScript\fP images). This limitation rules out any mechanism of controlling transparency in such images on a pixel level. .SH COLOR ALIASING .sp For best result when \fB\-E\fP is used we recommend you do no append a specific \fInlevels\fP\&. This way the original CPT is used exactly as is but the \fIz\fP boundaries are adjusted to match the grid limits. Otherwise you may, depending on the nature of the input CPT, miss aspects of the color changes by aliasing the signal. .SH EXAMPLES .sp Sometimes you don\(aqt want to make a CPT (yet) but would find it helpful to know that 90% of your data lie between z1 and z2, something you cannot learn from grdinfo\&. So you can do this to see some points on the CDF(Z) curve (use \fB\-V\fP option to see more): .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C gmt grd2cpt mydata.nc \-V > /dev/null .ft P .fi .UNINDENT .UNINDENT .UNINDENT .UNINDENT .sp To make a CPT with entries from 0 to 200 in steps of 20, and ignore data below zero in computing CDF(Z), and use the built\-in master cpt file relief, run .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C gmt grd2cpt mydata.nc \-Crelief \-L0/10000 \-S0/200/20 > mydata.cpt .ft P .fi .UNINDENT .UNINDENT .UNINDENT .UNINDENT .SH SEE ALSO .sp gmt, gmt.conf, grdhisteq, grdinfo, makecpt .SH COPYRIGHT 2016, P. Wessel, W. H. F. Smith, R. Scharroo, J. Luis, and F. Wobbe .\" Generated by docutils manpage writer. .