The registration tool resamples gridded earth data to a master
projection.
Name
cwregister - resamples gridded earth data to a master projection.
Synopsis
cwregister [OPTIONS] master input output
Options:
-f, --srcfilter=TYPE
-h, --help
-m, --match=PATTERN
-M, --method=TYPE
-O, --overwrite=TYPE
-p, --polysize=KILOMETERS
-r, --rectsize=WIDTH/HEIGHT
-s, --srcexpr=EXPRESSION
-v, --verbose
--version
Description
The register tool resamples gridded earth data to
a master projection. A master projection specifies the translation
between grid row and column coordinates and earth latitude and
longitude coordinates. The master projection file is any valid
earth data file from which a set of row and column dimensions
and earth transform parameters may be extracted. This includes
standard CoastWatch product files as well as master files created
using the cwmaster tool.
Parameters
Main parameters:
- master
- The master projection file name. Note that the master file
is not altered in any way. It is simply accessed in order to
determine grid and earth transform parameters.
- input
- The input data file name.
- output
- The output data file name.
Options:
- -h, --help
- Prints a brief help message.
- -f, --srcfilter=TYPE
- Specifies a filter used to determine whether source pixels
at a given location should be used in registration. The only filter
type currently supported is 'viirs', which filters out pixels from the
VIIRS sensor that have been omitted due to bow-tie overlap. By default
all valid source pixels are used in registration. See also the
--srcexpr option to filter using an expression.
- -m, --match=PATTERN
- The variable name matching pattern. If specified, the
pattern is used as a regular expression to match variable names.
Only variables in the input file matching the pattern will be
registered. By default, no pattern matching is performed and all
variables are registered.
- -M, --method=TYPE
- The registration resampling method. Valid methods are
'inverse', 'mixed', and 'direct':
- Inverse - This method divides the destination grid into a
series of rectangles of physical size no larger than that specified by
the --polysize option (100 km by default), and computes polynomial
coefficients for approximating the coordinate transform within each
rectangle. Each polynomial approximation computes a source coordinate
in the source grid for each destination coordinate in the destination
grid rectangle. This is the default method of registration and is
recommended when the source earth location data is smooth and continuous
such as with AVHRR LAC swath data.
- Mixed - This method divides the source grid into rectangles
of a size specified by the --rectsize option (50x50 pixels by
default), and computes polynomial coefficients on each rectangle that
are used to approximate a source coordinate in the source grid rectangle
for each destination coordinate in the corresponding destination grid
rectangle. The method follows up with a single pixel interpolation to
fill in pixels that fell between destination rectangles bounds. This
method is recommended when the source earth location data is
discontinuous at regular intervals, such as with MODIS swath data. In
this case, the --rectsize option must be used to specify rectangles
that are compatible with the discontinuity. For example if the source
earth location data is discontinuous at 16 pixel intervals along the
row direction, then the rectangle size should be set to 16x16.
- Direct - This method is the simplest and performs a direct
lookup of the source coordinate in the source grid for each destination
coordinate in the destination grid. This method is available mainly
as a comparison for testing the accuracy and speed of the other methods,
since it is expected to run more slowly but have the highest accuracy.
Note that the direct method cannot currently be used if the source grid
contains discontinuous earth location data (such as MODIS swath data).
- -O, --overwrite=TYPE
- ADVANCED USERS ONLY. Sets the overwrite policy for
'mixed' mode resampling: either 'always' (the default),
'never', or 'closer'. If during resampling, more than one
source pixel maps to a single destination pixel, this option
is used to determine if the new value should overwrite the
old value. By default, the new value always overwrites the
destination pixel (the 'always' mode). If 'never' is
specified, the first written value is never overwritten. If
'closer' is specified, the destination pixel is only
overwritten if the source pixel is closer in physical
location to the destination than any previous source
pixel.
- -p, --polysize=KILOMETERS
- The polynomial approximation rectangle size in kilometers.
This option is only used by the inverse resampling method (see
the --method option). The inverse resampling method
employs a polynomial approximation to speed up the calculation of
data locations. The polynomial rectangle size determines the
maximum allowed size of the resampling rectangles in the
destination. The default polynomial size is 100 km, which
introduces an error of less than 0.15 km for AVHRR LAC data.
- -r, --rectsize=WIDTH/HEIGHT
- The polynomial approximation rectangle size in pixels. This
option is only used by the mixed resampling method (see the
--method option). The mixed resampling method employs a
polynomial approximation to speed up the calculation of data
locations. The polynomial rectangle size determines the exact
dimensions of the resampling rectangles in the source. The
default polynomial rectangle size is 50/50, which introduces
only a small error for AVHRR LAC data.
- -s, --srcexpr=EXPRESSION
- Specifies that an expression should be used to
determine if pixels from the source should be used in
registration. If the result of the expression is true (in the case of a
boolean result) or non-zero (in the case of a numerical
result), the source pixel at the given location is used, otherwise it is
ignored. The syntax for the expression is identical to the right-hand-side
of a cwmath expression (see the cwmath tool manual
page). By default all valid source pixels are used in registration.
- -v, --verbose
- Turns verbose mode on. The current status of data
conversion is printed periodically. The default is to run
quietly.
- --version
- Prints the software version.
Exit status
0 on success, > 0 on failure. Possible causes of errors:
- Invalid command line option.
- Invalid master, input or output file names.
- Unsupported master or input file format.
Examples
The following shows the registration of NOAA-17 AVHRR channel 2
swath data to a southern California master:
phollema$ cwregister -v --match avhrr_ch2 ws_master.hdf 2002_318_1826_n17_mo.hdf
2002_318_1826_n17_ws.hdf
cwregister: Reading master ws_master.hdf
cwregister: Reading input 2002_318_1826_n17_mo.hdf
cwregister: Creating output 2002_318_1826_n17_ws.hdf
cwregister: Adding avhrr_ch2 to resampled grids
GridResampler: Found 1 grid(s) for resampling
GridResampler: Resampling 4788x2048 to 1024x1024
GridResampler: Creating location estimators
GridResampler: Computing row 0
GridResampler: Computing row 100
GridResampler: Computing row 200
GridResampler: Computing row 300
GridResampler: Computing row 400
GridResampler: Computing row 500
GridResampler: Computing row 600
GridResampler: Computing row 700
GridResampler: Computing row 800
GridResampler: Computing row 900
GridResampler: Computing row 1000
cwregister: Closing files