Nearest
GRIB.jl wraps the ecCodes functions for finding points that are close to a given point.
API
GRIB.Nearest
— MethodNearest(handle::Message)
Create a Nearest from a Message.
GRIB.Nearest
— MethodNearest(f::Function, handle::Message)
Create a Nearest from a Message and automatically destroy when finished.
Example
Nearest(handle) do near
find(near, handle, inlat, inlon)
end
GRIB.find
— Functionfind(near::Nearest, handle::Message, inlon::Float64, inlat::Float64; samepoint=true, samegrid=true)
Find the nearest 4 points to the given point sorted by distance.
Setting samepoint and samegrid to true (default) speeds up the calculation but restricts the point and grid, respectively, from changing from call to call. Distance is in kilometers.
Example
Nearest(handle) do near
lons, lats, values, distances = find(near, handle, inlon, inlat)
end
GRIB.findmultiple
— Functionfindmultiple(handle::Message, inlons::Vector{Float64}, inlats::Vector{Float64}; islsm=false)
Find the nearest point to each point given.
Setting islsm to true finds the nearest land point and only works when handle
represents a land-sea-mask. Distance is in kilometers.
Example
lons, lats, values, distances = findmultiple(handle, inlons, inlats)
GRIB.destroy
— MethodSafely destroy a nearest object.