Re: Regridding from low to high resolution ?

From: Daran Rife <Daran.Rife_at_nyahnyahspammersnyahnyah>
Date: Wed Apr 18 2012 - 13:20:59 MDT

Hi Noel,

As usual, Dennis is right about this.

Interpolation and/or simple averaging are not appropriate for
categorical
data. Consider Dennis' example of various land classifications (desert,
forest, glacier, etc.). Even if we assigned a numerical value to these
categories (e.g., desert = 1, forest = 2, glacier = 3) it would be
meaning-
less to compute average values. For example, what would 1.5 represent?

Granted, we could choose the data categories to avoid large gaps between

adjacent category indices, and if "nearby" indices represent similar or
nearby categories, then a (weighted) average may be a good choice,
because
it may be "close" to what an ideal regridded value should represent.

The solution Dennis proposed will probably work well, so long as the
source grid and destination grid are not greatly dissimilar. However, in
the case where the grid increments are "very different" (say coarsening
your source data by 50%), then you need to determine the "dominant"
category is within each of your destination grid cells. The most
straight
forward way to do this is to calculate the most frequently occurring
category (i.e., the mode) in each new grid cell.

It would be fairly straight forward to code this in NCL, though it might
be a bit slow. As an alternative, Climate Data Operators has a built-in
function called remaplaf for regridding categorical data. Provided your
input data are in one of the supported data formats (netCDF, HDF, GRIB
1/2), CDO might be a good option.

https://code.zmaw.de/embedded/cdo/1.5.4/cdo.html#x1-4880002.12.1
https://code.zmaw.de/boards/1/topics/925

I hope this helps.

Daran

--
Date: Wed, 18 Apr 2012 11:21:37 -0600
From: Dennis Shea <shea@ucar.edu>
Subject: Re: Regridding from low to high resolution ?
To: Noel Aloysius <noel.aloysius@gmail.com>, 	Madeleine Patterson
	<madeleine.patterson77@gmail.com>
Cc: ncl-talk <ncl-talk@ucar.edu>
Message-ID: <4F8EF821.4050609@ucar.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
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
Received on Wed Apr 18 13:21:14 2012

This archive was generated by hypermail 2.1.8 : Fri Apr 20 2012 - 16:21:18 MDT