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

조회 수: 1 (최근 30일)
Beder
Beder 2017년 1월 9일
편집: Beder 2017년 2월 23일
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