I need to regrid temperature dataset from 1 degree to 0.5 degree. In case we have data available for all grids falling in a square, as shown below, we can simply regrid it using bilinear/bicubic interpolation method in MATLAB.

enter image description here

But, the data grids which I have forms an irregular shape i.e., there are no values outsie the given grids as shown below.

enter image description here

How to do regriding in this case ?

  • 1
    $\begingroup$ I'm afraid that it depends on the application. What kind of interpolation and extrapolation you are using and what the border represents. Is there e.g heat flux to cells not included in your model or is it a closed system? $\endgroup$
    – user2821
    Aug 16, 2015 at 22:33
  • $\begingroup$ I am trying to regrid temperature. Border represent the state or county. There are no fluxes. $\endgroup$
    – dsbisht
    Aug 17, 2015 at 7:09
  • $\begingroup$ I suspect your general approach should be to find the concave hull of your original points, then do any form of interpolation (provided it ignores missing values rather than treating them as zero), and then use that concave hull as a mask to remove unwanted points. The tricky part, though, is the concave hull - I don't know how to do that in Matlab, which is why I'm not putting this as an answer. $\endgroup$ Aug 17, 2015 at 15:36
  • $\begingroup$ It's been a while since I've done it, but I believe the GrADS program is pretty good with various regridding... and you can use a mask to prevent spillover onto points you don't want. $\endgroup$ Mar 12, 2017 at 21:18
  • $\begingroup$ Would you consider other tools than Matlab? I know how to do this in R, there is a function that allows interpolation into an irregular grid. $\endgroup$
    – Janina
    Mar 13, 2017 at 14:48

2 Answers 2


Try something like this:

[x_grid,y_grid] = meshgrid(1:100,1:100);

You can change the method of interpolation if you prefer something else.

See: http://www.mathworks.com/help/matlab/ref/griddata.html


Did you try inpainting methods? Inpainting methods try to replace missing data using the existent data. I suggest you check the inpaint_nans.m function in fileexchange.

For example

 [x,y] = meshgrid(0:.01:1);
 z0 = exp(x+y);
 znan = z0;
 znan(20:50,40:70) = NaN;
 znan(30:90,5:10) = NaN;
 znan(70:75,40:90) = NaN;

 z = inpaint_nans(znan);

figure,imagesc(znan),axis image
figure,imagesc(z),axis image

enter image description here

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.