GetGeogridIndex: Get geogrid cell indices from lat/lon (or other) coordinates.

Description Usage Arguments Details Value See Also Examples

View source: R/geospatial.R

Description

GetGeogridIndex reads in a set of lat/lon (or other) coordinates and generates a corresponding set of geogrid index pairs.

Usage

1
2
GetGeogridIndex(xy, ncfile, x = "lon", y = "lat", id = NULL,
  proj4 = "+proj=longlat +datum=WGS84")

Arguments

xy

The dataframe of lat/lon (or other) coordinates. The dataframe must contain one "x" and one "y" column at a minimum.

ncfile

The full pathname to the WRF-Hydro geogrid domain file.

x

The column name for the x coordinate value (DEFAULT="lon")

y

The column name for the y coordinate value (DEFAULT="lat")

id

The unique ID field value (OPTIONAL)

proj4

The proj4 string for the x/y coordinate projection (DEFAULT='+proj=longlat +datum=WGS84')

Details

GetGeogridIndex reads in a set of lat/lon (or other real-world) coordinates and a geogrid file and generates a corresponding set of geogrid index pairs.

Value

A dataframe containing the i (we=west->east), j (sn=south->north) indices (row, column).

See Also

Other geospatial: ExportGeogrid, GetGeogridSpatialInfo, GetPoly, GetProj, GetRfc, GetTimeZone, PolyToRaster

Examples

1
2
3
4
5
6
7
## Take the geogrid (low-res) domain for Fourmile and a pair of lat/lon
## coordinates for the Niwot Ridge SNOTEL site and get the index values.
## Not run: 
GetGeogridIndex(data.frame(lon=-105.54, lat=40.04), 
   "~/wrfHydroTestCases/Fourmile_Creek/DOMAIN/geo_em.d01_1km_nlcd11.nc")

## End(Not run)

mccreigh/rwrfhydro documentation built on Feb. 28, 2021, 1:53 p.m.