grdrotater

Finite rotation reconstruction of geographic grid

Synopsis

gmt grdrotater ingrid -Erot_file|lon/lat/angle[+i] -Goutgrid [ -Aregion ] [ -Drotoutline ] [ -Fpolygonfile ] [ -N ] [ -Rregion ] [ -S ] [ -Tages ] [ -V[level] ] [ -bbinary ] [ -dnodata ] [ -fflags ] [ -ggaps ] [ -hheaders ] [ -nflags ] [ -oflags ] [ -:[i|o] ] [ --PAR=value ]

Note: No space is allowed between the option flag and the associated arguments.

Description

grdrotater reads a geographical grid and reconstructs it given total reconstruction rotations. 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 reconstructed region. The outlines of the reconstructed region is also returned provided the rotated region is not the entire globe.

Required Arguments

ingrid[=ID|?varname][+bband][+ddivisor][+ninvalid] [+ooffset][+sscale]

Name of a grid file in geographical (lon, lat) coordinates. Optionally, append =ID for reading a specific file format [Default is =nf] or ?varname for a specific netCDF variable [Default is the first 2-D grid found by GMT] (See full description). The following modifiers are supported:

  • +b - Select a band (for images only) [Default is 0].

  • +d - Divide data values by the given divisor [Default is 1].

  • +n - Replace data values matching invalid with NaN.

  • +o - Offset data values by the given offset [Default is 0].

  • +s - Scale data values by the given scale [Default is 1].

Note: Any offset is added after any scaling.

-Erot_file|ID1-ID2|lon/lat/angle[+i]

Rotations can be specified in one of three ways: (1): Give file with rotation parameters. This file must contain one record for each rotation; each record must be of the following format:

lon lat tstart [tstop] angle [ khat a b c d e f g df ]

where tstart and tstop are in Myr and lon lat angle are in degrees. tstart and tstop are the ages of the old and young ends of a stage. If tstop is not present in the record then a total reconstruction rotation is expected and tstop is implicitly set to 0 and should not be specified for any of the records in the file. If a covariance matrix C for the rotation is available it must be specified in a format using the nine optional terms listed in brackets. Here, C = (g/khat)*[ a b d; b c e; d e f ] which shows C made up of three row vectors. If the degrees of freedom (df) in fitting the rotation is 0 or not given it is set to 10000. Blank lines and records whose first column contains # will be ignored. (2): Give the filename composed of two plate IDs separated by a hyphen (e.g., PAC-MBL) and we will instead extract that rotation from the GPlates rotation database. We return an error if the rotation cannot be found. (3): Specify lon/lat/angle, i.e., the longitude, latitude, and opening angle (all in degrees and separated by /) for a single total reconstruction rotation. Regardless of method, you may append +i to the argument to indicate you wish to invert the rotation(s).

-Goutgrid[=ID][+ddivisor][+ninvalid] [+ooffset|a][+sscale|a] [:driver[dataType][+coptions]]

Name of output grid. This is the grid with the data reconstructed according to the specified rotation. If more than one reconstruction time is implied then outgrid must contain a C-format specifier to format a floating point number (reconstruction time) to text. Optionally, append =ID for writing a specific file format (See full description). The following modifiers are supported:

  • +d - Divide data values by given divisor [Default is 1].

  • +n - Replace data values matching invalid with a NaN.

  • +o - Offset data values by the given offset, or append a for automatic range offset to preserve precision for integer grids [Default is 0].

  • +s - Scale data values by the given scale, or append a for automatic scaling to preserve precision for integer grids [Default is 1].

Note: Any offset is added before any scaling. +sa also sets +oa (unless overridden). To write specific formats via GDAL, use = gd and supply driver (and optionally dataType) and/or one or more concatenated GDAL -co options using +c. See the “Writing grids and images” cookbook section for more details.

Optional Arguments

-Aregion

Specify directly the region of the rotated grid. By default, the output grid has a region that exactly matches the extent of the rotated domain, but -A can be used to crop or extend this region to that provided via region.

-Drotoutline

Name of the grid polygon outline file. This represents the outline of the grid reconstructed to the specified time. If more than one reconstruction time is implied then rotoutline must contain a C-format specifier to format a floating point number (reconstruction time) to text. If only one time is implied and -D is not set then we write the polygon to stdout (but see -N).

-Fpolygonfile

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

-N

Do Not output the rotated polygon outline [Default will write it to stdout, or to a file via -D].

-Rwest/east/south/north[/zmin/zmax][+r][+uunit]

Specify the region of interest.

