How to Regrid the netcdf data in order to achieve smaller/greater spatial resolution?
12 次查看(过去 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 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!