xarray.Dataset.climepi.sel_geo#
- Dataset.climepi.sel_geo(location, lon=None, lat=None, **kwargs)[source]#
Get data for the nearest grid point(s) to a specified location(s).
Finds the nearest grid point(s) using either provided longitude and latitude values, or if these are not provided, using geopy’s
Nominatimgeocoder (uses OpenStreetMap data https://openstreetmap.org/copyright). Returns a dataset with a new “location” coordinate, which is used as a dimension coordinate in place of the lon and lat coordinates if multiple locations are provided.- Parameters:
location (
strorlistofstr) – Name(s) of the location(s) to select. Iflonandlatare not provided, the location(s) will be geocoded using geopy’sNominatimgeocoder, with the location(s) provided used as search strings.lon (
floatorlistoffloat, optional) – Longitude(s) of the location(s) to select. If provided,latmust also be provided. Iflocationis a list,lonandlatmust also be lists of the same length (if provided). If not provided, the location(s) will be geocoded using geopy’sNominatimgeocoder.lat (
floatorlistoffloat, optional) – Latitude(s) of the location(s) to select. If provided,lonmust also be provided. Iflocationis a list,lonandlatmust also be lists of the same length (if provided). If not provided, the location(s) will be geocoded using geopy’sNominatimgeocoder.**kwargs (
dict, optional) – Additional keyword arguments to pass to the geocode method of theNominatimgeocoder.
- Returns:
xarray.Dataset– A new dataset containing the data for the specified location.