How to Regrid the netcdf data in order to achieve smaller/greater spatial resolution?
조회 수: 16 (최근 30일)
이전 댓글 표시
I have a netcdf file with 0.5*0.5 degree (Lat*Lon) grided resolution for precipitation from 1982-2015 in all around the globe. now I want to interpolate (regrid) this file to 0.25*0.25 degree without changing the time. In fact I want to interpolate the precipitation data in 0.25*0.25 lat and lon.
please help me with this issue. If it is possible a sample code can really helpful for me.
Best Regards,
Behzad
댓글 수: 1
Umi Pollmann
2021년 5월 11일
Has this issue been resolved? I face the same issue at the moment. Thank you.
답변 (2개)
Chad Greene
2019년 10월 7일
Hey Behzad,
This is pretty straightforward: Just use interp2.
When reading the data from the NetCDF file you might need to rotate and flip the grid to get the orientation right, but then let longitude act as the x variable and let latitude act as the y variable.
[lati,loni] = cdtgrid(1/4);
or you can create it manually by
[loni,lati] = meshgrid(min(lon):1/4max(lon),max(lat):-1/4:min(lat));
Then use interp2 like
zi = interp2(lon,lat,z,loni,lati);
Hope that helps.
댓글 수: 3
O.Hubert
2022년 3월 16일
You probably figured it out by now, but the error you have arises because you try to transpose a 3-dimensional array (longitude, latitude, time) using a shorthand for 2-dimensional arrays. If you want to transpose longitude and latitude without touching the time dimension, use:
new_array = permute(old_array,[2 1 3]);
abbas zoulikha
2020년 11월 11일
i have the same error in my script how did you resolved this errors ?
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 NetCDF에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!