Approach to computing statistics on a latitude/longitude grid

55 views (last 30 days)
I'm looking for suggestions on the best approach to computing statistics on a latitude/longitude grid in MATLAB.
I have a non-gridded dataset with global wind observations (wind magnitude in knots) based on latitude and longitude over 30 years. I want to average that data on some latitude/longitude grid (say 1°x1° grid) then create a density-like plot of those average wind values on a map.
I'm trying to find the most efficient approach to doing this analysis in MATLAB. Thanks.

Answers (2)

Image Analyst
Image Analyst on 20 Oct 2025 at 2:31
I'd probably convert the (lat, lon, speed) into a double matrix (image). Then I'd sum up all the matrices to get the overall average. See attached scatteredInterpolant demo.

Star Strider
Star Strider on 20 Oct 2025 at 3:14
It would probably be best to use Mapping Toolbox functions for this, since on a world map, the latitude and longitude distances would be different at different locations.
It has several interpolation functions, geointerp may be closest to what you want to do, and mapinterp could also be useful. There are also others. (I do not have the Mapping Toolbox, so I have little experience with it.)
Calculating spatial statistics could be a challenge.
There are contour functions (specifically contour3m) that could help to depict those values.
  11 Comments
Star Strider
Star Strider on 21 Oct 2025 at 18:26
I'm not certain that I completely understand.
If your data are in the same locations and simply gathered at different dates and times, and all you want are the statistics on those specific locations (that don't change), then using the mean function (and related functions) will work. There would be no specific need to interpolate them.
Since I doubt that any of the data are ever negative and are all probably greater than zero, they would most likely be lognormally distributed. If so, use the lognormal distribution functions to estimate their means and variances or standard deviations. You can get estimates of the parameters in the original data units from:
lognparms = @(mu,sigma) [exp(mu + sigma^2/2); exp(2*mu + sigma^2) * (exp(sigma^2)-1); exp(mu); exp(mu-sigma.^2)]; % [mean; var; median; mode]
using the returned by the lognormal distribution fitting functions.
.
Cedric Wannaz
Cedric Wannaz on 21 Oct 2025 at 18:41
Edited: Cedric Wannaz on 21 Oct 2025 at 18:45
"With respect to wind magnitude, I assume that also includes direction. It would likely be best to decompose the wind magnitude and direction to individual east-west and north-south components before doing any statistics on them."
Aside from issues related to continuity, this comment from Star Strider is especially important if your are planning on using the summarized data for computing atmospheric mixing/transport/etc. (e.g., in a Eulerian model). Imagine a trivial world where winds go east to west half the time and west to east the other half. Averaging your data in this situation would lead to a wind velocity of 0 (or close), that is no mixing and no transport. In this context, it is often preferable to decompose wind speed+directions or velocities into components u+, u-, v+, v-, before averaging (otherwise we underestimate mixing/transport).

Sign in to comment.

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!