demresizedocumentation

demresizeworks likeimresize, but also resizes corresponding map coordinates.

Back to Climate Data Tools Contents

Contents

Syntax

[Zr,xr,yr] = demresize(Z,x,y,sc) [Zr,xr,yr] = demresize(...,'method') [Zr,xr,yr] = demresize(...,'Name',Value,...)

Description

[Zr,xr,yr] = demresize(Z,x,y,sc)resizes Z usingimresize,和相应的向量或2 d网格坐标xandyto a scalar scalesc.

[Zr,xr,yr] = demresize(...,'method')specifies an interpolation method. Default is'bicubic'.

[Zr,xr,yr] = demresize(...,'Name',Value,...)specifies any input name-value pairs accepted byimresize.

Example:

Consider this 20x20 grid:

[X,Y,Z] = peaks(20); X = X+10;% (for clear distinction from y)figure imagescn(X,Y,Z)

These black dots mark the center points of each pixel in the 20x20 grid:

holdonplot(X,Y,'k.')

Let's suppose you want to resize the grid to 1/3 of its original grid resolution. Here's how you would do that:

[Zr,Xr,Yr] = demresize(Z,X,Y,1/3);% Plot as scatter circles with black edge markers:scatter(Xr(:),Yr(:),100,Zr(:),'filled','markeredgecolor','k')

Or if you prefer to see the new grid as its ownimagescnplot:

figure imagescn(Xr,Yr,Zr)

Author Info

This function is part of theClimate Data Toolbox for Matlab. The function and supporting documentation were written by Chad A. Greene of NASA's Jet Propulsion Laboratory.