geointerp

Geographic raster interpolation

Description

example

Vq = geointerp(V,R,latq,lonq) interpolates the geographically referenced raster V, using bilinear interpolation. The function returns a value in Vq for each of the query points in arrays latq and lonq. R is a geographic raster reference object that specifies the location and extent of data in V.

Vq = geointerp(___,method) specifies alternate interpolation methods.

Examples

collapse all

Load a georeferenced raster grid.

load topo

Create a raster reference object associated with the topo raster grid.

R = georefcells(topolatlim,topolonlim,size(topo))
R = 
  GeographicCellsReference with properties:

             LatitudeLimits: [-90 90]
            LongitudeLimits: [0 360]
                 RasterSize: [180 360]
       RasterInterpretation: 'cells'
           ColumnsStartFrom: 'south'
              RowsStartFrom: 'west'
       CellExtentInLatitude: 1
      CellExtentInLongitude: 1
     RasterExtentInLatitude: 180
    RasterExtentInLongitude: 360
           XIntrinsicLimits: [0.5 360.5]
           YIntrinsicLimits: [0.5 180.5]
       CoordinateSystemType: 'geographic'
                  AngleUnit: 'degree'


Define the points you want to interpolate using latitude and longitude.

mylats = [-40 -20 20 40];
mylons = [ 42 54 38 62];

Interpolate the values at the defined points.

Vinterpolated = geointerp(topo,R,mylats,mylons)
Vinterpolated = 1×4
103 ×

   -2.8327   -4.3855   -0.7125    0.1700

Input Arguments

collapse all

Georeferenced raster grid, specified as numeric or logical array.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical

Geographic raster, specified as a GeographicCellsReference or GeographicPostingsReference object.

To convert a referencing matrix to a geographic raster reference object, use refmatToGeoRasterReference.To convert a referencing vector to a geographic raster reference object, use refvecToGeoRasterReference.

Latitude of query point coordinates, specified as a numeric array.

Data Types: single | double

Longitude of query point coordinates, specified as a numeric array.

Data Types: single | double

Interpolation methods, specified as one of the following values.

MethodDescription
'nearest'Nearest neighbor interpolation
'linear'Bilinear interpolation
'cubic'Bicubic interpolation
'spline'Spline interpolation

Data Types: char | string

Output Arguments

collapse all

Interpolated values, returned as a numeric array.

Introduced in R2017a