Re: how to convert leap calendar to no-leap one easily in NCL?

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Tue Mar 30 2010 - 12:23:52 MDT

Xie Xin wrote:
> Hi,
>
> I am comparing results from certain climate model (daily) and NCEP
> reanalysis II (four times a day). The output of the model is in a
> no-leap calendar in time axis but the reanalysis one is in a leap one.
> So I would like to convert the reanalysis into a daily one first
====
[daily average]

[1] The following has many aily fields already computed
http://www.esrl.noaa.gov/psd/data/gridded/data.ncep.reanalysis.html

[2] NCL
        f = addfile("...", "r")

        y = f->YDATA ; eg (time,lat,lon)

        yday = y(::4,:,:) ; trick: allocate space & preserve meta data
        printVarSummary(yday)

NCL new version 5.1.0. ntim is the number of time steps
        do nt=0,ntim-1,4
           yday(nt/4,:,:) = (/ dim_avg_n( y(nt:nt+3,:,:), 0 ) /)
        end do

[3] If you have the Climate Data Operators [CDO] installed

   http://www.mpimet.mpg.de/fileadmin/software/cdo/

     cdo daymean foo_hrly.nc foo_daily.nc

   NOTE: NCL does *not* support the CDO

  and
> then delete all the Feb 29 in the leap year. Is there any easy way to
> do that in NCL? Thank you very much!

Deleting 29 Feb ...

If you are doing (say) spectral analysis or daily correlations,
You do not want to delete the date. Deleteion creates a 'hole' in
the spectrum.

If your units are udunits ["seconds/hours/days since ..."]

    time = f->time
    ymdh = ut_calendar(time, 0)
         ; index values of all but 2/29
    i = ind(.not.(ymdh(1).eq.2 .and. ymdh(2).eq.29) )

    x = f->X(i,:,:) or X(i,:,:,:)

Good luck

>
> Best regards,
>
> Xin Xie
> _______________________________________________
> 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 Mar 30 12:23:56 2010

This archive was generated by hypermail 2.1.8 : Thu Apr 01 2010 - 11:31:45 MDT