Referencing vector to geographic raster reference object
R = refvecToGeoRasterReference(refvec,rasterSize)
R = refvecToGeoRasterReference(___,funcName,varName,argIndex)
R = refvecToGeoRasterReference(Rin,rasterSize,___)
constructs
a geographic raster reference object, R
= refvecToGeoRasterReference(refvec
,rasterSize
)R
, from a
referencing vector, refvec
, and a size vector, rasterSize
.
uses up to three optional arguments to provide additional information. This information is
used to construct error messages if either the R
= refvecToGeoRasterReference(___,funcName
,varName
,argIndex
)refvec
or
rasterSize
inputs turn out to be invalid. Thus, you can use
refvecToGeoRasterReference
for both validating and converting a
referencing vector. The optional inputs work just like their counterparts in the
MATLAB® function validateattributes
.
verifies
that R
= refvecToGeoRasterReference(Rin
,rasterSize
,___)Rin.RasterSize
is consistent with rasterSize
,
then copies Rin
to R
.
|
Any valid 1-by-3 referencing vector, as long as the cell size |
|
Size vector |
|
Name used in the formatted error message to identify the function checking the input, specified as a character vector. |
|
Name used in the formatted error message to identify the referencing vector, specified as a character vector. |
|
Positive integer that indicates the position of the referencing
vector checked in the function argument list. |
|
Geographic raster reference object. |
|
Geographic raster reference object. |
Convert a referencing vector manually versus using the georasterref
function.
% Construct a referencing vector for a regular 180-by-240 grid % covering an area that includes the Korean Peninsula, with 12 cells % per degree. refvec = [12 45 115]; % Convert to a geographic raster reference object: rasterSize = [180 240]; R = refvecToGeoRasterReference(refvec,rasterSize); % Construct a reference object with the same limits. latlim = R.LatitudeLimits; lonlim = R.LongitudeLimits; R2 = georasterref('RasterSize',rasterSize,'Latlim',latlim, ... 'Lonlim',lonlim);