MB-System Unix Manual Page

mbm_grdcut

Section: MB-System 5.0 (1)
Updated: 3 June 2013
Index
 

NAME

mbm_grdcut - Macro to extract a specified subarea of a GMT GRD grid file as another GRD file.

 

VERSION

Version 5.0

 

SYNOPSIS

mbm_grdcut -Iinfile -Ooutfile -Rw/e/s/n [-H -V]

 

DESCRIPTION

mbm_grdcut is a macro to painlessly cut out a region from a GMT GRD grid file. The GMT program grdcut requires that one specify bounds which exactly match grid cell boundaries. Frequently, one just wants to extract an approximate region quickly, without calculating grid cell sizes and boundary locations. This macro does the the calculations and extracts the subregion closest to that specified by the user.

 

AUTHORSHIP

David W. Caress (caress@mbari.org)

  Monterey Bay Aquarium Research Institute
Dale N. Chayes (dale@ldeo.columbia.edu)

  Lamont-Doherty Earth Observatory

 

OPTIONS

-H
This "help" flag cause the program to print out a description of its operation and then exit immediately.
-I
infile
Sets the filename of the input GMT grid file. This file must be in the GMT NetCDF GRD format.
-O
outfile
Sets the filename of the output GMT grid file. This file will be in the GMT NetCDF GRD format.
-R
w/e/s/n
Sets the bounds of the area to be extracted from the input grid file.
-V
The -V option causes mbm_grdcut to print out status messages.

 

EXAMPLES

Suppose that we have used mbgrid to obtain a topography grid file called KohalaA_bath.grd in the GMT NetCDF GRD format:
    mbgrid -Idatalist \
        -OKohalaA_bath \
        -R-155.72855/-155.31928/20.09488/20.47645 \
        -E30.0/0m! -A2 -N -G3 -C1 -V
Further suppose that one wishes to extract a smaller grid with bounds of 155 degrees 31 minutes W to 155 degrees 26 minutes W in longitude and 20 degrees 13 minutes N to 20 degrees 18 minutes N in latitude. This can be done using the GMT program grdcut, but grdcut requires that the user specify bounds that exactly match the grid cell boundaries in the file. The mbm_grdcut macros allows one to specify approximate desired bounds, calculates the exact, nearest bounds that grdcut will accept, and then executes grdcut.

To obtain the desired sub-grid, the following will suffice:
    mbm_grdcut -I KohalaA_bath.grd         -O Kohala_plunge         -R-155:31/-155:26/20:13/20:18         -V
The resulting output is:

    Program mbm_grdcut status:
        Input GRD file:         kohalaa.grd
        Output GRD file:        z.grd
        Input Grid bounds:      -155.72855 -155.3192906  20.09488 20.47628103
        Input grid dimensions:  1426  1329
        Grid cell sizes:        0.0002871995719  0.0002871995719
        Requested Grid bounds:  -155.516667 -155.433333  20.216667 20.3
        Output Grid bounds:     -155.516884 -155.433596  20.216653 20.299940
        Output grid dimensions: 291  291


    Running grdcut...
    grdcut kohalaa.grd -Gz.grd -R-155.516884/-155.433596/20.216653/20.299940 -V
    grdcut: File spec:    W E S N dx dy nx ny:
    grdcut: Old: -155.729 -155.319 20.0949 20.4763 0.0002872 0.0002872 1426 1329
    grdcut: New: -155.517 -155.434 20.2167 20.2999 0.0002872 0.0002872  291  291

 

SEE ALSO

mbsystem(1), mbgrid(1), mbmosaic(1), mbm_grid(1), mbm_grdplot(1)

 

BUGS

Probably.


 

Index

NAME
VERSION
SYNOPSIS
DESCRIPTION
AUTHORSHIP
OPTIONS
EXAMPLES
SEE ALSO
BUGS


Last Updated: 3 June 2013


Return to list of MB-System manual pages...

Back to MB-System Home Page...