Time and night/day selection in a time series of vertical profiles ('vpts')

filter_vpts(x, min, max, nearest, night, elev = -0.268, offset = 0)

Arguments

x

A vpts object.

min

Minimum datetime to be included. POSIXct value or character string convertible to POSIXct.

max

Maximum datetime to be included. POSIXct value or character string convertible to POSIXct.

nearest

If specified, min and max are ignored and the profile nearest to the specified datetime is returned that matches the day/night selection criteria. POSIXct value or character string convertible to POSIXct.

night

When TRUE select only night time profiles, when FALSE select only day time profiles, as classified by check_night.

elev

numeric. Sun elevation in degrees defining night time. May also be a numeric vector of length two, with first element giving sunset elevation, and second element sunrise elevation.

offset

numeric. Time duration in seconds by which to shift the start and end of night time. May also be a numeric vector of length two, with first element added to moment of sunset and second element added to moment of sunrise. See check_night for details.

Value

An object of class 'vpts', or an object of class 'vp' if argument nearest is specified.

Details

Returns profiles for which min <= timestamp profile < max. Selection for night and day occurs by check_night.

Examples

# load example vertical profile time series:
data(example_vpts)
example_vpts
#>                    Irregular time series of vertical profiles (class vpts)
#> 
#>            radar:  KBGM 
#>       # profiles:  1934 
#> time range (UTC):  2016-09-01 00:02:00 - 2016-09-10 11:56:00 
#>    time step (s):  min: 180     max:  16320 

# select profiles later than 02-Sep-2016
filter_vpts(example_vpts, min = "2016-09-02")
#>                    Irregular time series of vertical profiles (class vpts)
#> 
#>            radar:  KBGM 
#>       # profiles:  1651 
#> time range (UTC):  2016-09-02 00:06:00 - 2016-09-10 11:56:00 
#>    time step (s):  min: 180     max:  16320 

# select the profile nearest to 2016-09-01 03:00 UTC:
filter_vpts(example_vpts, nearest = "2016-09-01 03:00")
#>                Vertical profile (class vp)
#> 
#>        radar:  KBGM 
#>       source:  
#> nominal time:  2016-09-01 03:02:00 
#> generated by:   

# select profiles between than 1 and 3 UTC on 02-Sep-2016:
filter_vpts(example_vpts, min = "2016-09-02 01:00", max = "2016-09-02 03:00")
#>                    Irregular time series of vertical profiles (class vpts)
#> 
#>            radar:  KBGM 
#>       # profiles:  13 
#> time range (UTC):  2016-09-02 01:04:00 - 2016-09-02 02:59:00 
#>    time step (s):  min: 540     max:  600 

# select day time profiles (day time periods from sunrise to sunset)
filter_vpts(example_vpts, night=FALSE)
#>                    Irregular time series of vertical profiles (class vpts)
#> 
#>            radar:  KBGM 
#>       # profiles:  910 
#> time range (UTC):  2016-09-01 10:35:00 - 2016-09-10 11:56:00 
#>    time step (s):  min: 180     max:  41460 

# select night time profiles, with nights starting starting and ending at civil twilight
# (when the sun is 6 degrees below the horizon):
filter_vpts(example_vpts, night=TRUE, elev = -6)
#>                    Irregular time series of vertical profiles (class vpts)
#> 
#>            radar:  KBGM 
#>       # profiles:  938 
#> time range (UTC):  2016-09-01 00:10:00 - 2016-09-10 10:10:00 
#>    time step (s):  min: 180     max:  55200 

# select night time profiles from 3 hours after sunset to 2 hours before sunrise
filter_vpts(example_vpts, night=TRUE, offset=c(3,-2)*3600)
#>                    Irregular time series of vertical profiles (class vpts)
#> 
#>            radar:  KBGM 
#>       # profiles:  578 
#> time range (UTC):  2016-09-01 02:39:00 - 2016-09-10 08:41:00 
#>    time step (s):  min: 180     max:  65460