Main Content

matlab.io.hdfeos.gd.ij2ll

Namespace: matlab.io.hdfeos.gd

Convert row and column space to latitude and longitude

Syntax

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

Description

[lat,lon] = ij2ll(gridID,row,col) converts a grid's row and column coordinates to latitude and longitude in decimal degrees.

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 GDij2ll function in the HDF-EOS C API.

Examples

import matlab.io.hdfeos.*
gfid = gd.open('grid.hdf');
gridID = gd.attach(gfid,'PolarGrid');
[xdim,ydim] = gd.gridInfo(gridID);
r = 0:(xdim-1);
c = 0:(ydim-1);
[Col,Row] = meshgrid(c,r);
[lat,lon] = gd.ij2ll(gridID,Row,Col);
gd.detach(gridID);
gd.close(gfid);