GRDROTATER(1)

NAME
grdrotater - Rotate a grid using a finite rotation

SYNOPSIS
grdrotate ingrdfile -Goutgrdfile -Tplon/plat/omega [ -Fpolygonfile ] [ -H[i][nrec] ] [ -M[flag] ] [ -N ] [ -Q[value] [ -Rwest/east/south/north[r] ] [ -S ] [ -V ] [ -:[i|o] ] [ -b[i|o][s|S|d|D][ncol] ]

DESCRIPTION
grdrotater reads a geographical grid and reconstructs it given a total reconstruction rotation. Optionally, the user may supply a clipping polygon in multiple-segment format; then, only the part of the grid inside the polygon is used to determine the return grid region. The outline of the projected region is returned on stdout.
    No space between the option flag and the associated arguments. Use upper case for the option flags and lower case for modifiers.

ingrdfile
    Name of a grid file in geographical (lon, lat) coordinates.

-G  Name of output grid. This is the grid with the data reconstructed according to the specified rotation.

-T  Finite rotation. Specify the longitude and latitude of the rotation pole and the opening angle, all in degrees.

OPTIONS

-F  Specify a multi-segment closed polygon file that describes the inside area of the grid that should be projected [Default projects entire grid].

-H  Input file(s) has Header record(s). Number of header records can be changed by editing your .gmtdefaults4 file. If used, GMT default is 1 header record. Use -Hi if only input data should have header records [Default will write out header records if the input data have them].

-M  Multiple segment file. Segment separator is a record beginning with flag. [Default is '>'].

-N  Do Not output the rotated polygon outline [Default will write it to stdout].

-Q  Quick mode, use bilinear rather than bicubic interpolation [Default]. Optionally, append value in the 0 <= value <= 1 range. This parameter controls how close to nodes with NaN values the interpolation will go. E.g., a value of 0.5 will interpolate about 1/2-way from a non-NaN to a NaN node, whereas 0.1 will go about 90% of the way, etc. [Default is 1, which means none of the four nearby nodes may be NaN]. A value of 0 will just return the value of the nearest node instead of interpolating.

-R  west, east, south, and north specify the Region of interest, and you may specify them in decimal degrees or in [+-]dd:mm[:ss.xxx][W|E|S|N] format. Append r if lower left and upper right map coordinates are given instead of wesn. The two shorthands -Rg -Rd stand for global domain (0/360 or -180/+180 in longitude respectively, with -90/+90 in latitude).

-S  Skip the rotation of the grid, just rotate the polygon outline (requires -F).

-V  Selects verbose mode, which will send progress reports to stderr [Default runs "silently"].

-:  Toggles between (longitude,latitude) and (latitude,longitude) input/output. [Default is (longitude,latitude)].

-bi Selects binary input. Append s for single precision [Default is d (double)]. Uppercase S (or D) will force byte-swapping. Optionally, append ncol, the number of columns in your binary file if it exceeds the columns needed by the program. [Default is 2 input columns].

-bo Selects binary output. Append s for single precision [Default is d (double)]. Uppercase S (or D) will force byte-swapping. Optionally, append ncol, the number of desired columns in your binary output file. [Default is same as input].

EXAMPLES
To rotate the data defined by grid topo.grd and the polygon outline clip_path.d, using a finite rotation with pole at (135.5, -33.0) and a rotation angle of 37.3 degrees and bicubic interpolation, try

grdrotater topo.grd -T135.5/-33/37.3 -V -Fclip_path.d -Grot_topo.grd > rot_clip_path.d

To rotate the entire grid faa.grd using a finite rotation pole at (67:45W, 22:35S) and a rotation angle of 19.6 degrees using a bilinear interpolation, try

grdrotater faa.grd -T67:45W/22:35S/19.6 -V -Q -Grot_faa.grd > rot_faa_path.d

To just see how the outline of the grid large.grd will plot after the same rotation, try

grdrotater large.grd -T67:45W/22:35S/19.6 -V -S | psxy -Rg -JH180/6i -B30 -M -W0.5p | gv -

Let say you have rotated gridA.grd and gridB.grd, restricting each rotation to nodes inside polygons polyA.d and polyB.d, respectively, using rotation A = (123W,22S,16,4) and rotation B = (108W, 16S, -14.5), yielding rotated grids rot_gridA.grd and rot_gridB.grd. To determine the region of overlap between the rotated grids, we use grdmath:

grdmath 1 rot_gridA.grd ISNAN SUB 1 rot_gridB.grd ISNAN SUB 2 EQ = overlap.grd

The grid overlap.grd now has 1s in the regions of overlap and 0 elsewhere. You can use it as a mask or use grdcontour to extract a polygon (contour).

SEE ALSO
backtracker(1), hotspotter(1), originator(1) rotconverter(1)