The API endpoint "/wthr/svar/NearestGridData" returns the value of a variable for the nearest values of the forecast grid of specified position and time. In contrast to the /get_value end point, there is no interpolation. In the following example, this means that the value at the position (x,y) is searched for and the value for the position (x1,y2) is returned.
This function is useful for special cases, but in general you should prefer the endpoint /wthr/svar/InterpolatedData, which calculates the most probable value at the position (x,y) from the four surrounding values of the prediction grid.
curl --location -g --request GET 'weather.openportguide.org/api/wthr/svar/NearestGridData?model=gfs&variable=WDIR_10m&level=surface&apiKey={{api-key}}' \
--header 'Host: {{BASE_URL}}'
{"metadata":{"serviceProvider":"weather.openportguide.org","originatingCenter":"US National Weather Service - NCEP (WMC)","generatingProcess":"Global Multi-Grid Wave Model (Static Grids)","model":"gfswave","requestedParameters":"model=gfs, variable=WDIR_10m, level=surface, latitude=None, longitude=None, timestep=None, units=None","shortName":"WDIR","fullName":"Wind Direction (from which blowing)","unit":"°","level":"surface","ny":721,"nx":1440,"latitudeFirstGridpoint":90.0,"latitudeLastGridpoint":-90.0,"longitudeFirstGridpoint":0.0,"longitudeLastGridpoint":359.75,"gridlengthXDirection":0.25,"gridlengthYDirection":-0.25,"refDate":"2025-07-03T12:00:00Z","forecastTime":[0,"2025-07-03T12:00:00Z"],"forecastPosition":[{"latitude":0.0},{"longitude":0.0}],"usedTokens":1},"data":{"value":191.0}}