ensembleMetadata.getLatLon

Return latitude-longitude coordinates for a variable


Syntax



Description

coordinates = obj.getLatLon(v, variableRows, …)

Obtains latitude-longitude coordinates at the specified rows of avariable in a state vector. Extracts coordinates from either the lat and lon dimensions, or from the site dimension. If the variable is missing the required dimensions, returns NaN coordinates. Also returns NaN coordinates if the variable implements a mean over the dimensions. Expects the lat/lon coordinate metadata for each row to either be a numeric scalar, string scalar, or char row vector. Returns NaN coordinates if the metadata does not follow this format. If the coordinate metadata is string or char, converts the coordinate to a numeric format using the “str2double” function. If the coordinate cannot be converted, uses a NaN coordinate for the row.


Extracts coordinate metadata from the lat and lon dimensions.


Extracts coordinate metadata from the site dimension. Coordinates are extracted from the indicated columns of the metadata. If the site metadata is missing a column, returns NaN for that coordinate.


Input Arguments

v

scalar linear index
The index of a variable in the state vector

variableRows

vector, linear indices
Rows of the variable at which to return latitude-longitude coordinates. These rows are interpreted relative to the variable, rather than the overall state vector.

latlonDimensions

string vector [2]
The names of the lat and lon dimension. First element is lat, and second element is lon.

siteDimension

string scalar
The name of the site dimension

columns

vector [2], positive integers | NaN
If extracting coordinates from the site dimension, indicates which columns of site metadata hold the latitude and longitude coordinates. The first element is latitude and the second element is longitude. This input is ignored when extracting metadata from the lat and lon dimensions.

Output Arguments

coordinates

numeric matrix [nVariableRows x 2]
The latitude and longitude coordinate for each row of the variable. A matrix with two columns. The first column holds the latitude points, and the second column holds longitude.