# GRDROTATER

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
EXAMPLES
COORDINATES
SEE ALSO

## NAME

grdrotater − Rotate a grid using a finite rotation

## SYNOPSIS

grdrotate ingrdfile −G outgrdfile −T plon/plat/omega [ −F polygonfile ] [ −H[i][nrec] ] [ −N ] [ −Q[b|c|l|n][[/]threshold] ] [ −R west/east/south/north[r] ] [ −S ] [ −V ] [ −:[i|o] ] [ −b[i|o][s|S|d|D[ncol]|c[var1/...]] ] [ −m[flag] ]

## 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 provided the rotated region is not the entire globe.

|  | 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). If used, the default number of header records is N_HEADER_RECS. Use −Hi if only input data should have header records [Default will write out header records if the input data have them]. Blank lines and lines starting with # are always skipped.
| −N |  | Do Not output the rotated polygon outline [Default will write it to stdout].
| −Q |  | Quick mode, use bilinear rather than bicubic interpolation [Default]. Alternatively, select the interpolation mode by adding b for B-spline smoothing, c for bicubic interpolation, l for bilinear interpolation or n for nearest-neighbor value. Optionally, append threshold in the range [0,1]. This parameter controls how close to nodes with NaN values the interpolation will go. E.g., a threshold of 0.5 will interpolate about half 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 (4 or 16) nearby nodes may be NaN]. −Q0 will just return the value of the nearest node instead of interpolating. This is the same as using −Qn.
| −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 w/e/s/n. The two shorthands −Rg and −Rd stand for global domain (0/360 and -180/+180 in longitude respectively, with -90/+90 in latitude). Alternatively, specify the name of an existing grid file and the −R settings (and grid spacing, if applicable) are copied from the grid.
| −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 input file if it exceeds the columns needed by the program. Or append c if the input file is netCDF. Optionally, append var1/var2/... to specify the variables to be read. [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].
| −m |  | Multiple segment file(s). Segments are separated by a special record. For ASCII files the first character must be flag [Default is ’>’]. For binary files all fields must be NaN and −b must set the number of output columns explicitly. By default the −m setting applies to both input and output. Use −mi and −mo to give separate settings to input and output.

## 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).

## COORDINATES

Data coordinates are assumed to be geodetic and will automatically be converted to geocentric before spherical rotations are performed. We convert back to geodetic coordinates for output. Note: If your data already are geocentric, you can avoid the conversion by using --ELLIPSOID=sphere.

## SEE ALSO

backtracker(1), grdspotter(1), hotspotter(1), originator(1) rotconverter(1)