Using scatteredinterpolant instead of griidedinterpolant
Show older comments
I have a spatial data of fine resolution in gridded format of a CSV file. I want to use griddedinterpolant function and upscale into a little coarser format. But when I created a meshgrid with the source data lat-lon points, it has become unresponsive stating the generated grid is 28GB memory and MATLAB cannot process such huge data. So is the case when I used interp2. When I tried scatteredinterpolation function, it worked like a charm. Output files have been generated with more or less satisfying results. My question is what to do when we cannot use griddedinterpolant for gridded data of very fine spatial resolution? Is scatteredinterpolant safe to use as an alternative to griddedinterpolant in such cases?
Thank you in advance.
3 Comments
Is scatteredinterpolant safe to use as an alternative to griddedinterpolant in such cases?
scatteredInterpolant() is wrong as an alternative for 2 reasons.
(1) It is generally slower and more computationally demanding than gridded interpolation.
(2) You will now go around falsely believing that griddedInterpolant works poorly, just because you had an easier time getting scatteredInterpolant to work.
Hitesh Bugata
on 27 Sep 2020
Hitesh Bugata
on 27 Sep 2020
Accepted Answer
More Answers (2)
Image Analyst
on 27 Sep 2020
0 votes
Why not simply use imresize()?
4 Comments
John D'Errico
on 27 Sep 2020
One of those tools that I would automatically assume requiires the IPT. It is part of MATLAB proper though.
Hitesh Bugata
on 27 Sep 2020
Image Analyst
on 27 Sep 2020
You said " My question is what to do when we cannot use griddedinterpolant for gridded data of very fine spatial resolution?" so do you have gridded data (a 2-D matrix) or not? I always use scatteredInterpolant() because it's the more general of the functions and will work in all cases. Why do you say you can't use griddedIterpolant for very fine spatial resolution? What is en example of that situation?
Hitesh Bugata
on 27 Sep 2020
But when I created a meshgrid with the source data lat-lon points.
You should not create a meshgrid, since it consumes unnecessary memory. You should use the grid vector syntax,
F = griddedInterpolant({x,y},z);
It may also interest you to know that what you are trying to do has already been implemented for you in the File Excahge submission imresizen(),
Unlike imresize(), it requires no toolboxes, but it also doesn't have any of the fancy pre- and post- filtering that imresize uses to improve the quality of the downsampling.
Categories
Find more on Geographic Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!