Subsets a list of raws_timeseries objects by date. This function always filters to day-boundaries.

Dates can be anything that is understood by lubridate::ymd() including either of the following recommended formats:

  • "YYYYmmdd"

  • "YYYY-mm-dd"

rawsList_filterDate(
  rawsList = NULL,
  startdate = NULL,
  enddate = NULL,
  days = NULL,
  weeks = NULL,
  timezone = NULL
)

Arguments

rawsList

list of raws_timeseries object.

startdate

Desired start datetime (ISO 8601).

enddate

Desired end datetime (ISO 8601).

days

Number of days to include in the filterDate interval.

weeks

Number of weeks to include in the filterDate interval.

timezone

Olson timezone used to interpret dates.

Value

A list of subsets of the elements of the given list of raws_timeseries objects filtered by date.

Note

The returned data will run from the beginning of startdate until the beginning of enddate -- i.e. no values associated with enddate will be returned.

Examples

# \donttest{
library(RAWSmet)

september_week1 <-
  example_cefaList %>%
  rawsList_filterDate(
    startdate = 20170901,
    enddate = 20170908,
    timezone = "America/Los_Angeles"
  )

head(september_week1)
#> $`452701`
#> $meta
#> # A tibble: 1 × 14
#>   deviceDeploymentID      deviceID locationID    locationName longitude latitude
#>   <chr>                   <chr>    <chr>         <chr>            <dbl>    <dbl>
#> 1 84a66be3fc5b535e_452701 452701   84a66be3fc5b… SADDLE MOUN…     -120.     46.7
#> # ℹ 8 more variables: elevation <dbl>, countryCode <chr>, stateCode <chr>,
#> #   timezone <chr>, nwsID <chr>, wrccID <chr>, nessID <chr>, agencyName <chr>
#> 
#> $data
#> # A tibble: 168 × 12
#>    datetime            temperature humidity windSpeed windDirection maxGustSpeed
#>    <dttm>                    <dbl>    <dbl>     <dbl>         <dbl>        <dbl>
#>  1 2017-09-01 07:00:00        21.7     40       2.68            244         6.71
#>  2 2017-09-01 08:00:00        20.6     40       0.894           302         4.92
#>  3 2017-09-01 09:00:00        17.8     40       2.68            258         4.47
#>  4 2017-09-01 10:00:00        16.7     40       3.13            254         3.58
#>  5 2017-09-01 11:00:00        15       41.5     1.34            247         3.13
#>  6 2017-09-01 12:00:00        14.4     41.5     0.894           112         3.13
#>  7 2017-09-01 13:00:00        11.1     46.5     0.447           316         2.24
#>  8 2017-09-01 14:00:00        10.6     46.5     1.34            244         2.24
#>  9 2017-09-01 15:00:00        15       46.5     1.34            276         1.79
#> 10 2017-09-01 16:00:00        21.1     46.5     0.447           319         1.34
#> # ℹ 158 more rows
#> # ℹ 6 more variables: maxGustDirection <dbl>, precipitation <dbl>,
#> #   solarRadiation <dbl>, fuelMoisture <dbl>, fuelTemperature <chr>,
#> #   monitorType <chr>
#> 
#> attr(,"class")
#> [1] "raws_timeseries" "sts"             "list"           
#> 
#> $`452918`
#> $meta
#> # A tibble: 1 × 14
#>   deviceDeploymentID      deviceID locationID    locationName longitude latitude
#>   <chr>                   <chr>    <chr>         <chr>            <dbl>    <dbl>
#> 1 6459d6d61050ae9b_452918 452918   6459d6d61050… WELLPINIT        -118.     47.9
#> # ℹ 8 more variables: elevation <dbl>, countryCode <chr>, stateCode <chr>,
#> #   timezone <chr>, nwsID <chr>, wrccID <chr>, nessID <chr>, agencyName <chr>
#> 
#> $data
#> # A tibble: 168 × 12
#>    datetime            temperature humidity windSpeed windDirection maxGustSpeed
#>    <dttm>                    <dbl>    <dbl>     <dbl>         <dbl>        <dbl>
#>  1 2017-09-01 07:00:00        20       40       1.34            129        2.24 
#>  2 2017-09-01 08:00:00        18.3     40       2.24            117        2.68 
#>  3 2017-09-01 09:00:00        17.2     40       1.34            108        2.24 
#>  4 2017-09-01 10:00:00        15.6     40       0.447            84        1.79 
#>  5 2017-09-01 11:00:00        14.4     40       0                43        1.79 
#>  6 2017-09-01 12:00:00        13.3     41       0               123        0.894
#>  7 2017-09-01 13:00:00        12.8     42.5     0.447            68        1.34 
#>  8 2017-09-01 14:00:00        13.3     42.5     0               290        0    
#>  9 2017-09-01 15:00:00        17.8     42.5     0               221        0.894
#> 10 2017-09-01 16:00:00        19.4     42.5     0.894           237        1.79 
#> # ℹ 158 more rows
#> # ℹ 6 more variables: maxGustDirection <dbl>, precipitation <dbl>,
#> #   solarRadiation <dbl>, fuelMoisture <dbl>, fuelTemperature <chr>,
#> #   monitorType <chr>
#> 
#> attr(,"class")
#> [1] "raws_timeseries" "sts"             "list"           
#> 
# }