Calculate mean and standard deviation from 30-years of global wind data

I have a dataset of global 1-degree latitude, longitude, and wind data for 30 years. I'd like to create a 3-d matrix of mean wind data for each latitude and longitude point for each of the 30 years (matrix size 180x360x30) then find the standard deviation of mean wind at each lat/long based on the 30 years of data.
So let's say I have a 40,000 data points (i=40000) that include year(i), latitude(i), longitude(i), and wind(i). What's the best streamlined approach to creating this new 3-d dataset (mean wind) and finding the standard deviation for each 1-degree grid cell?

 Respuesta aceptada

Matt J
Matt J el 27 de En. de 2026
Editada: Matt J el 28 de En. de 2026
This might be what you are looking for,
subs=[lat(:),lon(:),year(:)];
val=wind(:);
siz=[180,360,30];
meanWind = acummarray(subs,val,siz,@mean);
stdWind = std(meanWind,[], 3);

2 comentarios

This looks like it's on the right track. I'm a little lost on getting the lat/long to the appropriate place within the size array. Here's an example of the output for the first 10 lines of the subs array:
17.0000000000000 -78.0000000000000 2025
17.0000000000000 -77.0000000000000 2025
18.0000000000000 -77.0000000000000 2025
18.0000000000000 -77.0000000000000 2025
19.0000000000000 -76.0000000000000 2025
20.0000000000000 -75.0000000000000 2025
22.0000000000000 -75.0000000000000 2025
23.0000000000000 -74.0000000000000 2025
24.0000000000000 -73.0000000000000 2025
26.0000000000000 -72.0000000000000 2025
I'll need to connect each lat/long combo to the appropriate place of the size array (e.g., the first line 17N and 78W will be at 107,282 on the 180x360 grid). Seems like an extra step?
lat=lat+90;
lon=mod(lon,360);

Iniciar sesión para comentar.

Más respuestas (1)

Consider using groupsummary, specifying the groupbins input argument to control how the data is discretized into bins.

Categorías

Productos

Versión

R2021b

Preguntada:

el 27 de En. de 2026

Comentada:

el 28 de En. de 2026

Community Treasure Hunt

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

Start Hunting!

Translated by