diff -uNr GMT3.1/grdbulb.l GMT3.1_bulb_patch/grdbulb.l --- GMT3.1/grdbulb.l Thu Jan 1 09:00:00 1970 +++ GMT3.1_bulb_patch/grdbulb.l Thu Feb 13 19:14:21 2003 @@ -0,0 +1,173 @@ +.TH GRDBULB l "12 Jun 1999" +.SH NAME +grdbulb \- Plot wind bulbs from grdfiles +.SH SYNOPSIS +\fBgrdbulb\fP \fIcompx.grd\fP \fIcompy.grd\fP \fB\-J\fP\fIparameters\fP [ \fB\-A\fP ] +[ \fB\-B\fP\fItickinfo\fP ] [ \fB\-E\fP ] +[ \fB\-I\fP\fIx_inc\fP[\fBm|c\fP][/\fIy_inc\fP[\fBm|c\fP]] ] [ \fB\-K\fP ] [ \fB\-N\fP ] [ \fB\-O\fP ] [ \fB\-P\fP ] +[ \fB\-Q\fP\fIparameters\fP ] [ \fB\-R\fP\fIwest/east/south/north\fP[\fBr\fP] ] [ \fB\-S\fP\fIscale\fP ] +[ \fB\-T\fP ] [ \fB\-U\fP[\fI/dx/dy/\fP][\fIlabel\fP] ] [ \fB\-V\fP ] [ \fB\-W\fP\fIcontourpen\fP ] [ \fB\-X\fP\fIx-shift\fP ] +[ \fB\-Y\fP\fIy-shift\fP ] [ \fB\-Z\fP\fIzlevel\fP ] [ \fB\-c\fP\fIcopies\fP ] +.SH DESCRIPTION +\fBgrdbulb\fP reads two 2-D gridded files which represents the x- and y-components of a vector field and +produces a wind bulb plot by +drawing bulbs with orientation and length according to the information in the files. Alternatively, +polar coordinate components may be used (r, theta). +\fBgrdbulb\fP is basically a short-hand for using 2 calls to \fBgrd2xyz\fP and pasting the output through +\fBpsxy \-Sw\fP. +.TP +\fIcompx.grd\fP +Contains the x-component of the vector field. +.TP +\fIcompy.grd\fP +Contains the y-component of the vector field. +.TP +.B \-J +Selects the map projection. Scale is inch/degree, 1:xxxxx, or width in inch (upper case modifier). +.br +.sp +\fBCYLINDRICAL PROJECTIONS:\fP +.br +.sp +\fB\-Jc\fP\fIlon0/lat0/scale\fP (Cassini) +.br +\fB\-Jj\fP\fIlon0/scale\fP (Miller) +.br +\fB\-Jm\fP\fIscale\fP (Mercator - Greenwich and Equator as origin) +.br +\fB\-Jm\fP\fIlon0/lat0/scale\fP (Mercator - Give meridian and standard parallel) +.br +\fB\-Joa\fP\fIlon0/lat0/azimuth/scale\fP (Oblique Mercator - point and azimuth) +.br +\fB\-Job\fP\fIlon0/lat0/lon1/lat1/scale\fP (Oblique Mercator - two points) +.br +\fB\-Joc\fP\fIlon0/lat0/lonp/latp/scale\fP (Oblique Mercator - point and pole) +.br +\fB\-Jq\fP\fIlon0/scale\fP (Equidistant Cylindrical Projection (Plate Carree)) +.br +\fB\-Jt\fP\fIlon0/scale\fP (TM - Transverse Mercator) +.br +\fB\-Ju\fP\fIzone/scale\fP (UTM - Universal Transverse Mercator) +.br +\fB\-Jy\fP\fIlon0/lats/scale\fP (Basic Cylindrical Projection) +.br +.sp +\fBAZIMUTHAL PROJECTIONS:\fP +.br +.sp +\fB\-Ja\fP\fIlon0/lat0/scale\fP (Lambert). +.br +\fB\-Je\fP\fIlon0/lat0/scale\fP (Equidistant). +.br +\fB\-Jf\fP\fIlon0/lat0/horizon/scale\fP (Gnomonic). +.br +\fB\-Jg\fP\fIlon0/lat0/scale\fP (Orthographic). +.br +\fB\-Js\fP\fIlon0/lat0/scale\fP (General Stereographic) +.br +.sp +\fBCONIC PROJECTIONS:\fP +.br +.sp +\fB\-Jb\fP\fIlon0/lat0/lat1/lat2/scale\fP (Albers) +.br +\fB\-Jl\fP\fIlon0/lat0/lat1/lat2/scale\fP (Lambert) +.br +.sp +\fBMISCELLANEOUS PROJECTIONS:\fP +.br +.sp +\fB\-Jh\fP\fIlon0/scale\fP (Hammer) +.br +\fB\-Ji\fP\fIlon0/scale\fP (Sinusoidal) +.br +\fB\-Jk\fP\fIlon0/scale\fP (Eckert VI) +.br +\fB\-Jn\fP\fIlon0/scale\fP (Robinson) +.br +\fB\-Jr\fP\fIlon0/scale\fP (Winkel Tripel) +.br +\fB\-Jw\fP\fIlon0/scale\fP (Mollweide) +.br +.sp +\fBNON-GEOGRAPHICAL PROJECTIONS:\fP +.br +.sp +\fB\-Jp\fP\fIscale\fP (Linear projection for polar (theta,r) coordinates) +.br +\fB\-Jx\fP\fIx-scale\fP[\fBl|p\fP\fIpow\fP][\fI/y-scale\fP[\fBl|p\fP\fIpow\fP]] (Linear, log, and power scaling) +.br +More details can be found in the \fBpsbasemap\fP manpages. +.br +.SH OPTIONS +No space between the option flag and the associated arguments. +.TP +.B \-A +Means grdfiles have polar (r, theta) components instead of Cartesian (x, y). +.TP +.B \-B +Sets map boundary tickmark intervals. See \fBpsbasemap\fP for details. +.TP +.B \-E +Center vectors on grid nodes [Default draws from grid node]. +.TP +.B \-I +Only plot vectors at nodes every \fIx_inc, y_inc\fP apart (must be multiples of +original grid spacing). Append \fBm\fP for minutes or \fBc\fP for seconds. [Default plots every node]. +.TP +.B \-K +More \fIPostScript\fP code will be appended later [Default terminates the plot system]. +.TP +.B \-N +Do NOT clip vectors at map boundaries [Default will clip]. +.TP +.B \-O +Selects Overlay plot mode [Default initializes a new plot system]. +.TP +.B \-P +Selects Portrait plotting mode [\fBGMT\fP Default is Landscape, see gmtdefaults to change this]. +.TP +.B \-Q +Select bulb plot. Optionally, specify \fIparameters\fP which +are \fIbulbwidth/bulblength/bulbangle/bulbscale\fP (in inch) [Default is 0.4/1.0/120/5]. +.TP +.B \-R +\fIwest, east, south,\fP and \fInorth\fP specify the Region of interest. To specify boundaries +in degrees and minutes [and seconds], use the dd:mm[:ss] format. Append \fBr\fP if lower left and upper right +map coordinates are given instead of wesn. +Specify a subset of the grid. +.TP +.B \-S +Sets scale for vector length in data units per inch [1]. +.TP +.B \-T +Means azimuth should be converted to angles based on the selected map projection. +.TP +.B \-U +Draw Unix System time stamp on plot. User may specify where the lower left corner +of the stamp should fall on the page relative to lower left corner of plot in inch [Default is (-0.75,-0.75)]. Optionally, +append a label, or \fBc\fP (which will plot the command string.) +.TP +.B \-V +Selects verbose mode, which will send progress reports to stderr [Default runs "silently"]. +.TP +.B \-W +Set pen attributes used for vector outlines [Default: width = 1, color = 0/0/0, texture = solid]. +.TP +.B \-X \-Y +Shift origin of plot by (\fIx-shift,y-shift\fP) inch [Default is (1,1) for new plots, (0,0) for overlays]. +.TP +.B \-Z +Means the angles provided are azimuths rather than direction (requires \fB\-A\fP). +.TP +.B \-c +Specifies the number of plot copies. [Default is 1] +.SH EXAMPLES +Now preparing... +.br +.sp +grdbulb ... +.br +.sp +.SH SEE ALSO +gmt, grdcontour, grdvector, psxy diff -uNr GMT3.1/psxy.l GMT3.1_bulb_patch/psxy.l --- GMT3.1/psxy.l Thu Jan 1 09:00:00 1970 +++ GMT3.1_bulb_patch/psxy.l Thu Feb 13 19:24:09 2003 @@ -0,0 +1,290 @@ +.TH PSXY l "1 Nov 1998" +.SH NAME +psxy \- Plot lines, polygons, and symbols on maps +.SH SYNOPSIS +\fBpsxy\fP \fIfiles\fP \fB\-J\fP\fIparameters\fP \fB\-R\fP\fIwest/east/south/north\fP[\fBr\fP] +[ \fB\-A\fP ] [ \fB\-B\fP\fItickinfo\fP ] [ \fB\-C\fP\fIcptfile\fP ] [ \fB\-E\fP[\fBx\fP][\fBy\fP][\fIcap\fP][\fP/pen\fP] ] +[ \fB\-G\fP\fIfill\fP ] [ \fB\-H\fP[\fInrec\fP] ] [ \fB\-K\fP ] [ \fB\-L\fP ] +[ \fB\-N\fP ] [ \fB\-M\fP[\fIflag\fP] ] [ \fB\-O\fP ] [ \fB\-P\fP ] [ \fB\-S\fP[\fIsymbol\fP][\fIsize\fP] ] [ \fB\-U\fP[\fI/dx/dy/\fP][\fIlabel\fP] ] +[ \fB\-V\fP ] [ \fB\-W\fP[\fIpen\fP] ] +[ \fB\-X\fP\fIx-shift\fP ] [ \fB\-Y\fP\fIy-shift\fP ] [ \fB\-:\fP ] [ \fB\-c\fP\fIcopies\fP ] [ \fB\-bi\fP[\fBs\fP][\fIn\fP] ] +.SH DESCRIPTION +\fBpsxy\fP reads (x,y) pairs from \fIfiles\fP [or standard input] and +generates \fIPostScript\fP code that will plot lines, polygons, or symbols at those locations on a map. +If a symbol is selected and no symbol size given, then psxy will interpret the third column of the +input data as symbol size in inch. If no symbols are specified then the symbol code (see \fB\-S\fP below) +must be present as last column in the input. Multiple segment files may be plotted using the \fB\-M\fP option. +If \fB\-S\fP is not selected, a line connecting the data points will be drawn instead. To +explicitly close polygons, use \fB\-L\fP. Select a shade with \fB\-G\fP. If \fB\-G\fP is set, \fB\-W\fP +will control whether the polygon outline is drawn or not. If a symbol is selected, \fB\-G\fP and +\fB\-W\fP determines the fill color and outline/no outline, respectively. +The \fIPostScript\fP code is written to standard output. +.TP +\fIfiles\fP +List one or more file-names. If no files are given, \fBpsxy\fP will read standard input. +.TP +.B \-J +Selects the map projection. Scale is inch/degree, 1:xxxxx, or width in inch (upper case modifier). +.br +.sp +\fBCYLINDRICAL PROJECTIONS:\fP +.br +.sp +\fB\-Jc\fP\fIlon0/lat0/scale\fP (Cassini) +.br +\fB\-Jj\fP\fIlon0/scale\fP (Miller) +.br +\fB\-Jm\fP\fIscale\fP (Mercator - Greenwich and Equator as origin) +.br +\fB\-Jm\fP\fIlon0/lat0/scale\fP (Mercator - Give meridian and standard parallel) +.br +\fB\-Joa\fP\fIlon0/lat0/azimuth/scale\fP (Oblique Mercator - point and azimuth) +.br +\fB\-Job\fP\fIlon0/lat0/lon1/lat1/scale\fP (Oblique Mercator - two points) +.br +\fB\-Joc\fP\fIlon0/lat0/lonp/latp/scale\fP (Oblique Mercator - point and pole) +.br +\fB\-Jq\fP\fIlon0/scale\fP (Equidistant Cylindrical Projection (Plate Carree)) +.br +\fB\-Jt\fP\fIlon0/scale\fP (TM - Transverse Mercator) +.br +\fB\-Ju\fP\fIzone/scale\fP (UTM - Universal Transverse Mercator) +.br +\fB\-Jy\fP\fIlon0/lats/scale\fP (Basic Cylindrical Projection) +.br +.sp +\fBAZIMUTHAL PROJECTIONS:\fP +.br +.sp +\fB\-Ja\fP\fIlon0/lat0/scale\fP (Lambert). +.br +\fB\-Je\fP\fIlon0/lat0/scale\fP (Equidistant). +.br +\fB\-Jf\fP\fIlon0/lat0/horizon/scale\fP (Gnomonic). +.br +\fB\-Jg\fP\fIlon0/lat0/scale\fP (Orthographic). +.br +\fB\-Js\fP\fIlon0/lat0/scale\fP (General Stereographic) +.br +.sp +\fBCONIC PROJECTIONS:\fP +.br +.sp +\fB\-Jb\fP\fIlon0/lat0/lat1/lat2/scale\fP (Albers) +.br +\fB\-Jl\fP\fIlon0/lat0/lat1/lat2/scale\fP (Lambert) +.br +.sp +\fBMISCELLANEOUS PROJECTIONS:\fP +.br +.sp +\fB\-Jh\fP\fIlon0/scale\fP (Hammer) +.br +\fB\-Ji\fP\fIlon0/scale\fP (Sinusoidal) +.br +\fB\-Jk\fP\fIlon0/scale\fP (Eckert VI) +.br +\fB\-Jn\fP\fIlon0/scale\fP (Robinson) +.br +\fB\-Jr\fP\fIlon0/scale\fP (Winkel Tripel) +.br +\fB\-Jw\fP\fIlon0/scale\fP (Mollweide) +.br +.sp +\fBNON-GEOGRAPHICAL PROJECTIONS:\fP +.br +.sp +\fB\-Jp\fP\fIscale\fP (Linear projection for polar (theta,r) coordinates) +.br +\fB\-Jx\fP\fIx-scale\fP[\fBl|p\fP\fIpow\fP][\fI/y-scale\fP[\fBl|p\fP\fIpow\fP]] (Linear, log, and power scaling) +.br +More details can be found in the \fBpsbasemap\fP manpages. +.br +.TP +.B \-R +\fIwest, east, south,\fP and \fInorth\fP specify the Region of interest. To specify boundaries +in degrees and minutes [and seconds], use the dd:mm[:ss] format. Append \fBr\fP if lower left and upper right +map coordinates are given instead of wesn. +.SH OPTIONS +No space between the option flag and the associated arguments. +.TP +.B \-A +Suppress drawing line segments as great circle Arcs. [Default draws great circle arcs.] +.TP +.B \-B +Sets map boundary tickmark intervals. See \fBpsbasemap\fP for details. +.TP +.B \-C +Give a color palette file and let symbol color be determined by the z-value in the +third column. Must be used with \fB\-S\fP. If used, then additional fields are +shifted over by one column (optional size would be 4th rather than 3rd field, etc.). +.TP +.B \-E +Draw error bars. Append \fBx\fP and/or \fBy\fP to indicate which bars you want to draw. The x and/or +y errors must be stored in the columns after the (x,y) pair [or (x,y,size) triplet]. The +\fIcap\fP parameter indicates the length of the end-cap on the error bars in inch [0.1]. Pen +attributes for error bars may also be set. [Defaults: width = 1, color = 0/0/0, texture = solid]. +.TP +.B \-G +Select filling of polygons and symbols. +Append the shade (0\-255), color (r/g/b), or \fBp\fP|\fBp\fP\fIdpi\fP/\fIpattern\fP (polygons only) [Default is no fill]. +Note when \fB\-M\fP is chosen, \fIpsxy\fP will search for \fB\-G\fP and \fB\-W\fP strings in all the subheaders and let any found values over-ride the command line settings. +.TP +.B \-H +Input file(s) has Header record(s). Number of header records can be changed by editing +your \.gmtdefaults file. If used, \fBGMT\fP default is 1 header record. +.TP +.B \-K +More \fIPostScript\fP code will be appended later [Default terminates the plot system]. +.TP +.B \-L +Force closed polygons: connect the endpoints of the line-segment(s) and draw polygons. +.TP +.B \-M +Multiple segment file. Segments are separated by a record whose first character is \fIflag\fP. +[Default is '>']. +.TP +.B \-N +Do NOT skip symbols that fall outside map border [Default plots points inside border only]. +.TP +.B \-O +Selects Overlay plot mode [Default initializes a new plot system]. +.TP +.B \-P +Selects Portrait plotting mode [\fBGMT\fP Default is Landscape, see gmtdefaults to change this]. +.TP +.B \-S +Plot symbols. If present, \fIsize\fP is symbol size in inch. The uppercase symbols +\fBA, C, D, H, I, S, T\fP are normalized to have the same area given the same size information. +Choose between these symbol codes: +.TP +.B \-S +Read symbol code (see below) from last column in the input data. Cannot be used in +conjunction with \fB\-b\fP. +.TP +.B \-Sa +st\fBa\fPr. \fIsize\fP is radius of circumscribing circle. +.TP +.B \-Sb +\fBb\fPar extending from \fIbase\fP to y. \fIsize\fP is bar width. By default, +\fIbase\fP = 0. Append /\fIbase\fP to change this value. Append \fBu\fP if \fIsize\fP +is in x-units [Default is inch]. +.TP +.B \-Sc +\fBc\fPircle. \fIsize\fP is diameter of circle. +.TP +.B \-Sd +\fBd\fPiamond. \fIsize\fP is side of diamond. +.TP +.B \-Se +\fBe\fPllipse. Direction (in degrees counterclockwise from horizontal), major_axis (in inch), and minor_axis (in inch) must be found in columns 3, 4, and 5. +.TP +.B \-SE +Same as \fB\-Se\fP, except azimuth (in degrees east of north) should be given instead of direction. The azimuth will +be mapped into an angle based on the chosen map projection (\fB\-Se\fP leaves the directions +unchanged.) Furthermore, the axes lengths must be given in km instead of inch. +.TP +.B \-Sf +\fBf\fPault. Give distance gap between ticks and ticklength in inch. If gap is +negative, it is interpreted to mean number of ticks instead. Append \fBl\fP or \fBr\fP to draw tick on +the left or right side of line [Default is centered]. Upper case \fBL\fP or \fBR\fP draws a triangle +instead of line segment. +.TP +.B \-Sh +\fBh\fPexagon. Give side in inch. +.TP +.B \-Si +\fBi\fPnverted triangle. Give side in inch. +.TP +.B \-Sl +\fBl\fPetter or text string. Give size in inch, and append /\fIstring\fP after the size. Note that the size is only approximate; no individual scaling +is done for different characters. Remember to escape special characters like *. +.TP +.B \-Sp +\fBp\fPoint. No size needs to be specified (1 pixel is used). +.TP +.B \-Ss +\fBs\fPquare. Give side in inch. +.TP +.B \-St +\fBt\fPriangle. Give side in inch. +.TP +.B \-Sv +\fBv\fPector. Direction (in degrees counterclockwise from horizontal) and length (in inch) must be found in columns 3 and 4. \fIsize\fP, +if present, will be interpreted as arrowwidth/headlength/headwidth (in inch) [Default is 0.03/0.12/0.1 inch]. +By default arrow attributes remains invariant to the length +of the arrow. To have the size of the vector scale down with decreasing size, +append \fBn\fP\fPnorm\fP, where vectors shorter than \fInorm\fP will have their +attributes scaled by length/\fInorm\fP. +.TP +.B \-SV +Same as \fB\-Sv\fP, except azimuth (in degrees east of north) should be given instead of direction. The azimuth will +be mapped into an angle based on the chosen map projection (\fB\-Sv\fP leaves the directions +unchanged.) +.TP +.B \-Sw +\fBw\fPind bulb. Direction (in degrees conterclockwise from horizontal) and length must be found in columns 3 and 4. \fIsize\fP, +if present, will be interpreted as bulbwidth/bulblength/bulbangle/bulbscale [Default is 0.4/1.0/120/5 ]. +.TP +.B \-SW +Same as \fB\-Sw\fP, except azimuth (in degrees east of north) should be given instead of direction. The azimuth will +be mapped into an angle based on the chosen map projection (\fB\-Sw\fP leaves the directions +unchanged.) +.TP +.B \-Sx +cross. Give length in inch. +.TP +.B \-U +Draw Unix System time stamp on plot. User may specify where the lower left corner +of the stamp should fall on the page relative to lower left corner of plot in inch [Default is (-0.75,-0.75)]. Optionally, +append a label, or \fBc\fP (which will plot the command string.) +.TP +.B \-V +Selects verbose mode, which will send progress reports to stderr [Default runs "silently"]. +.TP +.B \-W +Set pen attributes. [Defaults: width = 1, color = 0/0/0, texture = solid]. +Implicitly draws the outline of symbols with selected pen. +.TP +.B \-X \-Y +Shift origin of plot by (\fIx-shift,y-shift\fP) inch [Default is (1,1) for new plots, (0,0) for overlays]. +.TP +.B \-: +Toggles between (longitude,latitude) and (latitude,longitude) input/output. [Default is (longitude,latitude)]. +.TP +.B \-c +Specifies the number of plot copies. [Default is 1] +.TP +.B \-bi +Selects binary input. Append \fBs\fP for single precision [Default is double]. +Append \fIn\fP for the number of columns in the binary file(s). +[Default is the required number of columns given the chosen settings]. +.SH EXAMPLES +To plot solid red circles (diameter = 0.1 inch) at the positions listed in the file DSDP.xy on a +Mercator map at 2 inch/degree of the area 150E to 154E, 18N to 23N, with tickmarks every 1 degree +and gridlines every 15 minutes, try: +.br +.sp +psxy DSDP.xy \fB\-R\fP150/154/18/23 \fB\-Jm\fP2 \fB\-Sc\fP0.1 \fB\-G\fP255/0/0 \fB\-B\fP1\fBg\fP15\fBm\fP | lpr +.br +.sp +To plot the xyz values in the file quakes.xyzm as circles with size given by the magnitude in the +4th column and color based on the depth in the third using the color palette cpt on a linear map, try +.br +.sp +psxy quakes.xyzm \fB\-R\fP0/1000/0/1000 \fB\-JX\fP6 \fB\-Sc\fP \fB\-C\fPcpt \fB\-B\fP200 > map.ps +.br +.sp +To plot the file trench.xy on a Mercator map, with white triangles with sides 0.1 inch on the left side of the line, spaced every 0.8 inch, use +.br +.sp +psxy trench.xy \fB\-R\fP150/200/20/50 \fB\-Jm\fP0.15 \fB\-Sf\fP0.8/0.1\fBL\fP \fB\-G\fP255 \fB\-W \-B\fP10 | lpr +br +.sp +To plot the data in the file misc.d as symbols determined by the code in the last column, and with size given +by the magnitude in the 4th column, and color based on the third column via the color palette cpt on a linear map, try +.br +.sp +psxy misc.d \fB\-R\fP0/100/-50/100 \fB\-JX\fP6 \fB\-S\fP \fB\-C\fPcpt \fB\-B\fP20 > t.ps +.SH SEE ALSO +gmt, psbasemap, psxyz diff -uNr GMT3.1/src/Makefile GMT3.1_bulb_patch/src/Makefile --- GMT3.1/src/Makefile Mon Nov 23 19:20:37 1998 +++ GMT3.1_bulb_patch/src/Makefile Thu Feb 13 19:14:21 2003 @@ -95,7 +95,7 @@ mapproject.c minmax.c nearneighbor.c project.c psbasemap.c psclip.c pscoast.c \ pshistogram.c psimage.c psmask.c psrose.c psscale.c pstext.c pscontour.c \ pswiggle.c psxy.c psxyz.c sample1d.c spectrum1d.c splitxyz.c surface.c \ - trend1d.c trend2d.c triangulate.c xyz2grd.c + trend1d.c trend2d.c triangulate.c xyz2grd.c grdbulb.c #------------------------------------------------------------------------------- # object file dependencies diff -uNr GMT3.1/src/grdbulb.c GMT3.1_bulb_patch/src/grdbulb.c --- GMT3.1/src/grdbulb.c Thu Jan 1 09:00:00 1970 +++ GMT3.1_bulb_patch/src/grdbulb.c Thu Feb 13 19:14:21 2003 @@ -0,0 +1,349 @@ +/*-------------------------------------------------------------------- + * The GMT-system: @(#)grdbulb.c 0.1 06/11/1999 + * + * Copyright (c) 1999 by cachu + * + * This program is modified grdvector.c by + * Copyright (c) 1991-1998 by P. Wessel and W. H. F. Smith + * See COPYING file for copying and redistribution conditions. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Contact info: www.soest.hawaii.edu/gmt + *--------------------------------------------------------------------*/ +/* + grdbulb reads 2 grdfiles that contains the 2 components of a vector + field (cartesian or polar) and plots wind bulb at the grid positions. + This is basically a short-hand for using grd2xyz | psxy -SV and is + more convenient for such plots on a grid. + + *** CAUTION *** + This program is under construction. + + Author: cachu + Date: 11-JUN-1999 + Revised: ----------- + + */ + + +#include "gmt.h" + +float *r, *theta; + +main (int argc, char **argv) +{ + + int i, j, n = 0, nm, nx, ny, ij, i0, j0, di, dj, dummy[4]; + int knot_or_ms = 0; + + BOOLEAN convert_angles = FALSE, get_rgb = FALSE, cartesian = TRUE, shrink = FALSE, set_fill = FALSE; + BOOLEAN error = FALSE, center = FALSE, outline = FALSE, azimuth = FALSE, stick_plot = TRUE, inc_set = FALSE; + BOOLEAN clip = TRUE; + + char *file[2], *cpt; + + double dx2, dy2, b_width = 1., b_length = 0.4, b_angle = 120., b_scale = 5.; + double v_w, h_l, h_w, v_shrink, v_norm = 0.0, tmp, x, y, plot_x, plot_y, x_off, y_off; + double west, east, south, north, off, x2, y2, scale = 1.0; + double data_west, data_east, data_south, data_north, value; + + struct GRD_HEADER h[2]; + struct GMT_FILL fill; + struct GMT_PEN pen; + + GMT_init_pen (&pen, 1); + GMT_init_fill (&fill, -1, -1, -1); + west = east = south = north = 0.0; + dummy[0] = dummy[1] = dummy[2] = dummy[3] = 0; + di = dj = 1; + i0 = j0 = 0; + dx2 = dy2 = 0.0; + + argc = GMT_begin (argc, argv); + + for (i = 1; i < argc; i++) { + if (argv[i][0] == '-') { + switch (argv[i][1]) { + /* Common parameters */ + + case 'B': + case 'J': + case 'K': + case 'O': + case 'P': + case 'R': + case 'U': + case 'V': + case 'X': + case 'x': + case 'Y': + case 'y': + case 'c': + case '\0': + error += GMT_get_common_args (argv[i], &west, &east, &south, &north); + break; + + /* Supplemental parameters */ + + case 'A': + cartesian = FALSE; + break; + case 'E': + center = TRUE; + break; + case 'I': /* Only use gridnodes dx2,dy2 apart */ + GMT_getinc (&argv[i][2], &dx2, &dy2); + inc_set = TRUE; + break; + case 'N': /* Do not clip at border */ + clip = FALSE; + break; + case 'Q': + if (argv[i][2] && argv[i][3] != 'n') { + if (sscanf (&argv[i][2], "%lf/%lf/%lf/%lf", &b_width, &b_length, &b_angle, &b_scale) != 4) { + fprintf (stderr, "%s: GMT SYNTAX ERROR -Q option: Could not decode bulbwidth/bulblength/bulbangle/bulbscale\n", GMT_program); + error++; + } + } + stick_plot = FALSE; + break; + case 'S': + /* scale = atof (&argv[i][2]); */ + scale = 1.0; + break; + case 'T': + convert_angles = TRUE; + break; + case 'W': /* Set line attributes */ + if (argv[i][2] && GMT_getpen (&argv[i][2], &pen)) { + GMT_pen_syntax ('W'); + error++; + } + outline = TRUE; + break; + case 'Z': + azimuth = TRUE; + break; + default: + error = TRUE; + GMT_default_error (argv[i][1]); + break; + } + } + else if (n < 2) + file[n++] = argv[i]; + else + n++; + } + + if (argc == 1 || GMT_quick) { + fprintf (stderr, "grdbulb %s - Plot wind bulbs from grdfiles\n\n", GMT_VERSION); + fprintf (stderr, "usage: grdbulb compx.grd compy.grd -J -R [-A]\n"); + fprintf (stderr, "\t[-B] [-E] [-I] [-K] [-O] [-P] [-Q] [-N] [-S] [-T]\n"); + fprintf (stderr, "\t[-U[