Main Content

matlab.io.hdfeos.gd.ll2ij

Namespace: matlab.io.hdfeos.gd

Convert latitude and longitude to row and column space

Syntax

[row,col] = ll2ij(gridID,lat,lon)

Description

[row,col] = ll2ij(gridID,lat,lon) converts latitude and longitude coordinates to a pre-defined grid's row and column coordinates.

row and col are zero-based and defined such that col increases monotonically with the XDim dimension and row increases monotonically with the YDim dimension in the HD-EOS library.

This routine corresponds to the GDll2ij function in the HDF-EOS C API.

Examples

import matlab.io.hdfeos.*
gfid = gd.open('grid.hdf');
gridID = gd.attach(gfid,'PolarGrid');
lat = [46 46 42 42];
lon = [-71 -67 -67 -71];
[row,col] = gd.ll2ij(gridID,lat,lon);
gd.detach(gridID);
gd.close(gfid);

See Also