Skip to content

Commit 7ddd092

Browse files
committed
Merge branch '6.0'
2 parents a69c42f + cbb7be5 commit 7ddd092

20 files changed

+88
-120
lines changed

cmake/ConfigUserTemplate.cmake

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -249,24 +249,24 @@
249249
#set (CMAKE_BUILD_TYPE Debug)
250250

251251
# Extra debugging for developers:
252-
if ( CMAKE_GENERATOR STREQUAL "Xcode" )
253-
# So Xcode can find the supplemental plug-ins during debug sessions
254-
add_definitions(-DXCODER) # Handle a debug plugin directory
255-
add_definitions(-DDEBUG_MODERN) # To set PPID == 0 during Xcode test
256-
message("Add Xcode definition for GMT")
257-
endif()
252+
#if ( CMAKE_GENERATOR STREQUAL "Xcode" )
253+
# # So Xcode can find the supplemental plug-ins during debug sessions
254+
# add_definitions(-DXCODER) # Handle a debug plugin directory
255+
# add_definitions(-DDEBUG_MODERN) # To set PPID == 0 during Xcode test
256+
# message("Add Xcode definition for GMT")
257+
#endif()
258258
# Uncomment these two statements if you are a developer debugging GMT:
259259
#add_definitions(-DDEBUG)
260260
#add_definitions(-DMEMDEBUG) # Turn on memory tracking see gmt_support.c for extra info
261261
#set (CMAKE_C_FLAGS "-Wall -Wdeclaration-after-statement") # recommended even for release build
262262
#set (CMAKE_C_FLAGS "-Wextra ${CMAKE_C_FLAGS}") # extra warnings
263263
#set (CMAKE_C_FLAGS_DEBUG -ggdb3) # gdb debugging symbols
264264
#set (CMAKE_LINK_DEPENDS_DEBUG_MODE TRUE) # debug link dependencies
265-
if (HAVE_OPENMP)
266-
set (CMAKE_C_FLAGS_RELEASE "-ggdb3 -O2 -Wuninitialized -flax-vector-conversions") # check uninitialized variables
267-
else (HAVE_OPENMP)
268-
set (CMAKE_C_FLAGS_RELEASE "-ggdb3 -O2 -Wuninitialized") # check uninitialized variables
269-
endif (HAVE_OPENMP)
265+
#if (HAVE_OPENMP)
266+
# set (CMAKE_C_FLAGS_RELEASE "-ggdb3 -O2 -Wuninitialized -flax-vector-conversions") # check uninitialized variables
267+
#else (HAVE_OPENMP)
268+
# set (CMAKE_C_FLAGS_RELEASE "-ggdb3 -O2 -Wuninitialized") # check uninitialized variables
269+
#endif (HAVE_OPENMP)
270270

271271
#
272272
# System specific tweaks

doc/rst/source/colorbar_common.rst_

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ Optional Arguments
3030
the right of a vertical bar), except when using the **+m** modifier of the **-D** option. As an
3131
option, use the y-axis label to plot the data unit to the right of a
3232
horizontal bar (and above a vertical bar). If **-B** is omitted, or no annotation intervals are
33-
provided, the default is to annotate every color level based on the
33+
provided (classic mode only), the default is to annotate every color level based on the
3434
numerical entries in the CPT (which may be overridden by ULB
35-
flags in the CPT). To specify custom text annotations for
35+
flags in the CPT). The exception to this rule is for CPT files that were scaled to fit the range
36+
of a grid exactly and thus have arbitrary color levels; these will trigger an automatic **-Baf** setting.
37+
To specify custom text annotations for
3638
intervals, you must append ;\ *annotation* to each z-slice in the CPT.
3739
For standard **-B** operations, see below.
3840

doc/rst/source/grd2kml.rst

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,17 @@ Optional Arguments
5454

5555
.. _-C:
5656

