Accelerating the pace of engineering and science

# imbedm

Encode data points into regular data grid

## Syntax

Z = imbedm(lat, lon, value, Z, R)
Z = imbedm(lat, lon, value, Z, R, units)
[Z, indxPointOutsideGrid] = imbedm(...)

## Description

Z = imbedm(lat, lon, value, Z, R) resets certain entries of a regular data grid, Z. R can be a geographic raster reference object, a referencing vector, or a referencing matrix.

If R is a geographic raster reference object, its RasterSize property must be consistent with size(Z).

If R is a referencing vector, it must be a 1-by-3 with elements:

`[cells/degree northern_latitude_limit western_longitude_limit]`

If R is a referencing matrix, it must be 3-by-2 and transform raster row and column indices to or 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. Nearest-neighbor interpolation is used by default. NaN is returned for points outside the grid limits or for which lat or lon contain NaN. All angles are in units of degrees.

Z = imbedm(lat, lon, value, Z, R, units) specifies the units of the vectors lat and lon, where units is any valid angle units string ('degrees' by default).

[Z, indxPointOutsideGrid] = imbedm(...) returns the indices of lat and lon corresponding to points outside the grid in the variable indxPointOutsideGrid.

## Examples

Create a simple grid map and embed new values in it:

```Z = ones(3,6)

Z =
1     1     1     1     1     1
1     1     1     1     1     1
1     1     1     1     1     1
refvec = [1/60 90 -180]

refvec =
0.0167   90.0000 -180.0000

newgrid = imbedm([23 -23], [45 -45],[5 5],Z,refvec)

newgrid =
1     1     1     1     1     1
1     1     5     5     1     1
1     1     1     1     1     1```