```
get_merra2_grid(
type = "polygons",
locid = NULL,
lon = c(-180, 180),
lat = c(-90, 90),
crs = 4326,
add_lonlat = FALSE,
add_poles_points = TRUE,
...
)
```

## Arguments

- type
type of grid-data to return, spatial points ("points") or polygons ("poly")

- locid
(optional) integer vector of location identifiers for which the grid will be returned.

- lon
numeric vector (min and max) with the range of longitude coordinates of the grid to return. Default `c(-180, 180)`.

- lat
numeric vector with the range of latitude coordinates of the grid to return. Default `c(-180, 180)`.

- crs
target coordinate reference system: object of class 'sf::crs', or input string for `sf::st_crs`. Default `4326`.

- add_lonlat
logical, should merra-points coordinates (`lon`, `lat`) be added to the data. FALSE by default.

- add_poles_points
logical, in the case of "polygons" grid, should points at poles be added to the data. TRUE by default.

- ...

## Value

Returns `sf` object with MERRA-2 grid, points or polygons. If polygons requested, grid of will be returned where MERRA2 coordinates are considered as centers of every polygon, except cells with `lat = -90` or `lat = 90`. Spatial points will be returned for the cells near poles.

## Examples

```
x <- get_merra2_grid()
#> Error in st_as_sf(x): could not find function "st_as_sf"
head(x)
#> Error in eval(expr, envir, enclos): object 'x' not found
getGrid("poly", "sf")
#> Error in getGrid("poly", "sf"): could not find function "getGrid"
getGrid(lon = c(-70, -60), lat = c(30, 40), class = "df")
#> Error in getGrid(lon = c(-70, -60), lat = c(30, 40), class = "df"): could not find function "getGrid"
```