# Re: Fwd: interpolation gridded data to rcm

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Tue Feb 08 2011 - 10:37:47 MST

http://www.ncl.ucar.edu/Document/Functions/Contributed/obj_anal_ic_deprecated.shtml

If this does not work, you will have to write your own
interpolation function.

Good luck

On 2/8/11 9:46 AM, Debasish wrote:
>
> Dear Dennis
>
>
>> I am not clear what you mean by
>> "interpolate 2d randomly-spaced data to
>> another 2d randomly-spaced data or 2d randomly
>> spaced data to directly RCMs grid"
>>
> My primary aim is to interpolate 2d random spaced data to RCM grid
>
> For example, I have 2d random spaced data x(npts) with lat(npts) and
> lon(npts). I would like to interpolate the data to RCM grid i.e.
> lat2d(m,n) and lon2d(m,n) and interpolated output should be xint(m,n)
>
> I believe there is two ways to solve this
>
> [1]
> direct interpolation of 2d random spaced data on to RCM grid
>
> [2]
> First interpolate 2d random spaced data to another 2d random spaced data
> and then convert new random space data to RCM grid
>
> Assume, function points2points(X[*],Y[*],z[*].X1[*],Y1[*],opts:logical)
>
> step1: lat1d = ndtooned(lat2d)
> lon1d = ndtooned(lon2d)
>
> step2: xint1d = points2points(lon(npts),lat(npts),x(npts),lon1d(m x n),
> lat1d(m x n), opts)
>
> step3: xint = onedtond(xint1d, (/yc,x/))
>
>> ---
>>
>> There is a function in NCL' contributed.ncl that may work.
>> Like "natgrid" this can be slow!!!!
>>
>> function obj_anal_ic_deprecated(X[*],Y[*],Z[*],lon:numeric,lat:numeric \
>> ,dcrit[*]:numeric, opt:logical)
>>
>> ===
>> opt = 0
>> zrcm = obj_anal_ic_deprecated(loni,lati,zi, dcrit, lon2d,lat2d, opt)
>>
>> input: loni[*], lati[*], zi[*]
>>
>> output: lon2d[*][*], lat2d[*][*]
>>
>> ; dcrit - 1D array containing successive radii of influence.
>> ; Must be expressed in degrees latitude and should be
>> ; monotonically de. eg: dcrit = (/5, 3/)
>>
> I believe that function "obj_anal_ic_deprecated" will works for me
> however I have few questions regarding the function.
>
> [1]
> Do you know which version the function is created? because when I try to
> use it according to the webpage example
> (http://www.ncl.ucar.edu/Document/Functions/Contributed/obj_anal_ic_deprecated.shtml)
> it does not recognized the function:
> fatal:Undefined identifier: (obj_anal_ic_deprecated) is undefined, can't
> continue
> "\$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" and I am using
> NCL version 5.1.1
>
> [2]
> I would like to clarify that in webpage of the function output lat, lon
> is 1dimensional so I need to follow the method [2] (mentioned above) or
> can I use 2dimension lat (lat2d) and lon(lon2d) too (method[1]). If like
> to use lat2d(m,n) and lon2d(m,n) and corresponding output(m,n), what are
> the modifications?
>
> [3]
> rscan (in webpage) or dcrit (in your script) can be one dimensional
> array of any length or is there any particular reason to choose length 2
> or length 3 with respect to the accuracy
>
> Thank again for your help
>
> Debasish
>
> On 2/7/11 9:59 AM, Debasish wrote:
>>> Hello,
>>>
>>> Thanks Dennis for your suggestion. However I believe the function
>>> "triple2grid2d" places randomly-spaced data onto the nearest
>>> locations of a grid instead of interpolation while I need to do a
>>> interpolation. I also checked
>>> http://www.ncl.ucar.edu/Document/Functions/regrid.shtml but did not
>>> find any function that can interpolate randomly-spaced data to
>>> another randomly-spaced data or RCMs grid.
>>>
>>> Therefore, I would like to know is there any function or any way in
>>> NCL to interpolate 2d randomly-spaced data to another 2d
>>> randomly-spaced data or 2d randomly spaced data to directly RCMs grid.
>>>
>>> Any help in this regard will be appreciated and sorry for any
>>> inconvenience
>>>
>>> Thanks
>>>
>>> Debasish
>>>
>>>
>>>
>>>
>>> On 2011-02-03, at 14:36, Dennis Shea wrote:
>>>
>>>> You would have to convert to ascii, the use asciiread.
>>>>
>>>> "natvar" is high quality but is known to be slow.
>>>>
>>>> Really, if you have a large number of high res\
>>>> grids you need interpolated to an RCM grid,
>>>> there is not magic bullet. it will take time.
>>>>
>>>> The following *may* be useful.
>>>>
>>>>
>>>> http://www.ncl.ucar.edu/Document/Functions/Built-in/triple2grid2d.shtml
>>>>
>>>> Good luck
>>>>
>>>> On 2/3/11 12:02 PM, Debasish wrote:
>>>>> Dear NCL Users
>>>>>
>>>>> I guess I am getting missing outputs because of the assumption that xin
>>>>> is gridded RCM data because neither lon proceeds left to right nor lat
>>>>> proceeds from south-to-north.
>>>>>
>>>>> I have tried to use "natgrid" assuming xi (mxn) with lat(mxn) and
>>>>> lon(mxn) but the program is hang. I guess it does not work too.
>>>>>
>>>>> Therefore, I would like to know how do I interpolate this data (high
>>>>> resolution data) to RCM grid with lat2d(172,180), lon2d(172,180).
>>>>> Meanwhile I counted that there are nearly 450 RCM grid over the input
>>>>> domain; so I would like to interpolate the input data to this 450 CRCM
>>>>> grid.
>>>>> I am sending the part (total file has 17536 lat, lon and xin) of
>>>>> lat and
>>>>> lon of the input data for your convenience .
>>>>>
>>>>> Any help in this regard will be appreciated
>>>>>
>>>>> Thanks
>>>>>
>>>>> Debasish
>>>>>
>>>>> =
>>>>>
>>>>>
>>>>>
>>>>> Begin forwarded message:
>>>>>
>>>>>> *From: *Debasish<debasish@sca.uqam.ca<mailto:debasish@sca.uqam.ca>>
>>>>>> *Date: *1 février 2011 16:42:48 HNE
>>>>>> *To: *Ncl Talk<ncl-talk@ucar.edu<mailto:ncl-talk@ucar.edu>>
>>>>>> *Subject: **[ncl-talk] interpolation gridded data to rcm*
>>>>>>
>>>>>> Dear NCL users,
>>>>>>
>>>>>> I have gridded data xin (m,n) with lat(m,n) and lon(m,n) for smaller
>>>>>> domain. I would like to interpolate the data to RCM grid lat2d(a,b)
>>>>>> and lon2d(a,b) for bigger domian.
>>>>>> I follow the followings steps:
>>>>>>
>>>>>> 1. I assume "xin" as RCM gridded data
>>>>>> 2. convert lat2d and lon2d to 1d array lat1d and lon1d
>>>>>> 3. Use "rcm2points" function
>>>>>> xout1d = rcm2points(lat,lon,xin,lat1d,lon1d,0)
>>>>>> 4. then convert xout1d to 2d
>>>>>> but all the values of xout1d are missing
>>>>>>
>>>>>> Any suggestion to fix these problem will be appreciated
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> Debasish
>>>>>> _______________________________________________
>>>>>> 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
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Feb 8 10:37:53 2011

This archive was generated by hypermail 2.1.8 : Fri Feb 11 2011 - 16:11:42 MST