Re-sizing matrixes extracted from NetCFD files
Show older comments
Hi all,
I am facing a problem to which I can't seem to find a fitting answer in the already posted Q&A.
I have extracted data (temperature and population) from NetCFD files coming from several global models and global climate models (i.e. different resolutions) and find myself with several 2D matrixes (lat*lon).
Here is my problem:
I need to resize the matrixes coming from higher resolution models to fit the size of the ones with lower resolution.
Yet there's a twist:
- I need to go from a 320*180 population matrix (data_pop) to a 192*145 one (data_pop_new): I therefore need to reduce the size without loosing any data (the lower resolution matrix needs to display more or less the same total population).
- I need to go from a 320*160 temperature matrix (data_tas) to a 192*145 one (data_tas_new): I therefore need to reduce the size and to average the data instead of adding it (as temperature data don't add themselves).
The problem is therefore twofold : (i) how to resize a matrix to an odd size which isn't a perfect multiple of the original size, and (ii) how to do it either by averaging the data, or by adding the data.
A sample code of the manipulation to do would be truly helpful.
Thank you in advance.
Accepted Answer
More Answers (1)
Walter Roberson
on 28 Jun 2021
1 vote
To resize a matrix while keeping the totals the same, resize the matrix first, calculate the total of the resized, and then multiply the resized matrix by old_total/new_total
1 Comment
TIMOTHEE DE TOLDI
on 28 Jun 2021
Categories
Find more on Climate Science and Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

