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 Nominatim geocoder (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 (str or list of str) – Name(s) of the location(s) to select. If lon and lat are not provided, the location(s) will be geocoded using geopy’s Nominatim geocoder, with the location(s) provided used as search strings.

  • lon (float or list of float, optional) – Longitude(s) of the location(s) to select. If provided, lat must also be provided. If location is a list, lon and lat must also be lists of the same length (if provided). If not provided, the location(s) will be geocoded using geopy’s Nominatim geocoder.

  • lat (float or list of float, optional) – Latitude(s) of the location(s) to select. If provided, lon must also be provided. If location is a list, lon and lat must also be lists of the same length (if provided). If not provided, the location(s) will be geocoded using geopy’s Nominatim geocoder.

  • **kwargs (dict, optional) – Additional keyword arguments to pass to the geocode method of the Nominatim geocoder.

Returns:

xarray.Dataset – A new dataset containing the data for the specified location.