Re: Interpolate the monthly or weekly data into daily data

From: HUANG, Ping <ph0007_at_nyahnyahspammersnyahnyah>
Date: Sat Oct 30 2010 - 07:38:26 MDT

Dear Dennis,

Thanks for your suggestion.
I have done this job. Here is a short script. It may be helpful for others.

   sstfile = addfile("sst.mnmean.nc","r")
   
   time_file = ut_calendar(sstfile->time, -1)
   time_frac = yyyymm_to_yyyyfrac(time_file, 0.5)
   
   iyear = 2000 ;
   tSI = ind(time_file.eq.(iyear-1)*100+12)
   tEI = ind(time_file.eq.(iyear+1)*100+1)
   days = yyyymmdd_to_yyyyfrac(yyyymmdd_time(iyear,iyear,"integer"), 0.5)

   sst_day = linint1_n (time_frac(tSI:tEI), short2flt(sstfile->sst(tSI:tEI,:,:)) , False, days , 0, 0)

The script with minor change can act on the weekly data.

Regards,

2010-10-30



HUANG, Ping



发件人: Dennis Shea
发送时间: 2010-10-29 22:08:27
收件人: HUANG, Ping
抄送: ncl-talk
主题: Re: [ncl-talk] Interpolate the monthly or weekly data into daily data
 
To my knowledge, there are no NCL functions for doing this
specific task.
The simplest approach would be to use linear interpolation.
Say for monthly to daily
[1] create a target array of length N*365:
      xday = new ( N*365, "float")
     where N is the number of year of daily data to be generated
[2] assign the January monthly mean value to (say) day 16;
     the February value to day 46; etc
     NCL's "day_of_year" can provide the appropriate day to use
[3] Use
http://www.ncl.ucar.edu/Document/Functions/Built-in/linint1_n.shtml
or
http://www.ncl.ucar.edu/Document/Functions/Built-in/linint1_n.shtml
to perform the interpolation.
[4] Two issues:
(a) the interpolated values will be a very 'conservative' estimate
of the annual cycle. Conservative in the sense that each monthly
mean is, well, an average of the daily values.
(b) The first and last 15 days will be missing so you should
add two extra months (say) a December climatology and a January
climatology at the beginning and end.
Good luck
On 10/26/10 9:09 AM, HUANG, Ping wrote:
> Hi all,
> Are there any scripts or suggestions for interpolating the monthly or
> weekly data into daily data?
> Thanks.
> ------------------------------------------------------------------------
> HUANG, Ping
>
>
>
> _______________________________________________
> 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 Sat Oct 30 07:38:54 2010

This archive was generated by hypermail 2.1.8 : Mon Nov 08 2010 - 08:08:50 MST