For categorical data, bilinear interpolation is likely not
appropriate. Consider vegland_1 at
http://www.ncl.ucar.edu/Applications/classification.shtml
If the target grid point is in the middle of 4 points with
categories 16, 10, 1, 2 then bilinear interpolation would
yield 29/4 -> 7.25 -> 7. It is highly unlikely that this
would be the case.
Though slow, I would suggest a 2-step procedure
[1] http://www.ncl.ucar.edu/Document/Functions/Built-in/grid2triple.shtml
to convert the source grid to a triplet.
[2] then
http://www.ncl.ucar.edu/Document/Functions/Built-in/triple2grid.shtml
===
untested ...
undef("regrid_cat")
function regrid_cat (clat[*], clon[*], cgrid[*][*] \ ; categorical grid
,tlat[*], tlon[*]) ; target grid
begin
d = grid2triple (clon,clat,cgrid) ; d(3,ld)
cnew = triple2grid(d(0,:), d(1,:), d(2,:), tlon, tlat, False)
copy_VarAtts(cgrid, cnew) ; contributed.ncl
cnew!0 = "lat"
cnew!1 = "lon"
cnew&lat = tlat
cnew&lon = tlon
return( cnew )
end
On 4/18/12 9:17 AM, Noel Aloysius wrote:
> You can use CDO tools to do this, somthing like
>
> cdo remapbil,1x1grid_target.txt infile.nc <http://infile.nc>
> outfile.nc <http://outfile.nc>
>
> where remapbil does bilinear interpolation (and remapbic is for
> bicubic), 1x1grid_target.txt is the user input file with grid size
> information.
>
> Noel
>
>
> On Wed, Apr 18, 2012 at 11:08 AM, Madeleine Patterson
> <madeleine.patterson77@gmail.com
> <mailto:madeleine.patterson77@gmail.com>> wrote:
>
> Hi All,
>
> I was wondering if there is a low-to-high-resolution function for
> regridding a global map of a categorical variable?
>
> I found all the regridding scripts but they all employ
> interpolation, whereas I just want to 'pixelate' a 2x2.5 deg map to
> a 0.5 x 0.5 degree map...
>
> Does NCL have a function which will do this?
>
> Thanks
>
> M
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Apr 18 11:21:51 2012
This archive was generated by hypermail 2.1.8 : Fri Apr 20 2012 - 16:21:18 MDT