The region may be specified in one of several ways:

  1. -Rwest/east/south/north[+uunit]. This is the standard way to specify geographic regions when using map projections where meridians and parallels are rectilinear. The coordinates may be specified in decimal degrees or in [±]dd:mm[:ss.xxx][W|E|S|N] format. Optionally, append +uunit to specify a region in projected units (e.g., UTM meters) where west/east/south/north are Cartesian projected coordinates compatible with the chosen projection (-J) and unit is an allowable distance unit; we inversely project to determine the actual rectangular geographic region.

  2. -Rwest/south/east/north+r. This form is useful for map projections that are oblique, making meridians and parallels poor choices for map boundaries. Here, we instead specify the lower left corner and upper right corner geographic coordinates, followed by the modifier +r. This form guarantees a rectangular map even though lines of equal longitude and latitude are not straight lines.

  3. -Rg or -Rd. These forms can be used to quickly specify the global domain (0/360 for -Rg and -180/+180 for -Rd in longitude, with -90/+90 in latitude).

  4. -Rcode1,code2,…[+e|r|Rincs]. This indirectly supplies the region by consulting the DCW (Digital Chart of the World) database and derives the bounding regions for one or more countries given by the codes. Simply append one or more comma-separated countries using the two-character ISO 3166-1 alpha-2 convention. To select a state within a country (if available), append .state, e.g, US.TX for Texas. To specify a whole continent, prepend = to any of the continent codes AF (Africa), AN (Antarctica), AS (Asia), EU (Europe), OC (Oceania), NA (North America), or SA (South America). The following modifiers can be appended:

    • +r to adjust the region boundaries to be multiples of the steps indicated by inc, xinc/yinc, or winc/einc/sinc/ninc [default is no adjustment]. For example, -RFR+r1 will select the national bounding box of France rounded to nearest integer degree.

    • +R to extend the region outward by adding the amounts specified by inc, xinc/yinc, or winc/einc/sinc/ninc [default is no extension].

    • +e to adjust the region boundaries to be multiples of the steps indicated by inc, xinc/yinc, or winc/einc/sinc/ninc, while ensuring that the bounding box extends by at least 0.25 times the increment [default is no adjustment].

  5. -Rjustifylon0/lat0/nx/ny, where justify is a 2-character combination of L|C|R (for left, center, or right) and T|M|B (for top, middle, or bottom) (e.g., BL for lower left). The two character code justify indicates which point on a rectangular region region the lon0/lat0 coordinates refer to and the grid dimensions nx and ny are used with grid spacings given via -I to create the corresponding region. This method can be used when creating grids. For example, -RCM25/25/50/50 specifies a 50x50 grid centered on 25,25.

  6. -Rgridfile. This will copy the domain settings found for the grid in specified file. Note that depending on the nature of the calling module, this mechanism will also set grid spacing and possibly the grid registration (see Grid registration: The -r option).

  7. -Ra[uto] or -Re[xact]. Under modern mode, and for plotting modules only, you can automatically determine the region from the data used. You can either get the exact area using -Re [Default if no -R is given] or a slightly larger area sensibly rounded outwards to the next multiple of increments that depend on the data range using -Ra.

-S

Skip the rotation of the grid, just rotate the polygon outline (requires -F if no grid is provided).

-Tages

Sets the desired reconstruction times. For a single time append the desired time. For an equidistant range of reconstruction times give -Tstart/stop/inc. Append +n if inc should be interpreted to mean npoints instead. For an non-equidistant set of reconstruction times please pass them via the first column in a file, e.g., -Tagefile. If no -T option is given and -E specified a rotation file then we equate the rotation file times with the reconstruction times.

-V[level]

Select verbosity level [w]. (See full description) (See cookbook information).

-birecord[+b|l] (more …)

Select native binary format for primary table input. [Default is 2 input columns].

-borecord[+b|l] (more …)

Select native binary format for table output. [Default is same as input].

-d[i|o]nodata (more …)

Replace input columns that equal nodata with NaN and do the reverse on output.

-f[i|o]colinfo (more …)

Specify data types of input and/or output columns.

-h[i|o][n][+c][+d][+msegheader][+rremark][+ttitle] (more …)

Skip or produce header record(s).

-:[i|o] (more …)

Swap 1st and 2nd column on input and/or output.

-n[b|c|l|n][+a][+bBC][+c][+tthreshold] (more …)

Select interpolation mode for grids.

-ocols[,…][,t[word]] (more …)

Select output columns (0 is first column; t is trailing text, append word to write one word only).

-^ or just -

Print a short message about the syntax of the command, then exit (NOTE: on Windows just use -).

-+ or just +

Print an extensive usage (help) message, including the explanation of any module-specific option (but not the GMT common options), then exit.

-? or no arguments

Print a complete usage (help) message, including the explanation of all options, then exit.

--PAR=value

Temporarily override a GMT default setting; repeatable. See gmt.conf for parameters.

Consequences of grid resampling

Resample or sampling of grids will use various algorithms (see -n) that may lead to possible distortions or unexpected results in the resampled values. One expected effect of resampling with splines is the tendency for the new resampled values to slightly exceed the global min/max limits of the original grid. If this is unacceptable, you can impose clipping of the resampled values values so they do not exceed the input min/max values by adding +c to your -n option.

Geodetic versus Geocentric Coordinates

All spherical rotations are applied to geocentric coordinates. This means that incoming data points and grids are considered to represent geodetic coordinates and must first be converted to geocentric coordinates. Rotations are then applied, and the final reconstructed points are converted back to geodetic coordinates. This default behavior can be bypassed if the ellipsoid setting PROJ_ELLIPSOID is changed to Sphere.

Examples

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

gmt grdrotater topo.nc -E135.5/-33/37.3 -V -Fclip_path.txt -Grot_topo.nc > rot_clip_path.txt

To rotate the entire grid faa.nc back to 32 Ma using the rotation file rotations.txt and a bilinear interpolation, try

gmt grdrotater faa.nc -Erotations.txt -T32 -V -Grot_faa.nc -nl > rot_faa_path.txt

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

gmt grdrotater large.nc -Erotations.txt -T32 -V -S | gmt plot -Rg -JH180/6i -B30 -W0.5p \| gv -

To rotate the grid topo.nc back to 100 Ma using the rotation file rotations.txt and request a reconstruction every 10 Myr, saving both grids and outlines to filenames that derive from templates, try

gmt grdrotater topo.nc -Erotations.txt -T10/100/10 -V -Grot_topo_%g.nc -Drot_topo_path_%g.txt

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

gmt grdmath 1 rot_gridA.nc ISNAN SUB 1 rot_gridB.nc ISNAN SUB 2 EQ = overlap.nc

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

Notes

GMT distributes the EarthByte rotation model Global_EarthByte_230-0Ma_GK07_AREPS.rot. To use an alternate rotation file, create an environmental parameters named GPLATES_ROTATIONS that points to an alternate rotation file.