Skip to content

time layout

Ben Tupper edited this page May 23, 2016 · 3 revisions

Each element has a time or time period (start, end, duration) associated with it. From section 5.3 of DWML Design we have ...

The element {dw:time-layoutType } [+] contains the start and stop valid times and any associated period names for the data. Since different environmental parameters have different time schemes (valid at different interval and available for different lengths of time into the future), there will be one element for each of these unique temporal configurations.

We'll use this query as an example.

X <- NDFD("lat=38.99&lon=-77.01&product=time-series&begin&end&maxt=maxt&mint=mint&dew=dew")```
X
# Reference Class: "NDFDRefClass"
# [ has head element ] 
#   Reference Class: "DWMLHeadRefClass"
#    Title: NOAA's National Weather Service Forecast Data
#    Concise name: time-series
#    Creation date: 2016-05-23T11:35:11Z
#    Refresh frequency: PT1H
# [ has data element ] 
#   Reference Class: "DWMLDataRefClass"
#    locations:
#   location_key latitude longitude
# 1       point1    38.99    -77.01
#    timelayout(s): k-p24h-n7-1 k-p24h-n7-2 k-p3h-n10-3
#    parameter(s):
#    point1
#      Daily Maximum Temperature, type = maximum, units = Fahrenheit, time_layout = k-p24h-n7-1
#      Daily Minimum Temperature, type = minimum, units = Fahrenheit, time_layout = k-p24h-n7-2
#      Dew Point Temperature, type = dew point, units = Fahrenheit, time_layout = k-p3h-n10-3
#  [ no latLonList element ] 

We have three time layouts k-p24h-n7-1 k-p24h-n7-2 k-p3h-n10-3 but we'll decode only k-p24h-n7-1 From Section 5.3.2 we see...

+key k stands for key

+period p24h implies a data period length of 24 hours

+num n7 means that the number of data times is 7

+id 1 sequential number used to keep the layout keys unique

The DWMLDataRefClass has a method for extracting time-layout values and transforming to POSIXct values (UTC).

tl <- X$data$get_time_layout()
tl
# $`k-p24h-n7-1`
#      start_valid_time      end_valid_time
# 1 2016-05-23 08:00:00 2016-05-23 20:00:00
# 2 2016-05-24 08:00:00 2016-05-24 20:00:00
# 3 2016-05-25 08:00:00 2016-05-25 20:00:00
# 4 2016-05-26 08:00:00 2016-05-26 20:00:00
# 5 2016-05-27 08:00:00 2016-05-27 20:00:00
# 6 2016-05-28 08:00:00 2016-05-28 20:00:00
# 7 2016-05-29 08:00:00 2016-05-29 20:00:00
# 
# $`k-p24h-n7-2`
#      start_valid_time      end_valid_time
# 1 2016-05-22 20:00:00 2016-05-23 09:00:00
# 2 2016-05-23 20:00:00 2016-05-24 09:00:00
# 3 2016-05-24 20:00:00 2016-05-25 09:00:00
# 4 2016-05-25 20:00:00 2016-05-26 09:00:00
# 5 2016-05-26 20:00:00 2016-05-27 09:00:00
# 6 2016-05-27 20:00:00 2016-05-28 09:00:00
# 7 2016-05-28 20:00:00 2016-05-29 09:00:00
# 
# $`k-p3h-n10-3`
#       start_valid_time end_valid_time
# 1  2016-05-23 08:00:00           <NA>
# 2  2016-05-23 11:00:00           <NA>
# 3  2016-05-23 14:00:00           <NA>
# 4  2016-05-23 17:00:00           <NA>
# 5  2016-05-23 20:00:00           <NA>
# 6  2016-05-23 23:00:00           <NA>
# 7  2016-05-24 02:00:00           <NA>
# 8  2016-05-24 05:00:00           <NA>
# 9  2016-05-24 08:00:00           <NA>
# 10 2016-05-24 11:00:00           <NA>
Clone this wiki locally