clmDayHourTLL
Calculates climatological day-hour means at user specified hours for each day of the year.
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 clmDayHourTLL ( x [*][*][*] : float or double, yyyydddhh [*] : integer, hour [*] : integer, opt_shape [1] : logical ) return_val [366*dimsizes(hour)][*][*] : : typeof(x)
Arguments
xA three-dimensional array (time, lat, lon) containing day-hour data.
yyyydddhhA one-dimensional array (same size as the "time" dimension of x) containing values of the form yyyydddhh [ie: yyyy*100000 + ddd*100 + hh]. yyyy [eg: 1993]; ddd is the sequential day of the current year [eg: Jan01=>1, Feb01=>32, etc.); and, hh is the hour of the day.
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.
hourUser specified hours. Typically: (/0,6,12,18/) , (/0,12/) , ispan(0,23,1). However, they can be unequally spaced: (/2,7,13,16,22/)
opt_shapeSpecifies how the user wants the results shaped. opt_shape=True returns (366,nhrs,lat,lon). opt_shape=False returns (366*nhrs,lat,lon).
Return value
A climatological time series where the leftmost dimension refers to the sequential day of the year. See: opt_shape description
Description
Calculate the mean annual cycle from day-hour data. The return array will give the raw day-hour climatology at each grid point
x(time,lat,lon) <==== input dimension order non-Leap yyyydddhh 190500100 => Jan 1, 1905, 00Z 190503206 => Feb 1, 1905, 06Z 190505915 => Feb 28, 1905, 15Z 190506018 => Mar 1, 1905, 18Z 190536521 => Dec 31, 1905, 21Z Leap yyyydddhh 190500100 => Jan 1, 1905, 00Z 190503206 => Feb 1, 1905, 06Z 190505915 => Feb 28, 1905, 15Z 190506118 => Mar 1, 1905, 18Z 190536621 => Dec 31, 1905, 21Z
See Also
cd_calendar, clmDayTLL, calculate_daily_values
Examples
Example 1 Compute the day-hour climatologies. The input is 4x-daily precipitable water spanning 5-years: 2010-2014.
dir = "./" fil = systemfunc("cd "+dir+" ; ls pr_wtr.eatm*nc") f = addfiles(dir+fil, "r") x = f[:]->pr_wtr printVarSummary(x) ; [time | 7304] x [lat | 73] x [lon | 144] HOUR = (/0,6,12,18/) ; user specified hours time = fCDC[:]->time ; time:units = "hours since ?-?-? 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) ) ; day of month hour = toint( TIME(:,3) ) ; hour of day ; 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(time,"calendar")) then ; default is gregorian ddd@calendar = time@calendar end if yyyydddhh = year*100000 + ddd*100 + hour ; needed for input if (isatt(time,"calendar")) then yyyydddhh@calendar = time@calendar end if opt_shape = False ; 3D clmDayHour = clmDayHourTLL (x, yyyydddhh, HOUR, opt_shape) printVarSummary(clmDayHour) ; [dddhh | 1464] x [lat | 73] x [lon | 144] printMinMax(clmDayHour,0) print("=========================") if (opt_shape) then print(clmDayHour(:,:,{40},{255})) printMinMax(clmDayHour(:,:,{40},{255}),0) else print(clmDayHour(:,{40},{255})) printMinMax(clmDayHour(:,{40},{255}),0) end ifThe input variable is:
Variable: x <=== data Type: float Total Size: 307118592 bytes 76779648 values Number of Dimensions: 3 Dimensions and sizes: [time | 7304] x [lat | 73] x [lon | 144] Coordinates: time: [1840824..1884642] lat: [90..-90] lon: [ 0..357.5] Number Of Attributes: 15 long_name : 4xDaily Precipitable Water for entire atmosphere units : kg/m^2 precision : 2 least_significant_digit : -1 GRIB_id : 54 GRIB_name : PWAT var_desc : Precipitable Water Content dataset : NMC Reanalysis level_desc : Entire Atmosphere Considered As a Single Layer statistic : Individual Obs parent_stat : Other missing_value : -9.96921e+36 actual_range : ( -6.600006, 79.59999 ) valid_range : ( -50, 150 ) _FillValue : -9.96921e+36 The (edited) results with opt_shape=False Variable: clmDayHour Type: float Total Size: 61558272 bytes 15389568 values Number of Dimensions: 3 Dimensions and sizes: [dddhh | 1464] x [lat | 73] x [lon | 144] Coordinates: dddhh: [100..36618] lat: [90..-90] lon: [ 0..357.5] Number Of Attributes: 6 hour_day : 0 long_name : Day-Hour Climatology: 4xDaily Precipitable Water for entire atmosphere units : kg/m^2 information : Raw day-hour averages across all years smoothing : None NCL_tag : clmDayHourTLL (0) Day-Hour Climatology: 4xDaily Precipitable Water for entire atmosphere (kg/m^2) : min=-3.68 max=67.74 The (edited) results with opt_shape=True Variable: clmDayHour Type: float Total Size: 61558272 bytes 15389568 values Number of Dimensions: 4 Dimensions and sizes: [year_day | 366] x [hour_day | 4] x [lat | 73] x [lon | 144] Coordinates: year_day: [1..366] hour_day: [0..18] lat: [90..-90] lon: [ 0..357.5] Number Of Attributes: 6 hour_day : 0 long_name : Day-Hour Climatology: 4xDaily Precipitable Water for entire atmosphere units : kg/m^2 information : Raw day-hour averages across all years smoothing : None (0) Day-Hour Climatology: 4xDaily Precipitable Water for entire atmosphere (kg/m^2) : min=-3.68 max=67.74The results for individual grid points are not shown (too long).