How to shrink Matrix eg. 10830:21600 -> 361:576

1 次查看(过去 30 天)
Hello Matlab Community, today I'm asking you for support in one specific problem I have here. I did not find any solution yet on this topic
I have elevation data (Etopo1 Global, cell registered) with 21600x10800 data points. resolution: 1arc minute
I also have a grid (Merra2, Nasa) of 576x361 data points. [-180,179 3/8][-90,90]degrees, resolution: 0.625°×0.5°.
Now I want to get an average elevation of each gridelement of Merra2.
This means, that I need to get an average of a matrix 40x37.5.
I have absolutely no idea to get this out of matlab. Ideally I could find a solution that is more flexible and could deal with completely flexible output-raster.
It is acceptable to have not 100% correct values at the south pole and at one lon-line. Is there anybody out there who can help me? Since these calculcations don't have to be performed on a regular basis, it is okay to run it within a for-loop :)
Any help is welcome. Thank you very much.
Kind regards
  13 个评论
Walter Roberson
Walter Roberson 2017-2-23
How about if the block size was (say) 3 1/3, then how would that go?
Beder
Beder 2017-2-23
编辑:Beder 2017-2-23
(1+2+3+5/(1/3))/(3 1/3)
(5 2/3 + 6+7+ 9 2/3)/(3 1/3)

请先登录,再进行评论。

回答(1 个)

Stephen23
Stephen23 2017-1-10
编辑:Stephen23 2017-1-10
If you want to interpolate (i.e. estimate values based on a fitted curve) then use one of the interpolation tools:
If you want to apply a function to blocks of data (e.g. the mean of each block) then use blockproc:
You could try using this FEX submssion (by the way, Matt J writes very good code):

Community Treasure Hunt

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

Start Hunting!

Translated by