NCL Website header
NCL Home > Documentation > Functions > Climatology

clmDayTLLL

Calculates long term daily means (daily climatology) from daily data.

Prototype

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"  ; This library is automatically loaded
                                                             ; from NCL V6.2.0 onward.
                                                             ; No need for user to explicitly load.

	function clmDayTLLL (
		x [*][*][*][*] : float or double,  
		yyyyddd    [*] : integer           
	)

	return_val [366][*][*][*] :  typeof(x)

Arguments

x

A four-dimensional array (time, lev, lat, lon).

yyyyddd

A one-dimensional array (same size as the "time" dimension of x) containing values of the form yyyy*1000 + Day_of_Year where yyyy is a year [eg: 1993] and ddd is the sequential day of the current year [eg: Jan01=>1, Jan31=>31, etc.

By default, this function assumes that the gregorian calendar is being used. To correcly handle other calendars, the calendar attribute must be associated with the yyyyddd argument. The user may have to be explicitly perform the assignment(s).

Return value

A climatological time series where the leftmost dimension refers to the sequential day of the year.

Description

Calculate the mean annual cycle from daily data. The return array will give the raw climatology at each grid point


       x(time,lev,lat,lon)  <==== input dimension order
       x!0 = "time"     <==== time is in days
       x!1 = "lev"
       x!2 = "lat"
       x!3 = "lon"

non-Leap  yyyyddd
       1905001 =>  Jan  1, 1905
       1905032 =>  Feb  1, 1905
       1905059 =>  Feb 28, 1905
       1905060 =>  Mar  1, 1905
       1905365 =>  Dec 31, 1905

Leap      yyyyddd
       1908001 =>  Jan  1, 1908
       1908032 =>  Feb  1, 1908
       1908059 =>  Feb 28, 1908
       1908060 =>  Feb 29, 1908
       1908061 =>  Mar  1, 1908
       1908366 =>  Dec 31, 1908

See Also

clmDayTLL, smthClmDayTLL, calcDayAnomTLL, clmMon2clmDay, clmMonTLL, clmMonTLLL, clmMonLLLT, clmMonLLT

Examples

Please see: MJO_CLIVAR: Example 2 for a visual example of smoothing.

Example 1

Compute the long term daily means. The input is daily heights spanning 1990-1999. The dimensions are (time,level,lat,lon). Here, the input values are packed as type short. The time coordinate is paresable by cd_calendar. Compute the daily climatologies. The input is mean daily heights at multiplre levels spanning 1990-1999. The values are packed as type short and the time is in units "hours since 1-1-1 00:00:0". There was no calendar attribute associated with the 'time' dimension/variable. Hence, a gregorian calendar is assumed. Still, the example shows how a user might check if the calendar attribute exists and associate it with the required variables.

;;The following library is loaded by default in NCL V6.2.0 and newer
;;load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" 

   :
   diri    = "./"                             ; input directory   
   fili    = "HGT.nc"                         ; input file       
   f       = addfile (diri+fili , "r")                          
;***********************************************************
; Read time and create required yyyyddd                    
;***********************************************************
   time    = f->time                          ; time:units = "hours since 1-1-1 00:00:0.0"                               
   TIME    = cd_calendar(time, 0)             ; type float 
   year    = toint( TIME(:,0) )               ; toint strips meta data
   month   = toint( TIME(:,1) )
   day     = toint( TIME(:,2) ) 
                                                                 ; check for calendar attribute
   if (isatt(TIME,"calendar")) then           ; default is gregorian
       year@calendar = TIME@calendar         
   end if

   ddd     = day_of_year(year, month, day) 
   if (isatt(year,"calendar")) then           ; default is gregorian
       ddd@calendar = year@calendar  
   end if

   yyyyddd = year*1000 + ddd                                    ; needed for input
   if (isatt(ddd,"calendar")) then           ; default is gregorian
       yyyyddd@calendar = ddd@calendar  
   end if

;***********************************************************
; Read data: short2flt                                     
;*********************************************************** 
   hgt     =  short2flt( f->hgt )    ; short to float 
   printVarSummary( hgt )            ; [time | 3652] x [level | 17] x [lat | 73] x [lon | 144]
   printMinMax( hgt, 0 )            
;***********************************************************
; Compute daily climatology: raw 
;***********************************************************
   hClmDay    = clmDayTLLL(hgt, yyyyddd)     ; daily climatology at each grid point                                      
   printVarSummary(hClmDay)          ;  [time | 366] x [level | 17] x [lat | 73] x [lon | 144]
   printMinMax(hClmDay,0) 

Other Examples: Please see examples associated with clmDayTLL. They illustrate the methodology for different calendars (360_day and 365_day).