How to Regrid the netcdf data in order to achieve smaller/greater spatial resolution?
16 views (last 30 days)
Show older comments
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 Comment
Umi Pollmann
on 11 May 2021
Has this issue been resolved? I face the same issue at the moment. Thank you.
Answers (2)
Chad Greene
on 7 Oct 2019
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 Comments
O.Hubert
on 16 Mar 2022
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
on 11 Nov 2020
i have the same error in my script how did you resolved this errors ?
0 Comments
See Also
Categories
Find more on NetCDF 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!