57-
**-C**\ *cpt*
58-
Name of the color palette table (CPT). Alternatively,
59-
supply the name of a GMT color master dynamic CPT [turbo] to
57+
**-C**\ [*cpt* \|\ *master*\ [**+i**\ *zinc*] \|\ *color1,color2*\ [,\ *color3*\ ,...]]
58+
Name of the CPT (for *grd_z* only). Alternatively,
59+
supply the name of a GMT color master dynamic CPT [turbo, but geo
60+
for @earth_relief and srtm for @srtm_relief data] to
6061
automatically determine a continuous CPT from
61-
the grid's z-range. If the dynamic CPT has a default range then
62-
that range will be imposed instead.
63-
Another option is to specify **-C**\ *color1*\ ,\ *color2*\ [,\ *color3*\ ,...]
64-
to build a linear continuous CPT from those colors automatically, scaled to fit the data range.
65-
In this case *color1*, etc., can be a *r/g/b* triplet, a color name,
66-
or an HTML hexadecimal color (e.g. #aabbcc ).
62+
the grid's z-range; you may round up/down the z-range by adding **+i**\ *zinc*.
63+
Yet another option is to specify **-C**\ *color1*\ ,\ *color2*\ [,\ *color3*\ ,...]
64+
to build a linear continuous CPT from those colors automatically.
65+
In this case *color1* etc can be a r/g/b triplet, a color name,
66+
or an HTML hexadecimal color (e.g. #aabbcc ). If no argument is given to **-C**
67+
then under modern mode we select the current CPT.
6768

6869
.. _-E:
6970

doc/rst/source/grdcontour_common.rst_

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ Optional Arguments
127127
(see `Units`_ for available units and how distances are computed),
128128
including **c** (Cartesian distances using user coordinates) or **C** for plot
129129
length units in current plot units after projecting the coordinates.
130-
Optionally, append **z** to exclude the zero contour.
130+
Optionally, append **+z** to exclude the zero contour.
131131

132132
.. _-R:
133133

doc/rst/source/psternary.rst

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Synopsis
1414

1515
**gmt psternary** [ *table* ]
1616
[ **-JX**\ *width*\ [unit] ]
17-
[ |SYN_OPT-Rz| ]
17+
[ |-R|\ *amin/amax/bmin/bmax/cmin/cmax* ]
1818
[ |SYN_OPT-B| ]
1919
[ |-C|\ *cpt* ]
2020
[ |-G|\ *fill* ]
@@ -29,7 +29,6 @@ Synopsis
2929
[ |-W|\ [*pen*][*attr*] ]
3030
[ |SYN_OPT-X| ]
3131
[ |SYN_OPT-Y| ]
32-
[ |SYN_OPT-a| ]
3332
[ |SYN_OPT-bi| ]
3433
[ |SYN_OPT-di| ]
3534
[ |SYN_OPT-e| ]
@@ -53,14 +52,12 @@ Examples
5352

5453
To plot circles (diameter = 0.1 cm) on a 6-inch-wide ternary diagram at the positions listed
5554
in the file ternary.txt, with default annotations and gridline spacings, using the
56-
specified labeling, tru
57-
58-
::
59-
60-
gmt psternary ternary.txt -R0/100/0/100/0/100 -JX6i -P -Xc -Baafg+l"Water component"+u" %" \
61-
-Bbafg+l"Air component"+u" %" -Bcagf+l"Limestone component"+u" %" \
62-
-B+givory+t"Example data from MATLAB Central" -Sc0.1c -Ct.cpt -Y2i -LWater/Air/Limestone > map.ps
55+
specified labeling, try::
6356

57+
gmt makecpt -Cturbo -T0/80/10 > t.cpt
58+
gmt psternary @ternary.txt -R0/100/0/100/0/100 -JX6i -P -Sc0.1c -Ct.cpt -LWater/Air/Limestone \
59+
-Baafg+l"Water component"+u" %" -Bbafg+l"Air component"+u" %" -Bcagf+l"Limestone component"+u" %" \
60+
-B+givory+t"Example data from MATLAB Central" > map.ps
6461

6562
See Also
6663
--------

doc/rst/source/ternary.rst

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Synopsis
1414

1515
**gmt ternary** [ *table* ]
1616
[ **-JX**\ *width*\ [unit] ]
17-
[ |SYN_OPT-Rz| ]
17+
[ |-R|\ *amin/amax/bmin/bmax/cmin/cmax* ]
1818
[ |SYN_OPT-B| ]
1919
[ |-C|\ *cpt* ]
2020
[ |-G|\ *fill* ]
@@ -27,7 +27,6 @@ Synopsis
2727
[ |-W|\ [*pen*][*attr*] ]
2828
[ |SYN_OPT-X| ]
2929
[ |SYN_OPT-Y| ]
30-
[ |SYN_OPT-a| ]
3130
[ |SYN_OPT-bi| ]
3231
[ |SYN_OPT-di| ]
3332
[ |SYN_OPT-e| ]
@@ -45,18 +44,16 @@ Synopsis
4544
Examples
4645
--------
4746

48-
.. include:: explain_example.rst_
49-
50-
.. include:: oneliner_info.rst_
51-
5247
To plot circles (diameter = 0.1 cm) on a 6-inch-wide ternary diagram at the positions listed
5348
in the file ternary.txt, with default annotations and gridline spacings, using the
5449
specified labeling, try::
5550

56-
gmt ternary ternary.txt -R0/100/0/100/0/100 -JX6i -Xc -Baafg+l"Water component"+u" %" \
57-
-Bbafg+l"Air component"+u" %" -Bcagf+l"Limestone component"+u" %" \
58-
-B+givory+t"Example data from MATLAB Central" -Sc0.1c -Ct.cpt -Y2i -LWater/Air/Limestone -pdf map
59-
51+
gmt begin map
52+
gmt makecpt -Cturbo -T0/80/10
53+
gmt ternary @ternary.txt -R0/100/0/100/0/100 -JX6i -Sc0.1c -C -LWater/Air/Limestone \
54+
-Baafg+l"Water component"+u" %" -Bbafg+l"Air component"+u" %" -Bcagf+l"Limestone component"+u" %" \
55+
-B+givory+t"Example data from MATLAB Central"
56+
gmt end show
6057

6158
See Also
6259
--------

doc/rst/source/ternary_common.rst_

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Either **-M** (for dumping data) or **-R** and **-J** must be selected.
1919
Optional Arguments
2020
------------------
2121

22-
.. |Add_intables| replace:: Use **-T** to ignore all input files, including standard input (see below).
22+
.. |Add_intables| unicode:: 0x20 .. just an invisible code
2323
.. include:: explain_intables.rst_
2424

2525
.. _-B:
@@ -105,8 +105,6 @@ Optional Arguments
105105
.. |Add_-bi| replace:: [Default is the required number of columns given the chosen settings].
106106
.. include:: explain_-bi.rst_
107107

108-
.. include:: explain_-aspatial.rst_
109-
110108
.. |Add_-di| unicode:: 0x20 .. just an invisible code
111109
.. include:: explain_-di.rst_
112110

doc/scripts/GMT_App_P_1.ps

-89.7 KB
Binary file not shown.

doc/scripts/GMT_App_P_1.sh

Lines changed: 0 additions & 27 deletions
This file was deleted.

doc/scripts/GMT_App_P_2.ps

-92.3 KB
Binary file not shown.

doc/scripts/GMT_App_P_2.sh

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/gmt_init.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15850,6 +15850,18 @@ GMT_LOCAL bool check_if_autosize (struct GMTAPI_CTRL *API, int ID) {
1585015850
return false;
1585115851
}
1585215852

15853+
GMT_LOCAL bool A_was_given (char *text) {
15854+
/* Determine if A is one of the arguments */
15855+
size_t k = 1;
15856+
if (!text || !text[0]) return false; /* No args means -A was not given */
15857+
if (text[0] == 'A') return true; /* A was given as first option */
15858+
while (text[k]) {
15859+
if (text[k] == 'A' && text[k-1] == ',') return true; /* Found A as first letter after comma */
15860+
k++;
15861+
}
15862+
return false;
15863+
}
15864+
1585315865
GMT_LOCAL int process_figures (struct GMTAPI_CTRL *API, char *show) {
1585415866
/* Loop over all registered figures and their selected formats and
1585515867
* convert the hidden PostScript figures to selected graphics.
@@ -15937,7 +15949,7 @@ GMT_LOCAL int process_figures (struct GMTAPI_CTRL *API, char *show) {
1593715949
if (p[0] == 'D') strcpy (dir, &p[1]); /* Needed in show */
1593815950
}
1593915951
}
15940-
if (not_PS && auto_size && strchr (fig[k].options, 'A') == NULL) /* Must always add -A if not PostScript unless when media size is given, unless crop is off via +n */
15952+
if (not_PS && auto_size && !A_was_given (fig[k].options)) /* Must always add -A if not PostScript unless when media size is given, unless crop is off via +n */
1594115953
strcat (cmd, " -A");
1594215954
}
1594315955
else if (API->GMT->current.setting.ps_convert[0]) { /* Supply chosen session settings for psconvert */
@@ -15950,7 +15962,7 @@ GMT_LOCAL int process_figures (struct GMTAPI_CTRL *API, char *show) {
1595015962
if (p[0] == 'D') strcpy (dir, &p[1]); /* Needed in show */
1595115963
}
1595215964
}
15953-
if (not_PS && auto_size && strchr (API->GMT->current.setting.ps_convert, 'A') == NULL) /* Must always add -A if not PostScript unless when media size is given */
15965+
if (not_PS && auto_size && !A_was_given (API->GMT->current.setting.ps_convert)) /* Must always add -A if not PostScript unless when media size is given */
1595415966
strcat (cmd, " -A");
1595515967
}
1595615968
else if (not_PS && auto_size) /* No specific settings but must always add -A if not PostScript unless when media size is given */

