grib_latlons: Extract projected latitudes and longitudes

View source: R/grib_latlons.R

grib_latlonsR Documentation

Extract projected latitudes and longitudes

Description

grib_latlons extracts the latitudes and longitudes from a GRIB message and optionally expands them into matrix form.

Usage

grib_latlons(gribMessage, expand = FALSE)

Arguments

gribMessage

gribMessage class object.

expand

optional logical inidcating whether or not to return coordinates as a matrix or not. Default FALSE.

Details

grib_latlons is a convenience function that returns the latitude and longitudes after reversing projected coordinates (using the proj4 package) from the GRIB message. This makes it easy to use latitude and longitude for the axes in plots intstead of eastings and northings. Use of this function is optional given that the user can extract the PROJ.4 string from the GRIB message using grib_proj4str. From the user can use whatever package/work flow to project the data. Not all grid types may be supported at this time. New grid types may be added in the future.

This function is influenced by the latitude and longitude extraction method used in the pygrib Python module (see pygrib source).

Value

a list or a matrix of the latitudes and longitudes after projection.

See Also

grib_select grib_get_message grib_expand_grids

Examples

g <- grib_open(system.file("extdata", "lfpw.grib1", package = "gribr"))
gm <- grib_get_message(g, 1)
latlon <- grib_latlons(gm)
grib_close(g)

nawendt/gribr documentation built on July 15, 2024, 10:51 a.m.