# Re: Interpolation

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Nov 02 2011 - 07:36:11 MDT

As indicated by previous ncl-talk response, you must create the
'target' times.

=====

Let x(time,lev,lat,lon) =>(ntim,klev,nlat,mlon)

NTIM = 2*ntim-1
TIME = new( NTIM, typeof(x&time), "No_FillValue")

TIME(::2) = x&time
TIME(1::2) = (/ 0.5*(x&time(1::2) + x&time(0:ntim-2:2) /)

X = linint1_n_Wrap(x&time, x, False, TIME, 0, 0)

On 10/31/11 12:56 PM, Joseph Zambon wrote:
> Jonathan,
>
> Seems like an easy way to double the time output on regular intervals
> would be to linearly interpolate by finding the averages between the
> timesteps.... Say you have regular 6-hourly output (4x daily: t0, t6,
> t12, t18, t24, etc...)
>
> t0=t0
> t3=(t0+t6)/2
> t6=t6
> t9=(t6+t9)/2
> t12=t12
> t15=(t12+t18)/2
> t18=t18
> t21=(t18+t24)/2
> t24=t24
>
> If the temporal spacing is irregular then a simple average would not
> work and you have to weight accordingly. This is assuming the spatial
> array is the same for all timesteps, if not, then you need to 2d or 3d
> interpolate spatially the same grid and then interpolate temporally.
>
> -Joe
>
>
> Joseph B. Zambon
> jbzambon@ncsu.edu <mailto:jbzambon@ncsu.edu>
> NC State University
> Department of Marine, Earth and Atmospheric Sciences
> Jordan 4133
>
>
>
>
>
> On Oct 30, 2011, at 4:12 PM, jrbuzan wrote:
>
>> Hello,
>>
>> I am attempting to take Pressure at 4x daily (time) output and
>> interpolate it to 8x daily (time) output.
>> So far, the schemes that I have found (eg. linint1
>> <http://www.ncl.ucar.edu/Document/Functions/Built-in/linint1.shtml>)
>> require the arrays to be the same size. Is there are way to
>> interpolate to a larger array size (or the reverse, take 8x daily and
>> make it 4x daily)?
>>
>> Thanks,
>>
>> Jonathan R. Buzan
>> PhD Student, Earth and Atmospheric Sciences
>> Purdue University
>> West Lafayette, IN 47907
>> jbuzan@purdue.edu <mailto:jbuzan@purdue.edu>
>>
>> _______________________________________________
>> 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 Wed Nov 2 07:36:19 2011

This archive was generated by hypermail 2.1.8 : Fri Nov 04 2011 - 08:43:41 MDT