Skip to content

Commit 3b399d3

Browse files
authored
Refresh the documentation and -A syntax for coupe (#4946)
* Modernize coupe -A syntax and parsing Replace old GMT3/4 syntax with proper parsing of geographic coordintaes and using modifiers for optional settings. * Fix typos * UPdates * Update coupe_common.rst_ * Update pscoupe.c
1 parent e4ffe1c commit 3b399d3

File tree

3 files changed

+126
-66
lines changed

3 files changed

+126
-66
lines changed

doc/rst/source/supplements/seis/coupe_common.rst_

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -39,28 +39,28 @@ Required Arguments
3939
.. _-A:
4040

4141
**-A**
42-
selects the cross-section.
42+
Select the cross-section parameters:
4343

44-
**-Aa**\ *lon1/lat1/lon2/lat2/dip/p\_width/dmin/dmax*\ [**+f**]
44+
**-Aa**\ *lon1*/*lat1*/*lon2*/*lat2*\ [**+d**\ *dip*][**+w**\ *width*][**+z**\ *dmin*/*dmax*][**+r**]
4545
*lon* and *lat* are the longitude and latitude of points 1 and 2
46-
limiting the length of the cross-section. *dip* is the dip of the plane
47-
on which the cross-section is made. *p\_width* is the width of the
46+
limiting the length of the cross-section, *dip* is the dip of the plane
47+
on which the cross-section is made [90], *width* is the width in km of the
4848
cross-section on each side of a vertical plane or above and under an
49-
oblique plane. *dmin* and *dmax* are the distances min and max from
50-
horizontal plane, along steepest descent direction. Add **+f** to get the
51-
frame from the cross-section parameters.
49+
oblique plane, and *dmin* and *dmax* are the distances min and max from
50+
horizontal plane in km, along steepest descent direction. Add **+r** to get the
51+
plot domain from the cross-section parameters.
5252

53-
**-Ab**\ *lon1/lat1/strike/p\_length/dip/p\_width/dmin/dmax*\ [**+f**]
53+
**-Ab**\ *lon1*/*lat1*/*strike*/*length*\ [**+d**\ *dip*][**+w**\ *width*][**+z**\ *dmin*/*dmax*][**+r**]
5454
*lon1* and *lat1* are the longitude and latitude of the beginning of the
55-
cross-section. *strike* is the azimuth of the direction of the
56-
cross-section. *p\_length* is the length along which the cross-section
57-
is made. The other parameters are the same as for **-Aa** option.
55+
cross-section, *strike* is the azimuth of the direction of the
56+
cross-section, and *length* is the length along which the cross-section
57+
is made (in km). The other parameters are the same as for **-Aa** option.
5858

59-
**-Ac**\ *x1/y1/x2/y2/dip/p\_width/dmin/dmax*\ [**+f**]
60-
The same as **-Aa** option with *x* and *y* cartesian coordinates.
59+
**-Ac**\ *x1*/*y1*/*x2*/*y2*\ [**+d**\ *dip*][**+w**\ *width*][**+z**\ *dmin*/*dmax*][**+r**]
60+
The same as **-Aa** option with *x* and *y* given as Cartesian coordinates.
6161

62-
**-Ad**\ *x1/y1/strike/p\_length/dip/p\_width/dmin/dmax*\ [**+f**]
63-
The same as **-Ab** option with *x* and *y* cartesian coordinates.
62+
**-Ad**\ *x1*/*y1*/*strike*/*length*\ [**+d**\ *dip*][**+w**\ *width*][**+z**\ *dmin*/*dmax*][**+r**]
63+
The same as **-Ab** option with *x* and *y* given as Cartesian coordinates.
6464

6565
.. _-S:
6666

@@ -82,15 +82,15 @@ Optional Arguments
8282
.. _-E:
8383

