Re: Regrid variable of byte

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri Apr 26 2013 - 11:59:00 MDT

For categorical data, the best way would be as you suggest:
"using the most common occurred value" (ie, the 'mode').

To my knowledge, there is no NCL function/procedure that
does this. You would have to write this yourself.

An alternative would be to use the nearest neighbor.

[1] Let 'x' contain your categorical data and lon/lat be the grid.
     Let LON/LAT be the target grid then

      d = grid2triple (x&lon,x&lat,x)
      grid = triple2grid(d(1,:), d(0,:), d(2,:), LON,LAT, False)
      grid!0 = "lat"
      grid!1 = "lon"
      grid&lat = LAT
      grid&lon = LON
      grid@long_name = "..."
      printVarSummary(grid)

http://www.ncl.ucar.edu/Document/Functions/Built-in/grid2triple.shtml
http://www.ncl.ucar.edu/Document/Functions/Built-in/triple2grid.shtml

On 4/26/13 11:14 AM, Jiang, Lifen wrote:
> Dear NCL members,
>
> I have a data file of two dimensions (lat and lon) about global biomes. The resolution is 0.083° × 0.083° and variable type is byte. Different values stand for different biome types, e.g. "1" refers to tropical forests.
>
> I am wondering if I can regrid this data file to 1° × 1°, by replacing the values in these grid cells with the most common occurred value. For example, if the highest frequency occurred in these grids is “1”, then the final value for this grid cell after regridding is “1”.
>
> Thank you for your help!
>
> Best regards,
>
> Lifen
>
>
>
> _______________________________________________
> 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 Fri Apr 26 11:59:03 2013

This archive was generated by hypermail 2.1.8 : Fri Apr 26 2013 - 17:10:25 MDT