Interp2 usage with Coordinates
Show older comments
Hello,
I have two data sets: a sea surface salinity product for the southern ocean, in a 38 x 1388 x 12 3D Array, in which the data is in 25km x 25km grid (arranged by Lat, Lon, Month). I also have an ocean mixed layer depth product for the Southern Ocean in a 41 x 720 x 12 3D Array, in which data is in a 0.5 degree x 0.5 degree grid (again arranged by lat, lon , month). In order to calculate the salinity budget I have to get these 2 data sets on to the same grid (AKA: the latitudes and longitudes need to match).
This is the code I am using to try and translate the data across onto a grid with the same coordinates as january_clim_sss (sss= sea surface salinity, mld is mixed layer depth)

I have tried this multiple times, switiching around the x ad y values, and each time get the following error notification:
Error using griddedInterpolant
Sample points vector corresponding to grid dimension 1 must contain 720 elements.
Error in interp2>makegriddedinterp (line 226)
F = griddedInterpolant(varargin{:});
Error in interp2 (line 126)
F = makegriddedinterp({X, Y}, V, method,extrap);
Error in GRIDDING (line 1)
january_mld_cor=interp2(lat_sss_so,lon_sss_so,January_Mld,lat_mld_so,lon_mld_so);
Can anyone help me with this issue?
Thanks in advance!!
Accepted Answer
More Answers (0)
Categories
Find more on Oceanography and Hydrology 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!