surrounding_points_indexes
- surrounding_points_indexes(fs, lats, lons[, mode])
- surrounding_points_indexes(fs, location[, mode])
Returns the indexes of the gridpoints surrounding the given location (or locations) in
fs
.- Parameters
fs (
Fieldset
) – input fieldsetlats (number or ndarray) – target latitude(s)
lons (number or ndarray) – target longitudes(s)
location (list) – single target location defined as a list of [lat, lon]
mode (str) – specifies the way missing values are handled. The only allowed value is “all”.
- Return type
ndarray
fs
must be a gridded field.The location(s) can be specified in the following ways:
location
defines a single location.lats
andlons
can define either a single location (as number) or multiple locations (as ndarray).
By default the 4 surrounding gridpoint indexes are returned. The only exception is when a field is defined on a Gaussian grid and the input location is near the North or South pole, beyond the most extreme row of points. In this case there will be a ‘circle’ of surrounding points, and all of these indexes are returned.
If any of the surrounding points are missing,
surrounding_points_indexes()
will return nan. To prevent this, and to return all the points regardless, optionmode
has to be set to “all”.Note
See also
nearest_gridpoint()
,nearest_gridpoint_info()
andinterpolate()
.