src/gmt_support.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7170,9 +7170,9 @@ struct GMT_PALETTE * gmtlib_read_cpt (struct GMT_CTRL *GMT, void *source, unsign
71707170
* GMT_CPT_EXTEND_BNF = Make B and F equal to low and high color
71717171
*/
71727172

7173-
unsigned int n = 0, i, nread, annot, id, n_cat_records = 0, color_model, n_master = 0;
7173+
unsigned int n = 0, i, nread, annot, id, n_cat_records = 0, color_model;
71747174
size_t k;
7175-
bool gap, overlap, error = false, close_file = false, check_headers = true, master = false;
7175+
bool gap, overlap, error = false, close_file = false, check_headers = true;
71767176
size_t n_alloc = GMT_SMALL_CHUNK, n_hdr_alloc = 0;
71777177
double dz;
71787178
char T0[GMT_LEN64] = {""}, T1[GMT_LEN64] = {""}, T2[GMT_LEN64] = {""}, T3[GMT_LEN64] = {""}, T4[GMT_LEN64] = {""};
@@ -7181,6 +7181,7 @@ struct GMT_PALETTE * gmtlib_read_cpt (struct GMT_CTRL *GMT, void *source, unsign
71817181
char *name = NULL, *h = NULL;
71827182
FILE *fp = NULL;
71837183
struct GMT_PALETTE *X = NULL;
7184+
struct GMT_PALETTE_HIDDEN *XH = NULL;
71847185
struct CPT_Z_SCALE *Z = NULL; /* For unit manipulations */
71857186

71867187
/* Determine input source */
@@ -7231,7 +7232,7 @@ struct GMT_PALETTE * gmtlib_read_cpt (struct GMT_CTRL *GMT, void *source, unsign
72317232
color_model = GMT->current.setting.color_model; /* Save the original setting since it may be modified by settings in the CPT */
72327233
/* Also: GMT->current.setting.color_model is used in some rgb_to_xxx functions so it must be set if changed by cpt */
72337234
X->is_gray = X->is_bw = true; /* May be changed when reading the actual colors */
7234-
7235+
XH = gmt_get_C_hidden (X);
72357236
/* Set default BFN colors; these may be overwritten by things in the CPT */
72367237
for (id = 0; id < 3; id++) {
72377238
gmt_M_rgb_copy (X->bfn[id].rgb, GMT->current.setting.color_patch[id]);
@@ -7290,17 +7291,14 @@ struct GMT_PALETTE * gmtlib_read_cpt (struct GMT_CTRL *GMT, void *source, unsign
72907291
}
72917292
else if ((h = strstr (line, "CYCLIC"))) /* CPT should wrap around */
72927293
X->is_wrapping = 1;
7294+
else if ((h = strstr (line, "ENABLE_B_OPTION"))) /* CPT was stretched to exact min/max with no dz rounding */
7295+
XH->auto_scale = 1;
72937296

72947297
GMT->current.setting.color_model = X->model;
72957298

72967299
if (c == '#') { /* Possibly a header/comment record */
72977300
if (GMT->common.h.mode == GMT_COMMENT_IS_RESET) continue; /* Simplest way to replace headers on output is to ignore them on input */
72987301
if (!check_headers) continue; /* Done with the initial header records */
7299-
if (strstr (line, "$Id:")) master = true;
7300-
if (master) {
7301-
n_master++;
7302-
if (n_master <= 2) continue; /* Skip first 2 lines of GMT master CPTs */
7303-
}
73047302
if (n_hdr_alloc == 0) X->header = gmt_M_memory (GMT, X->header, (n_hdr_alloc = GMT_TINY_CHUNK), char *);
73057303
X->header[X->n_headers] = strdup (line);
73067304
X->n_headers++;
@@ -7763,6 +7761,7 @@ struct GMT_PALETTE *gmt_get_palette (struct GMT_CTRL *GMT, char *file, enum GMT_
77637761
if (is_cpt_master) { /* Take master cpt and stretch to fit data range using continuous colors */
77647762
char *master = NULL, *current_cpt = NULL;
77657763
double noise;
7764+
struct GMT_PALETTE_HIDDEN *PH = NULL;
77667765

77677766
if (gmt_M_is_dnan (zmin) || gmt_M_is_dnan (zmax)) { /* Safety valve 1 */
77687767
GMT_Report (GMT->parent, GMT_MSG_NORMAL, "Passing zmax or zmin == NaN prevents automatic CPT generation!\n");
@@ -7794,6 +7793,8 @@ struct GMT_PALETTE *gmt_get_palette (struct GMT_CTRL *GMT, char *file, enum GMT_
77947793
zmax = (ceil (zmax / dz) * dz);
77957794
GMT_Report (GMT->parent, GMT_MSG_LONG_VERBOSE, "Auto-stretching CPT file %s to fit rounded data range %g to %g\n", master, zmin, zmax);
77967795
}
7796+
PH = gmt_get_C_hidden (P);
7797+
PH->auto_scale = 1; /* Flag for colorbar to supply -Baf if not given */
77977798
gmt_stretch_cpt (GMT, P, zmin, zmax);
77987799
gmt_save_current_cpt (GMT, P, 0); /* Save for use by session, if modern */
77997800
}
@@ -8211,6 +8212,7 @@ int gmtlib_write_cpt (struct GMT_CTRL *GMT, void *dest, unsigned int dest_type,
82118212
static char *msg1[2] = {"Writing", "Appending"};
82128213
FILE *fp = NULL;
82138214
struct CPT_Z_SCALE *Z = NULL; /* For unit manipulations */
8215+
struct GMT_PALETTE_HIDDEN *PH = NULL;
82148216

82158217
/* When writing the CPT to file it is no longer a normalized CPT with a hinge */
82168218
P->has_range = P->has_hinge = 0;
@@ -8259,6 +8261,8 @@ int gmtlib_write_cpt (struct GMT_CTRL *GMT, void *dest, unsigned int dest_type,
82598261
}
82608262
GMT_Report (GMT->parent, GMT_MSG_DEBUG, "%s CPT to %s\n", msg1[append], &cpt_file[append]);
82618263

8264+
PH = gmt_get_C_hidden (P);
8265+
82628266
/* Start writing CPT info to fp */
82638267

82648268
for (i = 0; i < P->n_headers; i++) { /* First write the old headers */
@@ -8280,6 +8284,8 @@ int gmtlib_write_cpt (struct GMT_CTRL *GMT, void *dest, unsigned int dest_type,
82808284
}
82818285
if (P->is_wrapping)
82828286
fprintf (fp, "# CYCLIC\n");
8287+
if (PH->auto_scale)
8288+
fprintf (fp, "# ENABLE_B_OPTION\n");
82838289

82848290
sprintf (format, "%%s\t%%s%%c");
82858291

src/gmtprogram.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*--------------------------------------------------------------------
22
*
3-
* Copyright (c) 1991-$year by the GMT Team (https://www.generic-mapping-tools.org/team.html)
3+
* Copyright (c) 1991-2019 by the GMT Team (https://www.generic-mapping-tools.org/team.html)
44
* See LICENSE.TXT file for copying and redistribution conditions.
55
*
66
* This program is free software; you can redistribute it and/or modify

src/gmtswitch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ home=`pwd`
7575
if [ ! -f "$home/.gmtversions" ]; then # No .gmtversions exists yet, first do that part
7676
cat << EOF >&2
7777
78-
GMTSWITCH $Revision$
78+
GMTSWITCH
7979
8080
gmtswitch helps you modify your environment to allow for the switching back and
8181
forth between several GMT versions, in particular GMT 5 and previous GMT

0 commit comments

Comments
 (0)