[MITgcm-support] interpickups.m

Ed Hill ed at eh3.com
Fri Oct 14 16:03:12 EDT 2005


On Fri, 2005-10-14 at 14:59 -0400, Nicolas Wienders wrote:
> 
> Hello, is there anybody here?  ;-)
> 
> 
> I am wondering if someone would have a version of the interpolation
> script which would take care of the presence of boundaries (the values
> set at zero, instead of NaN, have a tendency to stain/spread on the  
> interior fields).

Hi Nicolas,

I'm not familiar with the interpickups.m code.

But I do have two suggestions for interpolating when dealing with
coastlines.

  Case 1: "Essentially 1D"
    Interpolating values at mass points to velocity points 
    (and vice-versa) is an essentially 1D operation.  One 
    quick way to do it in MatLAB is to use linear 
    interpolation with a coastline mask such as:

    %  Get T values on the U,V grid points
    masku = 1.0 - abs(diff(double(tcubep1(2:nip1,:,:) == 0.0),1,2));
    maskv = 1.0 - abs(diff(double(tcubep1(:,2:nip1,:) == 0.0),1,1));
    diffu = 0.5*diff(tcubep1(2:nip1,:,:),1,2);
    diffv = 0.5*diff(tcubep1(:,2:nip1,:),1,1);
    tonu = tcube(:,:,:) + masku.*diffu;
    tonv = tcube(:,:,:) + maskv.*diffv;

    which is a part of the script at:

      http://mitgcm.org/cgi-bin/viewcvs.cgi/MITgcm_contrib/high_res_cube/eddy_flux/calcUVBave.m


  Case 2: "Fully 2D"
    A quick and *approximate* way to deal with interpolation at 
    coastlines in 2D fields is to use an inverse-distance-weighted 
    nearest-neighbors interpolation algorithm (which can estimate 
    values everywhere, including land points!) and then, afterward, 
    mask out the values that are not within the ocean.  If 
    implemented correctly, land values will be ignored and only the 
    nearest ocean values will be used to provide interpolations.  
    This method has its own sorts of artifacts/biases but its much 
    better than the "bleeding" or "smearing" that you describe.

Ed

-- 
Edward H. Hill III, PhD
office:  MIT Dept. of EAPS;  Rm 54-1424;  77 Massachusetts Ave.
             Cambridge, MA 02139-4307
emails:  eh3 at mit.edu                ed at eh3.com
URLs:    http://web.mit.edu/eh3/    http://eh3.com/
phone:   617-253-0098
fax:     617-253-4464




More information about the MITgcm-support mailing list