# Re: Calendar: basic question

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Fri, 12 Jun 2009 15:58:37 -0600

Gwenaelle,

I do not have a specialized function for interpolating on the time
dimension like this. Perhaps someone else has a function made for
this exact purpose.

I think you can easily do this with one of the generic NCL
interpolation functions, applied to the data, along one dimension
only. There are several choices: linear, cubic spline, etc.

If the original time axis is regular and continuous, then you
probably do not need to interpolate each year separately. Simply
interpolate all data once, over the entire time range.

For the time coordinates, one way is to construct a new time number
ramp with a convenient time increment of say, 1.0 = 1 day, using the
ispan or fspan function. Add the units and calendar attributes to
get the desired result times, e.g.

time = 0D + ispan (0, ntimes_out-1, ntimes_out)
; coerce to double
time_at_units = "days since 1987-1-1 0:0:0"
time_at_calendar = "360_day"

Where ntimes_out is the number of time steps in the result data;

And the date and time inside time_at_units is correct for the first
time step of the interpolated data. HTH.

--Dave

Gwenaelle wrote:
> Thanks!
> Yes, I would prefer to make an interpolation instead of getting rid of
> the 5 or 6 days at the end of the month.
>
> What is the best way to do it?
>
> On Jun 12, 2009, at 2:51 PM, Dave Allured wrote:
>
>> Gwenaelle,
>>
>> You said "dataset" which implies that there is existing data
>> associated with 365-day and 366-day calendar dates. If true, this
>> is not a simple problem.
>>
>>
>> How do you see mapping the data itself from one time system to
>> another? Interpolation? Or simply discard 5 or 6 records each
>> year, to make the number of days come out right?
>>
>> Or do you want to simply transform the time axis, so that you still
>> have 365 or 366 time steps per year, but the time of day slowly
>> rotates and you occasionally have one date with two records?
>>
>> Please clarify what the intention is.
>>
>> Dave Allured
>> CU/CIRES Climate Diagnostics Center (CDC)
>> http://cires.colorado.edu/science/centers/cdc/
>> NOAA/ESRL/PSD, Climate Analysis Branch (CAB)
>> http://www.cdc.noaa.gov/psd1/
>>
>> Gwenaelle wrote:
>>> Hi ncl-talk,
>>>
>>> I have a daily dataset and I would like to convert the time from
>>> (a) 365 days to 360 days
>>> and (b) from 366 days to 360 days.
>>>
>>> Is there any ncl functions or documentation for this job?
>>>
>>> Thanks a lot!
>>> Gwenaelle
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Jun 12 2009 - 15:58:37 MDT

This archive was generated by hypermail 2.2.0 : Tue Jun 16 2009 - 10:05:45 MDT