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

1 Ansicht (letzte 30 Tage)
Beder
Beder am 9 Jan. 2017
Bearbeitet: Beder am 23 Feb. 2017
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 Kommentare
Walter Roberson
Walter Roberson am 23 Feb. 2017
How about if the block size was (say) 3 1/3, then how would that go?
Beder
Beder am 23 Feb. 2017
Bearbeitet: Beder am 23 Feb. 2017
(1+2+3+5/(1/3))/(3 1/3)
(5 2/3 + 6+7+ 9 2/3)/(3 1/3)

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Stephen23
Stephen23 am 10 Jan. 2017
Bearbeitet: Stephen23 am 10 Jan. 2017
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