Re: Regrid variable of byte

From: Jiang, Lifen <lfjiang_at_nyahnyahspammersnyahnyah>
Date: Fri Apr 26 2013 - 12:07:12 MDT

Dear Dennis,

Thank you for your reply! I will try.

BTW, the codes you gave me about my error for global sum work for me. Thank you again!

Best,

Lifen


2013-04-26



Jiang, Lifen



发件人: Dennis Shea
发送时间: 2013-04-26 12:58:59
收件人: Jiang, Lifen
抄送: ncl-talk
主题: Re: [ncl-talk] Regrid variable of byte
 
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 12:07:28 2013

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