Skip to content

Commit f08b679

Browse files
authored
Add -o to histogram and rose (#5980)
* Add -o to histogram and rose Both of these plotting modules have an inquirey mode (-I) were they report information that can be very helpful if -o is available. This PR adds -o to both modules. * Update pshistogram.rst * add mention of -o under -I. * Oops
1 parent 1278e4e commit f08b679

File tree

6 files changed

+23
-12
lines changed

6 files changed

+23
-12
lines changed

doc/rst/source/histogram.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Synopsis
4141
[ |SYN_OPT-h| ]
4242
[ |SYN_OPT-i| ]
4343
[ |SYN_OPT-l| ]
44+
[ |SYN_OPT-o| ]
4445
[ |SYN_OPT-p| ]
4546
[ |SYN_OPT-qi| ]
4647
[ |SYN_OPT-s| ]
@@ -138,7 +139,8 @@ Optional Arguments
138139
Inquire about min/max x and y after binning. The *xmin xmax ymin
139140
ymax* is output; no plotting is done. Append **o** to output an
140141
ASCII table of the resulting x,y data instead. Upper case **O** will
141-
output all x,y bin data even when y == 0.
142+
output all x,y bin data even when y == 0. **Note**: You may use **-o**
143+
to select a subset from this record.
142144

143145
.. _-Jz:
144146

@@ -243,6 +245,8 @@ Optional Arguments
243245
.. |Add_-l| replace:: Symbol is a rectangle with width-to-height ratio of 3:2. Use **+S**\ *width*\ [/*height*] to overwrite with custom width and optionally height.
244246
.. include:: explain_-l.rst_
245247

248+
.. include:: explain_-ocols.rst_
249+
246250
.. |Add_perspective| unicode:: 0x20 .. just an invisible code
247251
.. include:: explain_perspective.rst_
248252

doc/rst/source/pshistogram.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ Synopsis
1212

1313
.. include:: common_SYN_OPTs.rst_
1414

15-
**gmt pshistogram** [ *table* ] |-J|\ **x**\|\ **X**\ *parameters*
15+
**gmt pshistogram** [ *table* ]
16+
|-J|\ **x**\|\ **X**\ *parameters*
1617
|-T|\ [*min/max*\ /]\ *inc*\ [**+i**\|\ **n**] \|\ |-T|\ *file*\|\ *list*
1718
[ |-A| ]
1819
[ |SYN_OPT-B| ]
@@ -40,6 +41,7 @@ Synopsis
4041
[ |SYN_OPT-f| ]
4142
[ |SYN_OPT-h| ]
4243
[ |SYN_OPT-i| ]
44+
[ |SYN_OPT-o| ]
4345
[ |SYN_OPT-p| ]
4446
[ |SYN_OPT-qi| ]
4547
[ |SYN_OPT-t| ]

doc/rst/source/psrose.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Synopsis
3939
[ |SYN_OPT-e| ]
4040
[ |SYN_OPT-h| ]
4141
[ |SYN_OPT-i| ]
42+
[ |SYN_OPT-o| ]
4243
[ |SYN_OPT-p| ]
4344
[ |SYN_OPT-qi| ]
4445
[ |SYN_OPT-t| ]

doc/rst/source/rose.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ Synopsis
1212

1313
.. include:: common_SYN_OPTs.rst_
1414

15-
**gmt rose** [ *table* ] [ |-A|\ *sector_width*\ [**+r**] ]
15+
**gmt rose** [ *table* ]
16+
[ |-A|\ *sector_width*\ [**+r**] ]
1617
[ |SYN_OPT-B| ]
1718
[ |-C|\ *cpt* ]
1819
[ |-D| ]
@@ -38,6 +39,7 @@ Synopsis
3839
[ |SYN_OPT-e| ]
3940
[ |SYN_OPT-h| ]
4041
[ |SYN_OPT-i| ]
42+
[ |SYN_OPT-o| ]
4143
[ |SYN_OPT-p| ]
4244
[ |SYN_OPT-qi| ]
4345
[ |SYN_OPT-s| ]
@@ -126,7 +128,8 @@ Optional Arguments
126128
Inquire. Computes statistics needed to specify a useful **-R**. No
127129
plot is generated. The following statistics are written to stdout:
128130
*n*, *mean az*, *mean r*, *mean resultant length*, *max bin sum*,
129-
*scaled mean*, and *linear length sum*.
131+
*scaled mean*, and *linear length sum*. **Note**: You may use **-o**
132+
to select a subset from this record.
130133

131134
.. _-J:
132135

@@ -246,6 +249,7 @@ Optional Arguments
246249
.. include:: explain_-h.rst_
247250

248251
.. include:: explain_-icols.rst_
252+
.. include:: explain_-ocols.rst_
249253

250254
.. |Add_perspective| unicode:: 0x20 .. just an invisible code
251255
.. include:: explain_perspective.rst_

src/pshistogram.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#define THIS_MODULE_PURPOSE "Calculate and plot histograms"
3131
#define THIS_MODULE_KEYS "<D{,CC(,>X},>D),>DI"
3232
#define THIS_MODULE_NEEDS "JR"
33-
#define THIS_MODULE_OPTIONS "->BJKOPRUVXYbdefhilpqstwxy" GMT_OPT("c")
33+
#define THIS_MODULE_OPTIONS "->BJKOPRUVXYbdefhilopqstwxy" GMT_OPT("c")
3434

3535
/* Note: The NEEDS must be JR. Although pshistogram can create a region from data, it
3636
* does so indirectly by building the histogram and setting the ymin/ymax that way, NOT by
@@ -564,9 +564,9 @@ static int usage (struct GMTAPI_CTRL *API, int level) {
564564
if (level == GMT_MODULE_PURPOSE) return (GMT_NOERROR);
565565
GMT_Usage (API, 0, "usage: %s [<table>] %s -T[<min>/<max>/]<inc>[+i|n] [-A] [%s] [-C<cpt>[+b]] [-D[+b][+f<font>][+o<off>][+r]] "
566566
"[-E<width>[+o<offset>]] [-F] [-G<fill>] [-I[o|O]] %s[-Ll|h|b] [-N[<mode>][+p<pen>]] %s%s[-Q[r]] [%s] [-S] [%s] [%s] "
567-
"[-W<pen>] [%s] [%s] [-Z[<mode>][+w]] %s[%s] [%s] [%s] [%s] [%s] [%s] [%s] [%s] [%s] [%s] [%s] [%s]\n",
567+
"[-W<pen>] [%s] [%s] [-Z[<mode>][+w]] %s[%s] [%s] [%s] [%s] [%s] [%s] [%s] [%s] [%s] [%s] [%s] [%s] [%s]\n",
568568
name, GMT_Jx_OPT, GMT_B_OPT, API->K_OPT, API->O_OPT, API->P_OPT, GMT_Rx_OPT, GMT_U_OPT, GMT_V_OPT, GMT_X_OPT, GMT_Y_OPT,
569-
API->c_OPT, GMT_bi_OPT, GMT_di_OPT, GMT_e_OPT, GMT_f_OPT, GMT_h_OPT, GMT_i_OPT, GMT_p_OPT, GMT_qi_OPT, GMT_s_OPT,
569+
API->c_OPT, GMT_bi_OPT, GMT_di_OPT, GMT_e_OPT, GMT_f_OPT, GMT_h_OPT, GMT_i_OPT, GMT_o_OPT, GMT_p_OPT, GMT_qi_OPT, GMT_s_OPT,
570570
GMT_t_OPT, GMT_w_OPT, GMT_PAR_OPT);
571571

572572
if (level == GMT_SYNOPSIS) return (GMT_MODULE_SYNOPSIS);
@@ -631,7 +631,7 @@ static int usage (struct GMTAPI_CTRL *API, int level) {
631631
GMT_Usage (API, 3, "4: Log10 (1+counts).");
632632
GMT_Usage (API, 3, "5: Log10 (1+frequency percent).");
633633
GMT_Usage (API, -2, "Append +w to sum bin weights in 2nd column rather than counts.");
634-
GMT_Option (API, "bi2,c,di,e,f,h,i,l,p,qi,s,t,w,.");
634+
GMT_Option (API, "bi2,c,di,e,f,h,i,l,o,p,qi,s,t,w,.");
635635

636636
return (GMT_MODULE_USAGE);
637637
}

src/psrose.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
#define THIS_MODULE_PURPOSE "Plot a polar histogram (rose, sector, windrose diagrams)"
5050
#define THIS_MODULE_KEYS "<D{,CC(,ED(,>X},>D),>DI,ID)"
5151
#define THIS_MODULE_NEEDS "JR"
52-
#define THIS_MODULE_OPTIONS "-:>BJKOPRUVXYbdehipqstwxy" GMT_OPT("c")
52+
#define THIS_MODULE_OPTIONS "-:>BJKOPRUVXYbdehiopqstwxy" GMT_OPT("c")
5353

5454
struct PSROSE_CTRL { /* All control options for this program (except common args) */
5555
/* active is true if the option has been activated */
@@ -163,9 +163,9 @@ static int usage (struct GMTAPI_CTRL *API, int level) {
163163
GMT_Usage (API, 0, "usage: %s [<table>] [-A<sector_angle>[+r]] [%s] [-C<cpt>] [-D] [-E[m|[+w]<modefile>]] [-F] [-G<fill>] "
164164
"[-I] [-JX<diameter>] %s[-L[<wlab>,<elab>,<slab>,<nlab>]] [-M[<size>][<modifiers>]] [-N<mode>[+p<pen>]] %s%s[-Q<alpha>] "
165165
"[-R<r0>/<r1>/<theta0>/<theta1>] [-S[+a]] [-T] [%s] [%s] [-W[v]<pen>] [%s] [%s] [-Zu|<scale>] [%s] %s[%s] [%s] [%s] "
166-
"[%s] [%s] [%s] [%s] [%s] [%s] [%s] [%s]\n",
166+
"[%s] [%s] [%s] [%s] [%s] [%s] [%s] [%s] [%s]\n",
167167
name, GMT_B_OPT, API->K_OPT, API->O_OPT, API->P_OPT, GMT_U_OPT, GMT_V_OPT, GMT_X_OPT, GMT_Y_OPT, GMT_bi_OPT, API->c_OPT,
168-
GMT_di_OPT, GMT_e_OPT, GMT_h_OPT, GMT_i_OPT, GMT_p_OPT, GMT_qi_OPT, GMT_s_OPT, GMT_t_OPT, GMT_w_OPT, GMT_colon_OPT, GMT_PAR_OPT);
168+
GMT_di_OPT, GMT_e_OPT, GMT_h_OPT, GMT_i_OPT, GMT_o_OPT, GMT_p_OPT, GMT_qi_OPT, GMT_s_OPT, GMT_t_OPT, GMT_w_OPT, GMT_colon_OPT, GMT_PAR_OPT);
169169

170170
if (level == GMT_SYNOPSIS) return (GMT_MODULE_SYNOPSIS);
171171

@@ -224,7 +224,7 @@ static int usage (struct GMTAPI_CTRL *API, int level) {
224224
GMT_Usage (API, 1, "\n-Zu|<scale>");
225225
GMT_Usage (API, -2, "Multiply the radii by <scale> before plotting; or use -Zu to set input radii to 1.");
226226
GMT_Usage (API, 1, "\n-: Expect (azimuth,radius) input rather than (radius,azimuth) [%s].", choice[API->GMT->current.setting.io_lonlat_toggle[GMT_IN]]);
227-
GMT_Option (API, "bi2,c,di,e,h,i,p,qi,s,t,w,.");
227+
GMT_Option (API, "bi2,c,di,e,h,i,o,p,qi,s,t,w,.");
228228

229229
return (GMT_MODULE_USAGE);
230230
}

0 commit comments

Comments
 (0)