8484
**-E**\ *fill* :ref:`(more ...) <-Gfill_attrib>`
85-
Sets color or fill pattern for extensive quadrants [Default is white].
85+
Set color or fill pattern for extensive quadrants [Default is white].
8686

8787
.. _-F:
8888

8989
**-F**\ *mode*\ [*args*]
90-
Sets one or more attributes; repeatable. The various combinations are
90+
Set one or more attributes; repeatable. The various combinations are
9191

9292
**-Fs**\ *symbol*\ [*size*][**+f**\ *font*][**+j**\ *justify*][**+o**\ *dx*\ [/*dy*]]
93-
selects a symbol instead of mechanism. Choose from the following:
93+
Select a symbol instead of mechanism. Choose from the following:
9494
(**c**) circle, (**d**) diamond, (**i**) itriangle, (**s**) square,
9595
(**t**) triangle, (**x**) cross. *size* is the symbol size in
9696
:term:`PROJ_LENGTH_UNIT` (unless **c**, **i**, or **p** is appended
@@ -112,31 +112,31 @@ Optional Arguments
112112
Text string to appear near the beach ball
113113

114114
**-Fa**\ [*size*\ [/*Psymbol*\ [*Tsymbol*]]]
115-
Computes and plots P and T axes with symbols. Optionally specify
115+
Compute and plot P and T axes with symbols. Optionally specify
116116
*size* and (separate) P and T axis symbols from the following:
117117
(**c**) circle, (**d**) diamond, (**h**) hexagon, (**i**) inverse
118118
triangle, (**p**) point, (**s**) square, (**t**) triangle, (**x**)
119119
cross. [Default: 6\ **p**/**cc**]
120120

121121
**-Fe**\ *fill* :ref:`(more ...) <-Gfill_attrib>`
122-
Sets the color or fill pattern for the T axis symbol. [Default as set by |-E|]
122+
Set the color or fill pattern for the T axis symbol. [Default as set by |-E|]
123123

124124
**-Fg**\ *fill* :ref:`(more ...) <-Gfill_attrib>`
125-
Sets the color or fill pattern for the P axis symbol. [Default as set by |-G|]
125+
Set the color or fill pattern for the P axis symbol. [Default as set by |-G|]
126126

127127
**-Fp**\ [*pen*]
128-
Draws the P axis outline using current pen (see |-W|), or sets pen attributes.
128+
Draw the P axis outline using current pen (see |-W|), or sets pen attributes.
129129

130130
**-Fr**\ [*fill*]
131131
Draw a box behind the label (if any). [Default fill is white]
132132

133133
**-Ft**\ [*pen*]
134-
Draws the T axis outline using current pen (see **-W**), or sets pen attributes.
134+
Draw the T axis outline using current pen (see **-W**), or sets pen attributes.
135135

136136
.. _-G:
137137

138138
**-G**\ *fill* :ref:`(more ...) <-Gfill_attrib>`
139-
Sets color or fill pattern for compressional quadrants [Default is black].
139+
Set color or fill pattern for compressional quadrants [Default is black].
140140

141141
.. _-H:
142142

@@ -157,7 +157,7 @@ Optional Arguments
157157
.. _-L:
158158

159159
**-L**\ [*pen*]
160-
Draws the "beach ball" outline using current pen (see |-W|) or
160+
Draw the "beach ball" outline using current pen (see |-W|) or
161161
sets pen attributes.
162162

163163
.. _-M:
@@ -178,7 +178,7 @@ Optional Arguments
178178
.. _-T:
179179

180180
**-T**\ [*nplane*][**/**\ *pen*]
181-
Plots the nodal planes and outlines the bubble which is transparent.
181+
Plot the nodal planes and outlines the bubble which is transparent.
182182
If *nplane* is
183183

184184
*0*: both nodal planes are plotted;

src/seis/pscoupe.c

Lines changed: 99 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ struct PSCOUPE_CTRL {
5454
int fuseau;
5555
char proj_type;
5656
double p_width, p_length, dmin, dmax;
57+
double lon1, lat1, lon2, lat2;
5758
double xlonref, ylatref;
5859
struct GMT_PEN pen;
5960
struct nodal_plane PREF;
@@ -114,7 +115,7 @@ struct PSCOUPE_CTRL {
114115
struct GMT_FILL fill;
115116
struct GMT_FONT font;
116117
} S;
117-
struct PSCOUPE_T { /* -Tnplane[/<pen>] */
118+
struct PSCOUPE_T { /* -T<nplane>[/<pen>] */
118119
bool active;
119120
unsigned int n_plane;
120121
struct GMT_PEN pen;
@@ -123,7 +124,7 @@ struct PSCOUPE_CTRL {
123124
bool active;
124125
struct GMT_PEN pen;
125126
} W;
126-
struct PSCOUPE_A2 { /* -Fa[size[/Psymbol[Tsymbol]]] */
127+
struct PSCOUPE_A2 { /* -Fa[<size>[/<Psymbol>[<Tsymbol>]]] */
127128
bool active;
128129
char P_symbol, T_symbol;
129130
double size;
@@ -161,6 +162,7 @@ static void *New_Ctrl (struct GMT_CTRL *GMT) { /* Allocate and initialize a new
161162

162163
/* Initialize values whose defaults are not 0/false/NULL */
163164

165+
C->A.PREF.dip = 90.0; /* Vertical is the default dip */
164166
C->L.pen = C->T.pen = C->P2.pen = C->T2.pen = C->W.pen = GMT->current.setting.map_default_pen;
165167
/* Set width temporarily to -1. This will indicate later that we need to replace by W.pen */
166168
C->L.pen.width = C->T.pen.width = C->P2.pen.width = C->T2.pen.width = -1.0;
@@ -453,11 +455,12 @@ static int usage (struct GMTAPI_CTRL *API, int level) {
453455
if (level == GMT_SYNOPSIS) return (GMT_MODULE_SYNOPSIS);
454456

455457
GMT_Message (API, GMT_TIME_NONE, "\t-A Specify cross-section parameters. Choose between\n");
456-
GMT_Message (API, GMT_TIME_NONE, "\t -Aa<lon1/lat1/lon2/lat2/dip/p_width/dmin/dmax>[+f]\n");
457-
GMT_Message (API, GMT_TIME_NONE, "\t -Ab<lon1/lat1/strike/p_length/dip/p_width/dmin/dmax>[+f]\n");
458-
GMT_Message (API, GMT_TIME_NONE, "\t -Ac<x1/y1/x2/y2/dip/p_width/dmin/dmax>[+f]\n");
459-
GMT_Message (API, GMT_TIME_NONE, "\t -Ad<x1/y1/strike/p_length/dip/p_width/dmin/max>[+f]\n");
460-
GMT_Message (API, GMT_TIME_NONE, "\t Add +f to get the frame from the cross-section parameters.\n");
458+
GMT_Message (API, GMT_TIME_NONE, "\t -Aa<lon1>/<lat1>/<lon2>/<lat2>[+d<dip>][+w<width>][+z<dmin>/<dmax>][+r]\n");
459+
GMT_Message (API, GMT_TIME_NONE, "\t -Ab<lon1>/<lat1>/<strike>/<length>[+d<dip>][+w<width>][+z<dmin>/<dmax>][+r]\n");
460+
GMT_Message (API, GMT_TIME_NONE, "\t -Ac<x1>/<y1>/<x2>/<y2>[+d<dip>][+w<width>][+z<dmin>/<dmax>][+r]\n");
461+
GMT_Message (API, GMT_TIME_NONE, "\t -Ad<x1>/<y1>/<strike>/<length>[+d<dip>][+w<width>][+z<dmin>/<dmax>][+r]\n");
462+
GMT_Message (API, GMT_TIME_NONE, "\t For -Aa|b, <width>, <p_length>, <dmin> and <dmax> must be given in km.\n");
463+
GMT_Message (API, GMT_TIME_NONE, "\t Append +r to determine the plot domain (-R) from the cross-section parameters.\n");
461464
GMT_Message (API, GMT_TIME_NONE, "\t-C Use CPT to assign colors based on depth-value in 3rd column.\n");
462465
GMT_Message (API, GMT_TIME_NONE, "\t-S Select format type and symbol size.\n");
463466
GMT_Message (API, GMT_TIME_NONE, "\t Append the format code for your input file:\n");
@@ -509,11 +512,11 @@ static int usage (struct GMTAPI_CTRL *API, int level) {
509512
GMT_Message (API, GMT_TIME_NONE, "\t-N Do Not skip/clip symbols that fall outside map border [Default will ignore those outside].\n");
510513
GMT_Option (API, "O,P");
511514
GMT_Message (API, GMT_TIME_NONE, "\t-Q Do not print cross-section information to files\n");
512-
GMT_Message (API, GMT_TIME_NONE, "\t-Tn[/<pen>] draw nodal planes and circumference only to provide a transparent beach ball\n");
515+
GMT_Message (API, GMT_TIME_NONE, "\t-T<n>[/<pen>] draw nodal planes and circumference only to provide a transparent beach ball\n");
513516
GMT_Message (API, GMT_TIME_NONE, "\t using the current pen (see -W) or sets pen attribute.\n");
514-
GMT_Message (API, GMT_TIME_NONE, "\t n = 1 the only first nodal plane is plotted.\n");
515-
GMT_Message (API, GMT_TIME_NONE, "\t n = 2 the only second nodal plane is plotted.\n");
516-
GMT_Message (API, GMT_TIME_NONE, "\t n = 0 both nodal planes are plotted.\n");
517+
GMT_Message (API, GMT_TIME_NONE, "\t <n> = 1 the only first nodal plane is plotted.\n");
518+
GMT_Message (API, GMT_TIME_NONE, "\t <n> = 2 the only second nodal plane is plotted.\n");
519+
GMT_Message (API, GMT_TIME_NONE, "\t <n> = 0 both nodal planes are plotted.\n");
517520
GMT_Message (API, GMT_TIME_NONE, "\t If moment tensor is required, nodal planes overlay moment tensor.\n");
518521
GMT_Option (API, "U,V");
519522
GMT_Message (API, GMT_TIME_NONE, "\t-W Set pen attributes [%s]\n", gmt_putpen (API->GMT, &API->GMT->current.setting.map_default_pen));
@@ -522,6 +525,26 @@ static int usage (struct GMTAPI_CTRL *API, int level) {
522525
return (GMT_MODULE_USAGE);
523526
}
524527

528+
GMT_LOCAL unsigned int pscoupe_parse_old_A (struct GMT_CTRL *GMT, struct PSCOUPE_CTRL *Ctrl, char *arg) {
529+
int n;
530+
char *p = NULL;
531+
if ((p = strstr (arg, "+f"))) { /* Get the frame from the cross-section parameters */
532+
Ctrl->A.frame = true;
533+
p[0] = '\0'; /* Chop off modifier */
534+
}
535+
else if (arg[strlen(arg)-1] == 'f') /* Very deprecated GMT3-4 syntax */
536+
Ctrl->A.frame = true;
537+
if (Ctrl->A.proj_type == 'a' || Ctrl->A.proj_type == 'c') {
538+
n = sscanf (&arg[1], "%lf/%lf/%lf/%lf/%lf/%lf/%lf/%lf",
539+
&Ctrl->A.lon1, &Ctrl->A.lat1, &Ctrl->A.lon2, &Ctrl->A.lat2, &Ctrl->A.PREF.dip, &Ctrl->A.p_width, &Ctrl->A.dmin, &Ctrl->A.dmax);
540+
}
541+
else {
542+
n = sscanf (&arg[1], "%lf/%lf/%lf/%lf/%lf/%lf/%lf/%lf",
543+
&Ctrl->A.lon1, &Ctrl->A.lat1, &Ctrl->A.PREF.str, &Ctrl->A.p_length, &Ctrl->A.PREF.dip, &Ctrl->A.p_width, &Ctrl->A.dmin, &Ctrl->A.dmax);
544+
}
545+
return (n != 8) ? 1 : GMT_NOERROR;
546+
}
547+
525548
static int parse (struct GMT_CTRL *GMT, struct PSCOUPE_CTRL *Ctrl, struct GMT_OPTION *options) {
526549
/* This parses the options provided to pscoupe and sets parameters in Ctrl.
527550
* Note Ctrl has already been initialized and non-zero default values set.
@@ -531,7 +554,7 @@ static int parse (struct GMT_CTRL *GMT, struct PSCOUPE_CTRL *Ctrl, struct GMT_OP
531554
*/
532555

533556
unsigned int n_errors = 0;
534-
char txt[GMT_LEN256] = {""}, txt_b[GMT_LEN256] = {""}, txt_c[GMT_LEN256] = {""}, *p = NULL;
557+
char txt_a[GMT_LEN256] = {""}, txt_b[GMT_LEN256] = {""}, txt_c[GMT_LEN256] = {""}, txt_d[GMT_LEN256] = {""}, *p = NULL;
535558
struct GMT_OPTION *opt = NULL;
536559
double lon1, lat1, lon2, lat2;
537560

@@ -548,38 +571,75 @@ static int parse (struct GMT_CTRL *GMT, struct PSCOUPE_CTRL *Ctrl, struct GMT_OP
548571
case 'A': /* Cross-section definition */
549572
Ctrl->A.active = true;
550573
Ctrl->A.proj_type = opt->arg[0];
551-
if ((p = strstr (opt->arg, "+f"))) { /* Get the frame from the cross-section parameters */
552-
Ctrl->A.frame = true;
553-
p[0] = '\0'; /* Chop off modifier */
574+
if (strstr (opt->arg, "+f") || gmt_count_char (GMT, opt->arg, '/') == 7) /* Old deprecated syntax */
575+
n_errors += pscoupe_parse_old_A (GMT, Ctrl, opt->arg);
576+
else { /* New, modifier-equipped syntax */
577+
if ((p = gmt_first_modifier (GMT, opt->arg, "drwz"))) { /* Process any modifiers */
578+
if (gmt_get_modifier (p, 'd', txt_a))
579+
Ctrl->A.PREF.dip = atof (txt_a);
580+
if (gmt_get_modifier (p, 'r', txt_a))
581+
Ctrl->A.frame = true;
582+
if (gmt_get_modifier (p, 'w', txt_a))
583+
Ctrl->A.p_width = atof (txt_a);
584+
if (gmt_get_modifier (p, 'z', txt_a))
585+
sscanf (txt_a, "%lf/%lf", &Ctrl->A.dmin, &Ctrl->A.dmax);
586+
p[0] = '\0'; /* Chop off modifiers */
587+
}
588+
/* Process the first 4 args */
589+
if (sscanf (&opt->arg[1], "%[^/]/%[^/]/%[^/]/%s", txt_a, txt_b, txt_c, txt_d) != 4) {
590+
GMT_Report (GMT->parent, GMT_MSG_ERROR, "-A requires 4 arguments before modifiers.\n");
591+
n_errors++;
592+
}
593+
switch (Ctrl->A.proj_type) {
594+
case 'a':
595+
n_errors += gmt_verify_expectations (GMT, GMT_IS_LON, gmt_scanf (GMT, txt_a, GMT_IS_LON, &Ctrl->A.lon1), txt_a);
596+
n_errors += gmt_verify_expectations (GMT, GMT_IS_LAT, gmt_scanf (GMT, txt_b, GMT_IS_LAT, &Ctrl->A.lat1), txt_b);
597+
n_errors += gmt_verify_expectations (GMT, GMT_IS_LON, gmt_scanf (GMT, txt_c, GMT_IS_LON, &Ctrl->A.lon2), txt_c);
598+
n_errors += gmt_verify_expectations (GMT, GMT_IS_LAT, gmt_scanf (GMT, txt_d, GMT_IS_LAT, &Ctrl->A.lat2), txt_d);
599+
break;
600+
case 'b':
601+
n_errors += gmt_verify_expectations (GMT, GMT_IS_LON, gmt_scanf (GMT, txt_a, GMT_IS_LON, &Ctrl->A.lon1), txt_a);
602+
n_errors += gmt_verify_expectations (GMT, GMT_IS_LAT, gmt_scanf (GMT, txt_b, GMT_IS_LAT, &Ctrl->A.lat1), txt_b);
603+
Ctrl->A.PREF.str = atof (txt_c);
604+
Ctrl->A.p_length = atof (txt_d);
605+
case 'c':
606+
n_errors += gmt_verify_expectations (GMT, GMT_IS_FLOAT, gmt_scanf (GMT, txt_a, GMT_IS_FLOAT, &Ctrl->A.lon1), txt_a);
607+
n_errors += gmt_verify_expectations (GMT, GMT_IS_FLOAT, gmt_scanf (GMT, txt_b, GMT_IS_FLOAT, &Ctrl->A.lat1), txt_b);
608+
n_errors += gmt_verify_expectations (GMT, GMT_IS_FLOAT, gmt_scanf (GMT, txt_c, GMT_IS_FLOAT, &Ctrl->A.lon2), txt_c);
609+
n_errors += gmt_verify_expectations (GMT, GMT_IS_FLOAT, gmt_scanf (GMT, txt_d, GMT_IS_FLOAT, &Ctrl->A.lat2), txt_d);
610+
break;
611+
case 'd':
612+
n_errors += gmt_verify_expectations (GMT, GMT_IS_LON, gmt_scanf (GMT, txt_a, GMT_IS_LON, &Ctrl->A.lon1), txt_a);
613+
n_errors += gmt_verify_expectations (GMT, GMT_IS_LAT, gmt_scanf (GMT, txt_b, GMT_IS_LAT, &Ctrl->A.lat1), txt_b);
614+
Ctrl->A.PREF.str = atof (txt_c);
615+
Ctrl->A.p_length = atof (txt_d);
616+
default:
617+
GMT_Report (GMT->parent, GMT_MSG_ERROR, "Option -A: Unrecognized mode %c.\n", Ctrl->A.proj_type);
618+
n_errors++;
619+
break;
620+
}
554621
}
555-
else if (opt->arg[strlen(opt->arg)-1] == 'f') Ctrl->A.frame = true; /* Deprecated syntax */
556622
if (Ctrl->A.proj_type == 'a' || Ctrl->A.proj_type == 'c') {
557-
sscanf (&opt->arg[1], "%lf/%lf/%lf/%lf/%lf/%lf/%lf/%lf",
558-
&lon1, &lat1, &lon2, &lat2, &Ctrl->A.PREF.dip, &Ctrl->A.p_width, &Ctrl->A.dmin, &Ctrl->A.dmax);
559-
pscoupe_distaz (lat1, lon1, lat2, lon2, &Ctrl->A.p_length, &Ctrl->A.PREF.str, Ctrl->A.proj_type == 'a' ? COORD_DEG : COORD_KM);
623+
pscoupe_distaz (Ctrl->A.lat1, Ctrl->A.lon1, Ctrl->A.lat2, Ctrl->A.lon2, &Ctrl->A.p_length, &Ctrl->A.PREF.str, Ctrl->A.proj_type == 'a' ? COORD_DEG : COORD_KM);
560624
sprintf (Ctrl->A.newfile, "A%c%.1f_%.1f_%.1f_%.1f_%.0f_%.0f_%.0f_%.0f",
561-
Ctrl->A.proj_type, lon1, lat1, lon2, lat2, Ctrl->A.PREF.dip, Ctrl->A.p_width, Ctrl->A.dmin, Ctrl->A.dmax);
625+
Ctrl->A.proj_type, Ctrl->A.lon1, Ctrl->A.lat1, Ctrl->A.lon2, Ctrl->A.lat2, Ctrl->A.PREF.dip, Ctrl->A.p_width, Ctrl->A.dmin, Ctrl->A.dmax);
562626
sprintf (Ctrl->A.extfile, "A%c%.1f_%.1f_%.1f_%.1f_%.0f_%.0f_%.0f_%.0f_map",
563-
Ctrl->A.proj_type, lon1, lat1, lon2, lat2, Ctrl->A.PREF.dip, Ctrl->A.p_width, Ctrl->A.dmin, Ctrl->A.dmax);
627+
Ctrl->A.proj_type, Ctrl->A.lon1, Ctrl->A.lat1, Ctrl->A.lon2, Ctrl->A.lat2, Ctrl->A.PREF.dip, Ctrl->A.p_width, Ctrl->A.dmin, Ctrl->A.dmax);
564628
}
565629
else {
566-
sscanf (&opt->arg[1], "%lf/%lf/%lf/%lf/%lf/%lf/%lf/%lf",
567-
&lon1, &lat1, &Ctrl->A.PREF.str, &Ctrl->A.p_length, &Ctrl->A.PREF.dip, &Ctrl->A.p_width, &Ctrl->A.dmin, &Ctrl->A.dmax);
568630
sprintf (Ctrl->A.newfile, "A%c%.1f_%.1f_%.0f_%.0f_%.0f_%.0f_%.0f_%.0f",
569-
Ctrl->A.proj_type, lon1, lat1, Ctrl->A.PREF.str, Ctrl->A.p_length, Ctrl->A.PREF.dip, Ctrl->A.p_width, Ctrl->A.dmin, Ctrl->A.dmax);
631+
Ctrl->A.proj_type, Ctrl->A.lon1, Ctrl->A.lat1, Ctrl->A.PREF.str, Ctrl->A.p_length, Ctrl->A.PREF.dip, Ctrl->A.p_width, Ctrl->A.dmin, Ctrl->A.dmax);
570632
sprintf (Ctrl->A.extfile, "A%c%.1f_%.1f_%.0f_%.0f_%.0f_%.0f_%.0f_%.0f_map",
571-
Ctrl->A.proj_type, lon1, lat1, Ctrl->A.PREF.str, Ctrl->A.p_length, Ctrl->A.PREF.dip, Ctrl->A.p_width, Ctrl->A.dmin, Ctrl->A.dmax);
633+
Ctrl->A.proj_type, Ctrl->A.lon1, Ctrl->A.lat1, Ctrl->A.PREF.str, Ctrl->A.p_length, Ctrl->A.PREF.dip, Ctrl->A.p_width, Ctrl->A.dmin, Ctrl->A.dmax);
572634
}
573-
Ctrl->A.PREF.rake = 0.;
574635
if (Ctrl->A.proj_type == 'a' || Ctrl->A.proj_type == 'b')
575-
Ctrl->A.fuseau = pscoupe_gutm (lon1, lat1, &Ctrl->A.xlonref, &Ctrl->A.ylatref, 0);
636+
Ctrl->A.fuseau = pscoupe_gutm (Ctrl->A.lon1, Ctrl->A.lat1, &Ctrl->A.xlonref, &Ctrl->A.ylatref, 0);
576637
else {
577638
Ctrl->A.fuseau = -1;
578-
Ctrl->A.xlonref = lon1;
579-
Ctrl->A.ylatref = lat1;
639+
Ctrl->A.xlonref = Ctrl->A.lon1;
640+
Ctrl->A.ylatref = Ctrl->A.lat1;
580641
}
581642
Ctrl->A.polygon = true;
582-
if (p) p[0] = '+'; /* Restore modifier */
583643
break;
584644

585645
case 'Z': /* Backwards compatibility */
@@ -608,9 +668,9 @@ static int parse (struct GMT_CTRL *GMT, struct PSCOUPE_CTRL *Ctrl, struct GMT_OP
608668
switch (opt->arg[0]) {
609669
case 'a': /* plot axis */
610670
Ctrl->A2.active = true;
611-
strncpy (txt, &opt->arg[1], GMT_LEN256-1);
612-
if ((p = strchr (txt, '/')) != NULL) p[0] = '\0';
613-
if (txt[0]) Ctrl->A2.size = gmt_M_to_inch (GMT, txt);
671+
strncpy (txt_a, &opt->arg[1], GMT_LEN256-1);
672+
if ((p = strchr (txt_a, '/')) != NULL) p[0] = '\0';
673+
if (txt_a[0]) Ctrl->A2.size = gmt_M_to_inch (GMT, txt_a);
614674
if (p) {
615675
p++;
616676
switch (strlen (p)) {
@@ -686,9 +746,9 @@ static int parse (struct GMT_CTRL *GMT, struct PSCOUPE_CTRL *Ctrl, struct GMT_OP
686746
Ctrl->S.justify = PSL_BC;
687747
opt->arg[strlen(opt->arg)-1] = '\0';
688748
}
689-
txt[0] = txt_b[0] = txt_c[0] = '\0';
690-
sscanf (&opt->arg[2], "%[^/]/%[^/]/%s", txt, txt_b, txt_c);
691-
if (txt[0]) Ctrl->S.scale = gmt_M_to_inch (GMT, txt);
749+
txt_a[0] = txt_b[0] = txt_c[0] = '\0';
750+
sscanf (&opt->arg[2], "%[^/]/%[^/]/%s", txt_a, txt_b, txt_c);
751+
if (txt_a[0]) Ctrl->S.scale = gmt_M_to_inch (GMT, txt_a);
692752
if (txt_b[0]) Ctrl->S.font.size = gmt_convert_units (GMT, txt_b, GMT_PT, GMT_PT);
693753
if (txt_c[0]) Ctrl->S.offset[1] = gmt_convert_units (GMT, txt_c, GMT_PT, GMT_INCH);
694754
if (Ctrl->S.font.size < 0.0) Ctrl->S.no_label = true;
@@ -824,9 +884,9 @@ static int parse (struct GMT_CTRL *GMT, struct PSCOUPE_CTRL *Ctrl, struct GMT_OP
824884
Ctrl->S.justify = PSL_BC;
825885
opt->arg[strlen(opt->arg)-1] = '\0';
826886
}
827-
txt[0] = txt_b[0] = txt_c[0] = '\0';
828-
sscanf (&opt->arg[1], "%[^/]/%[^/]/%s", txt, txt_b, txt_c);
829-
if (txt[0]) Ctrl->S.scale = gmt_M_to_inch (GMT, txt);
887+
txt_a[0] = txt_b[0] = txt_c[0] = '\0';
888+
sscanf (&opt->arg[1], "%[^/]/%[^/]/%s", txt_a, txt_b, txt_c);
889+
if (txt_a[0]) Ctrl->S.scale = gmt_M_to_inch (GMT, txt_a);
830890
if (txt_b[0]) Ctrl->S.font.size = gmt_convert_units (GMT, txt_b, GMT_PT, GMT_PT);
831891
if (txt_c[0]) Ctrl->S.offset[1] = gmt_convert_units (GMT, txt_c, GMT_PT, GMT_INCH);
832892
if (Ctrl->S.font.size < 0.0) Ctrl->S.no_label = true;

0 commit comments

Comments
 (0)