Products & Services Industries Academia Support User Community Company

Learn more about Mapping Toolbox   

maptrims - Trim regular data grid to latitude-longitude quadrangle

Syntax

[Z_trimmed] = maptrims(Z,R,latlim,lonlim)
[Z_trimmed] = maptrims(Z,R,latlim,lonlim,cellDensity)
[Z_trimmed, R_trimmed] = maptrims(...)

Description

[Z_trimmed] = maptrims(Z,R,latlim,lonlim) trims a regular data grid Z to the region specified by latlim and lonlim. R is either a 1-by-3 vector containing elements:

[cells/degree northern_latitude_limit western_longitude_limit]

or a 3-by-2 referencing matrix that transforms raster row and column indices to/from geographic coordinates according to:

[lon lat] = [row col 1] * R

If R is a referencing matrix, it must define a (non-rotational, non-skewed) relationship in which each column of the data grid falls along a meridian and each row falls along a parallel. latlim and lonlim are two-element vectors, defining the latitude and longitude limits respectively. The output grid Z_trimmed has the same sample size as the input.

[Z_trimmed] = maptrims(Z,R,latlim,lonlim,cellDensity) uses cellDensity to reduce the size of the output. If R is a referencing vector, then R(1) must be evenly divisible by cellDensity. If R is a referencing matrix, then the inverse of each element in the first two rows (containing "deltaLat" and "deltaLon") must be evenly divisible by cellDensity.

[Z_trimmed, R_trimmed] = maptrims(...) returns a referencing vector or matrix for the trimmed data grid. If R is a referencing vector, then R_trimmed is a referencing vector. Likewise, if R is a referencing matrix, then R_trimmed is a referencing matrix.

Examples

load topo
[subgrid,subrefvec] = maptrims(topo,topolegend,...
                              [80.25 85.3],[165.2 170.7])

subgrid =
       -2826       -2810       -2802       -2793
       -2915       -2913       -2905       -2884
       -3192       -3186       -3165       -3122
       -3399       -3324       -3273       -3214

subrefvec =
     1    85   166

The upper left corner of the grid might differ slightly from that of the requested region. maptrims uses the corner coordinates of the first cell inside the limits.

See Also

maptriml, maptrimp, resizem

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS