How to use spline interpolation for raster data with a specific condition?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, I have a NetCDF file from satellite-based rainfall measurement (please look at attached file). Each grid is located in the cell's center. I would like to do spline interpolation with a specific condition.
Spline interpolation by default impose the following two conditions, 1) the surface passes exactly through the data points and 2) The surface must have minimum curvature.
But in this case, I also would like to use an extra constraint. The constraint is that the interpolated values of each pixel must exactly fit the corresponding satellite pixel value. In another word, the value of each satellite pixel must be equal to the average of all interpolated values within that pixel.
% The precipitation map for the original satellite data
file = '3B-DAY.MS.MRG.3IMERG.20150903-S000000-E235959.V05.nc4.nc' ;
pre = ncread(file, 'precipitationCal') ;
lon = ncread(file, 'lon') ;
lat = ncread(file, 'lat') ;
figure
map = pcolor(lon, lat, pre) ;
colorbar
The distance between each grid of the satellite is 0.1 degree and after interpolation, the distance would be 0.001 degree and LatitudeLimits = [46.6 49.1], LongitudeLimits = [13.9 17.3].
The code for spline interpolation I have done so far can be seen below:
% The precipitation map for interpolated precipitation data
[xq , yq] = ndgrid(1:0.01:length(lat), 1:0.01:length(lon)) ;
F = griddedInterpolant(pre, 'spline') ;
Vq1 = F(xq,yq);
figure
map_2 = pcolor(yq,xq,Vq1) ;
set(map_2,'EdgeAlpha', .0 ) ;
colorbar
1 Kommentar
Unai San Miguel
am 9 Jul. 2018
I don't think I have undesrtood the question. You would like to have in F what you plot in map?
Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!