フィルターのクリア

How to do matrix regridding in matlab

10 ビュー (過去 30 日間)
Anne
Anne 2018 年 4 月 4 日
コメント済み: xinyu dong 2019 年 7 月 19 日
Hello, I am trying to use matlab to regrid a dataset. The original dataset is 128x193x12 (longitude x latitude x time) and I want to regrid it to a 180x193x12 matrix. I have the latitude of the original dataset as a 64x1 single (Dust_Data_lat), the longitude as a 128x1 single (Dust_Data_lon). For the 'final' grid (180x193x12), I have a latitude matrix 180x193 (constant columns, DUST_IN_lat) and a longitude matrix 180x193 (constant rows, DUST_IN_lon). I think the function griddata is best for this as the grid is irregular. If I try however, it complains about 'Z', which I don't know, see here for the first time dimension of the data:
a=Dust_LGM(:,:,1);
data_regridded = griddata(Dust_Data_lon,Dust_Data_lat,a,DUST_IN_lon,DUST_IN_lat);
The error I get is:
Error using griddata (line 109)
The lengths of X and Y must match the size of Z.
Would you know where the mistake is?
  2 件のコメント
Matt J
Matt J 2018 年 4 月 4 日
You should close your previous question by accept-clicking Jos' answer, since it appears you were happy with that answer. This will increase the likelihood of responses to future questions.
Anne
Anne 2018 年 4 月 5 日
Ok, thanks for letting me know!

サインインしてコメントする。

回答 (1 件)

Matt J
Matt J 2018 年 4 月 6 日
編集済み: Matt J 2018 年 4 月 6 日
In griddata(x,y,z,xq,yq) the input arrays x,y,z must have the same number of elements. You have 128*193=24704 elements in a. You must therefore have 24704 corresponding elements in both Dust_Data_lon and Dust_Data_lat.
  15 件のコメント
Anne
Anne 2018 年 9 月 22 日
Hey Yoichi, thank you for your suggestion. This post is already very old, and I learned CDO and NCO to handle netcdf data in a more efficient way. I can recommend them to anyone that has to analyze/regrid/handle a lot of netcdf files:)
xinyu dong
xinyu dong 2019 年 7 月 19 日
Hey Anne. I am struggling how to regrid with lon and lat right now. Do you have any recommandation? Thank you very much!

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by