diff -uNr GMT3.4.5/src/GMT.in GMT3.4.5_barb/src/GMT.in --- GMT3.4.5/src/GMT.in 2004-01-03 13:36:02.000000000 +0900 +++ GMT3.4.5_barb/src/GMT.in 2005-03-13 09:29:11.000000000 +0900 @@ -68,6 +68,7 @@ gmtmath Mathematical operations on data tables gmtset Set individual default parameters gmtselect Extract data subsets based on spatial criteria + grdbarb Plot wind barbs from grdfiles grdfilter Filter 2-D data sets in the space domain grd2cpt Make a color palette table from a grdfile grd2xyz Conversion from 2-D gridded file to table data diff -uNr GMT3.4.5/src/Makefile GMT3.4.5_barb/src/Makefile --- GMT3.4.5/src/Makefile 2004-01-08 15:05:31.000000000 +0900 +++ GMT3.4.5_barb/src/Makefile 2005-03-13 09:27:14.000000000 +0900 @@ -103,7 +103,7 @@ 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 + triangulate.c xyz2grd.c grdbarb.c first: all @@ -144,7 +144,7 @@ all: init libs $(PROGS) init: gmtmacros gmt_notposix.h gmt_nan.h - + gmtmacros: if [ `cat makegmt.macros | wc -c` = 0 ]; then \ echo "src/makegmt.macros is empty - you must rerun configure in the main GMT directory"; \ diff -uNr GMT3.4.5/src/grdbarb.c GMT3.4.5_barb/src/grdbarb.c --- GMT3.4.5/src/grdbarb.c 1970-01-01 09:00:00.000000000 +0900 +++ GMT3.4.5_barb/src/grdbarb.c 2005-03-13 09:27:14.000000000 +0900 @@ -0,0 +1,420 @@ +/*-------------------------------------------------------------------- + * $Id: grdbarb.c,v 0.5 2002/05/27 $ + * + * Copyright (c) 1991-2002 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: gmt.soest.hawaii.edu + *--------------------------------------------------------------------*/ +/* + + grdbarb reads 2 grdfiles that contains the 2 components of a vector + field (cartesian or polar) and plots wind barb at the grid positions. + + *** CAUTION *** + This program is under construction. + + Author: cachu + Date: 27-MAY-2002 + Revised: ----------- + Version: 0.5 ( for GMT-3.4.1 ) + + */ + + +#include "gmt.h" + +float *r, *theta; + +main (int argc, char **argv) +{ + + int i, j, n = 0, nm, nx, ny, ij, i0, j0, di, dj, off; + int dummy[4], 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 , got_fix_length = FALSE; + + char *file[2], *cpt, txt_a[32], txt_b[32], txt_c[32], unit = 0; + + double dx2, dy2, b_width = 0.1, b_length = 0.2, 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, x2, y2, scale = 1.0, fix_length = 0.0; + double data_west, data_east, data_south, data_north, value, c, s; + + struct GRD_HEADER h[2]; + struct GMT_FILL fill; + struct GMT_PEN pen; + + GMT_init_pen (&pen, GMT_PENWIDTH); + 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 'C': /* Vary symbol color with z */ + cpt = &argv[i][2]; + get_rgb = TRUE; + break; + case 'E': + center = TRUE; + break; + case 'G': /* Set Gray shade for polygon */ + if (GMT_getfill (&argv[i][2], &fill)) { + GMT_fill_syntax ('G'); + error++; + } + set_fill = 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", txt_a, txt_b, &b_angle, &b_scale) != 4) { + fprintf (stderr, "%s: GMT SYNTAX ERROR -Q option: Could not decode barbwidth/barblength/barbangle/barbscale\n", GMT_program); + error++; + } + else { + b_width = GMT_convert_units (txt_a, GMT_INCH); + b_length = GMT_convert_units (txt_b, GMT_INCH); + } + } + stick_plot = FALSE; + break; + case 'S': + j = strlen (argv[i]) - 1; + if (strchr ("cimpCIMP", (int)argv[i][j])) unit = argv[i][j]; + if (argv[i][2] == 'l' || argv[i][2] == 'L') { + got_fix_length = TRUE; + fix_length = atof (&argv[i][3]); + } + else + scale = atof (&argv[i][2]); + 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, "grdbarb %s - Plot wind barb fields from grdfiles\n\n", GMT_VERSION); + fprintf (stderr, "usage: grdbarb compx.grd compy.grd -J -R [-A]\n"); + fprintf (stderr, "\t[-B] [-E] [-I] [-K] [-O] [-P] [-Q] [-N] [-T]\n"); + fprintf (stderr, "\t[-U[