Use the function
http://www.ncl.ucar.edu/Document/Functions/Contributed/area_hi2lores_Wrap.shtml
Erik Noble wrote:
> Hi. I am trying to use the nearest neighbor technique to regrid TRMM 
> precipitation observations from a .25x.35 degree grid to a .5x.5 degree 
> grid.
> Is the the triple2grid function the recommended NCL function to use for 
> this purpose?
> 
> If so, I've tried using the technique in this example to regrid the data 
> (http://www.ncl.ucar.edu/Applications/Scripts/narr_3.ncl) , but I keep 
> running into this error:
> fatal:triple2grid: The length of x and y must be the same as the 
> rightmost dimension of z
> 
> my command is this:
>  rNEW(ii,:,:) = triple2grid(ndtooned(lon2d), ndtooned(lat2d), ndtooned( 
> r(ii,:,:)),lon,lat,False)
> 
> Does this mean that lon2d and lat2d must be the same size?
> My command line code is below. Thank you for you help.
> Erik
> 
> 
> noble:TRMM3B42 enoble$ ncl
>  Copyright (C) 1995-2009 - All Rights Reserved
>  University Corporation for Atmospheric Research
>  NCAR Command Language Version 5.1.0
>  The use of this software is governed by a License Agreement.
>  See http://www.ncl.ucar.edu/ for more details.
> ncl 0> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> ncl 1> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> ncl 2> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> ncl 3> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
> ncl 4> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
> ncl 5> a = addfile("TRMM_SOP3_0.25_res.nc 
> <http://TRMM_SOP3_0.25_res.nc>","r")
> ncl 6> r=a->precipitation
> ncl 7> printVarSummary(r)
> 
> 
> Variable: r
> Type: float
> Total Size: 71424000 bytes
>             17856000 values
> Number of Dimensions: 3
> Dimensions and sizes: [time | 31] x [lat | 400] x [lon | 1440]
> Coordinates: 
>             time: [1..31]
>             lat: [-49.875..49.875]
>             lon: [-179.875..179.875]
> Number Of Attributes: 1
>   _FillValue : -999
> ncl 8> lat2d =a->lat
> ncl 9> lon2d =a->lon
> ncl 11> printVarSummary(lat2d)
> 
> 
> Variable: lat2d
> Type: float
> Total Size: 1600 bytes
>             400 values
> Number of Dimensions: 1
> Dimensions and sizes: [lat | 400]
> Coordinates: 
>             lat: [-49.875..49.875]
> Number Of Attributes: 0
> 
> ncl 19> print(" min="+min(lat2d)+"   max="+max(lat2d))
> (0)      min=-49.875   max=49.875
> ncl 20> print(" min="+min(lon2d)+"   max="+max(lon2d))
> (0)      min=0.125   max=359.875
> 
> 
> ncl 23> w = r(:,{7:18},{-20:-10}) 
> ncl 24> NLAT = 200
> ncl 25> MLON = 720
> ncl 27> lat = ispan(0,NLAT-1,1)*0.50 - 49.875   
> ncl 28> lon = ispan(0,MLON-1,1)*0.50 - 179.875   
> ncl 29> lat!0         = "lat"
> ncl 30>   lat_at_units     = "degrees_north"
> ncl 31>   lat&lat       = lat
> ncl 32> lon!0         = "lon"
> ncl 33>   lon_at_units     = "degrees_east"
> ncl 34>   lon&lon       = lon
> ncl 35> rNEW = new ((/31,NLAT,MLON/),typeof(r),getFillValue(r)) 
> ncl 36> rNEW!0 = "Time"
> ncl 38> rNEW&Time = ispan(1,31,1) 
> ncl 39> rNEW!1 = "lat"
> ncl 40> rNEW&lat = lat
> ncl 41> rNEW!2 = "lon"
> ncl 42> rNEW&lon = lon
> ncl 47> do ii = 0,30 
> ncl 48> rNEW(ii,:,:) = triple2grid(ndtooned(lon2d), ndtooned(lat2d), 
> ndtooned( r(ii,:,:)),lon,lat,False)
> ncl 49> end do
> fatal:triple2grid: The length of x and y must be the same as the 
> rightmost dimension of z
> fatal:Execute: Error occurred at or near line 48
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> 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 Sun May 10 2009 - 17:33:47 MDT
This archive was generated by hypermail 2.2.0 : Mon May 11 2009 - 09:43:46 MDT