Hi YOlivo,
The issue in regridding your data from a 2km to 10km domain arises because a 10km grid cell corresponds to a 5x5 block of 2km cells, You will need to aggregate those blocks to obtain your new coarser grid.
Here are the steps to follow:
- Check that your original 2km data dimensions are multiple of 5
[nLat_2km, nLon_2km] = size(Z_2km);
if mod(nLat_2km, 5) ~= 0 || mod(nLon_2km, 5) ~= 0
error('Dimensions are not multiples of 5. Cannot block-average cleanly.');
- Reshape your data into bock of 5x5
Z_reshaped = reshape(Z_2km, 5, nDivLat, 5, nDivLon);
- Compute the average over each 5x5 block
Z_10km = squeeze(mean(mean(Z_reshaped, 1), 3));
- Construct the new latitude/longitude arrays
lat_10km = lat_2km(1:5:end);
lon_10km = lon_2km(1:5:end);
For a better understanding of the above solution, refer to the following MATLAB documentations:
- reshape : https://www.mathworks.com/help/matlab/ref/double.reshape.html
- mean : https://www.mathworks.com/help/matlab/ref/mean.html
- squeeze : https://www.mathworks.com/help/matlab/ref/squeeze.html