Skip to contents

Converts a vertical profile (vp) or a time series of vertical profiles (vpts) to a data frame containing all quantities per datetime and height. Has options to include latitude/longitude/antenna height (parameter geo) and day/sunrise/sunset (parameter suntime).

Usage

# S3 method for class 'vp'
as.data.frame(
  x,
  row.names = NULL,
  optional = FALSE,
  geo = TRUE,
  suntime = TRUE,
  lat = NULL,
  lon = NULL,
  elev = -0.268,
  ...
)

# S3 method for class 'vpts'
as.data.frame(
  x,
  row.names = NULL,
  optional = FALSE,
  geo = TRUE,
  suntime = TRUE,
  lat = NULL,
  lon = NULL,
  elev = -0.268,
  ...
)

Arguments

x

A vp or vpts object.

row.names

NULL or a character vector giving the row names for the data frame. Missing values are not allowed. See base::as.data.frame().

optional

Logical. If FALSE then the names of the variables in the data frame are checked to ensure that they are syntactically valid variable names and are not duplicated. See base::as.data.frame().

geo

Logical. When TRUE, adds latitude (lat), longitude (lon) and antenna height of the radar (height_antenna) to each row.

suntime

Logical. When TRUE, adds whether it is daytime (day) and the datetime of sunrise and sunset to each row.

lat

Numeric. Radar latitude in decimal degrees. When set, overrides the latitude stored in x for sunrise()/sunset() calculations.

lon

Numeric. Radar longitude in decimal degrees. When set, overrides the longitude stored in x for sunrise()/sunset() calculations.

elev

Numeric. Sun elevation in degrees, used for sunrise()/sunset() calculations.

...

Additional arguments to be passed to or from methods.

Value

A data.frame object, containing radar, datetime and height as rows and all profile quantities as columns, complemented with some oft-used additional information (columns lat, lon, height_antenna, day, sunrise, sunset).

Details

Note that only the dens quantity is thresholded for radial velocity standard deviation by sd_vvp_threshold(). This is different from the default plot.vp(), plot.vpts() and get_quantity() functions, where quantities eta, dbz, ff, u, v, w, dd are all thresholded by sd_vvp_threshold().

See also

Other profile conversion functions: as.vp(), as.vpts()

Examples

# Convert vp object to a data.frame
vp_df <- as.data.frame(example_vp)

# Print data.frame
vp_df
#>    radar            datetime height_reference       ff         dbz        dens
#> 1  seang 2015-10-18 18:00:00              sea       NA          NA          NA
#> 2  seang 2015-10-18 18:00:00              sea 11.53461   4.3039665  85.0995178
#> 3  seang 2015-10-18 18:00:00              sea 13.35705   5.4355612 110.4298782
#> 4  seang 2015-10-18 18:00:00              sea 13.77482   4.6322823  91.7822418
#> 5  seang 2015-10-18 18:00:00              sea 12.37280   0.3914067  34.5677528
#> 6  seang 2015-10-18 18:00:00              sea 11.62856  -1.8672314  20.5497875
#> 7  seang 2015-10-18 18:00:00              sea 12.26567  -1.3853970  22.9609985
#> 8  seang 2015-10-18 18:00:00              sea 12.44552  -2.0301955  19.7929668
#> 9  seang 2015-10-18 18:00:00              sea 12.72011  -2.0336432  19.7772617
#> 10 seang 2015-10-18 18:00:00              sea 13.16166  -2.5901840  17.3985100
#> 11 seang 2015-10-18 18:00:00              sea 13.24782  -4.2063093  11.9922190
#> 12 seang 2015-10-18 18:00:00              sea 12.97676  -6.4061351   7.2263165
#> 13 seang 2015-10-18 18:00:00              sea 13.96152 -10.1189432   3.0735207
#> 14 seang 2015-10-18 18:00:00              sea      NaN -14.6137285   0.0000000
#> 15 seang 2015-10-18 18:00:00              sea 18.53717 -16.1167755   0.7724188
#> 16 seang 2015-10-18 18:00:00              sea      NaN -16.8988857   0.0000000
#> 17 seang 2015-10-18 18:00:00              sea      NaN -28.0253792   0.0000000
#> 18 seang 2015-10-18 18:00:00              sea      NaN -37.8717766   0.0000000
#> 19 seang 2015-10-18 18:00:00              sea      NaN -38.7156448   0.0000000
#> 20 seang 2015-10-18 18:00:00              sea      NaN -38.6279716   0.0000000
#> 21 seang 2015-10-18 18:00:00              sea      NaN -39.0613213   0.0000000
#> 22 seang 2015-10-18 18:00:00              sea      NaN -41.9553452   0.0000000
#> 23 seang 2015-10-18 18:00:00              sea      NaN -39.9685364   0.0000000
#> 24 seang 2015-10-18 18:00:00              sea      NaN -44.7469788   0.0000000
#> 25 seang 2015-10-18 18:00:00              sea      NaN -40.6572495   0.0000000
#>            u         v   gap          w n_dbz       dd    n       DBZH height
#> 1         NA        NA  TRUE         NA     0       NA    0         NA      0
#> 2  -3.860118 -10.86953 FALSE  -8.255996  9786 199.5516 4384   4.853236    200
#> 3  -5.824306 -12.02032 FALSE  -3.870171 10807 205.8520 5680   4.977803    400
#> 4  -6.317519 -12.24070 FALSE -15.429576 10874 207.2986 5456   4.296990    600
#> 5  -5.464484 -11.10070 FALSE  -7.646388  9343 206.2094 4067   0.749139    800
#> 6  -5.435530 -10.28000 FALSE   2.433591  9025 207.8676 3628  -1.486296   1000
#> 7  -5.871046 -10.76928 FALSE   3.606835  6743 208.5977 3126  -1.220092   1200
#> 8  -5.042855 -11.37807 FALSE   2.602238  6873 203.9033 3180  -2.030195   1400
#> 9  -4.089148 -12.04492 FALSE   1.397334  6516 198.7519 2962  -2.033643   1600
#> 10 -4.711092 -12.28962 FALSE   5.478257  5871 200.9738 2284  -2.590184   1800
#> 11 -4.695442 -12.38780 FALSE   6.864256  2960 200.7586 1034  -4.206309   2000
#> 12 -4.695178 -12.09759 FALSE   4.974006  3640 201.2117  859  -6.406135   2200
#> 13 -5.040771 -13.01978 FALSE   0.743979  3989 201.1645  374 -10.118943   2400
#> 14       NaN       NaN  TRUE        NaN  2998      NaN  125 -14.613729   2600
#> 15 -6.448045 -17.37957 FALSE  -2.458026  3656 200.3555   72 -16.116776   2800
#> 16       NaN       NaN  TRUE        NaN  3660      NaN   51 -16.898886   3000
#> 17       NaN       NaN  TRUE        NaN  3995      NaN    2 -28.025379   3200
#> 18       NaN       NaN  TRUE        NaN  3656      NaN    0 -37.871777   3400
#> 19       NaN       NaN  TRUE        NaN  2989      NaN    0 -38.715645   3600
#> 20       NaN       NaN  TRUE        NaN  2654      NaN    0 -38.627972   3800
#> 21       NaN       NaN  TRUE        NaN  1991      NaN    0 -39.061321   4000
#> 22       NaN       NaN  TRUE        NaN  1991      NaN    0 -41.955345   4200
#> 23       NaN       NaN  TRUE        NaN  2326      NaN    0 -39.968536   4400
#> 24       NaN       NaN  TRUE        NaN  2319      NaN    0 -44.746979   4600
#> 25       NaN       NaN  TRUE        NaN  1991      NaN    0 -40.657249   4800
#>    n_dbz_all          eta   sd_vvp n_all rcs sd_vvp_threshold radar_latitude
#> 1          0           NA       NA     0  11                2        56.3675
#> 2      27593 9.360947e+02 4.349111 11472  11                2        56.3675
#> 3      24154 1.214729e+03 4.015257  9936  11                2        56.3675
#> 4      18282 1.009605e+03 3.286927  8026  11                2        56.3675
#> 5      13321 3.802453e+02 3.546942  5282  11                2        56.3675
#> 6      10471 2.260477e+02 3.821268  4078  11                2        56.3675
#> 7       7308 2.525710e+02 3.926216  3304  11                2        56.3675
#> 8       6873 2.177226e+02 3.797443  3180  11                2        56.3675
#> 9       6516 2.175499e+02 3.670397  2962  11                2        56.3675
#> 10      5871 1.913836e+02 3.618254  2284  11                2        56.3675
#> 11      2960 1.319144e+02 3.535195  1034  11                2        56.3675
#> 12      3640 7.948948e+01 3.134931   859  11                2        56.3675
#> 13      3989 3.380873e+01 2.994742   374  11                2        56.3675
#> 14      2998 1.201020e+01      NaN   125  11                2        56.3675
#> 15      3656 8.496607e+00 4.066769    72  11                2        56.3675
#> 16      3660 7.096342e+00      NaN    51  11                2        56.3675
#> 17      3995 5.475014e-01      NaN     2  11                2        56.3675
#> 18      3656 5.672123e-02      NaN     0  11                2        56.3675
#> 19      2989 4.670447e-02      NaN     0  11                2        56.3675
#> 20      2654 4.765693e-02      NaN     0  11                2        56.3675
#> 21      1991 4.313115e-02      NaN     0  11                2        56.3675
#> 22      1991 2.215075e-02      NaN     0  11                2        56.3675
#> 23      2326 3.500013e-02      NaN     0  11                2        56.3675
#> 24      2319 1.164730e-02      NaN     0  11                2        56.3675
#> 25      1991 2.986746e-02      NaN     0  11                2        56.3675
#>    radar_longitude radar_height radar_wavelength   day             sunrise
#> 1          12.8517          209         5.348661 FALSE 2015-10-18 05:50:07
#> 2          12.8517          209         5.348661 FALSE 2015-10-18 05:50:07
#> 3          12.8517          209         5.348661 FALSE 2015-10-18 05:50:07
#> 4          12.8517          209         5.348661 FALSE 2015-10-18 05:50:07
#> 5          12.8517          209         5.348661 FALSE 2015-10-18 05:50:07
#> 6          12.8517          209         5.348661 FALSE 2015-10-18 05:50:07
#> 7          12.8517          209         5.348661 FALSE 2015-10-18 05:50:07
#> 8          12.8517          209         5.348661 FALSE 2015-10-18 05:50:07
#> 9          12.8517          209         5.348661 FALSE 2015-10-18 05:50:07
#> 10         12.8517          209         5.348661 FALSE 2015-10-18 05:50:07
#> 11         12.8517          209         5.348661 FALSE 2015-10-18 05:50:07
#> 12         12.8517          209         5.348661 FALSE 2015-10-18 05:50:07
#> 13         12.8517          209         5.348661 FALSE 2015-10-18 05:50:07
#> 14         12.8517          209         5.348661 FALSE 2015-10-18 05:50:07
#> 15         12.8517          209         5.348661 FALSE 2015-10-18 05:50:07
#> 16         12.8517          209         5.348661 FALSE 2015-10-18 05:50:07
#> 17         12.8517          209         5.348661 FALSE 2015-10-18 05:50:07
#> 18         12.8517          209         5.348661 FALSE 2015-10-18 05:50:07
#> 19         12.8517          209         5.348661 FALSE 2015-10-18 05:50:07
#> 20         12.8517          209         5.348661 FALSE 2015-10-18 05:50:07
#> 21         12.8517          209         5.348661 FALSE 2015-10-18 05:50:07
#> 22         12.8517          209         5.348661 FALSE 2015-10-18 05:50:07
#> 23         12.8517          209         5.348661 FALSE 2015-10-18 05:50:07
#> 24         12.8517          209         5.348661 FALSE 2015-10-18 05:50:07
#> 25         12.8517          209         5.348661 FALSE 2015-10-18 05:50:07
#>                 sunset
#> 1  2015-10-18 15:56:28
#> 2  2015-10-18 15:56:28
#> 3  2015-10-18 15:56:28
#> 4  2015-10-18 15:56:28
#> 5  2015-10-18 15:56:28
#> 6  2015-10-18 15:56:28
#> 7  2015-10-18 15:56:28
#> 8  2015-10-18 15:56:28
#> 9  2015-10-18 15:56:28
#> 10 2015-10-18 15:56:28
#> 11 2015-10-18 15:56:28
#> 12 2015-10-18 15:56:28
#> 13 2015-10-18 15:56:28
#> 14 2015-10-18 15:56:28
#> 15 2015-10-18 15:56:28
#> 16 2015-10-18 15:56:28
#> 17 2015-10-18 15:56:28
#> 18 2015-10-18 15:56:28
#> 19 2015-10-18 15:56:28
#> 20 2015-10-18 15:56:28
#> 21 2015-10-18 15:56:28
#> 22 2015-10-18 15:56:28
#> 23 2015-10-18 15:56:28
#> 24 2015-10-18 15:56:28
#> 25 2015-10-18 15:56:28

# Convert vpts object to a data.frame
vpts_df <- as.data.frame(example_vpts)

# Print the first 5 rows of the data.frame
vpts_df[1:5, ]
#>   radar            datetime height height_reference    u    v     w   ff   dd
#> 1  KBGM 2016-09-01 00:02:00      0              sea  NaN  NaN   NaN  NaN  NaN
#> 2  KBGM 2016-09-01 00:02:00    200              sea  NaN  NaN   NaN  NaN  NaN
#> 3  KBGM 2016-09-01 00:02:00    400              sea  NaN  NaN   NaN  NaN  NaN
#> 4  KBGM 2016-09-01 00:02:00    600              sea 4.14 3.84 12.17 5.65 47.2
#> 5  KBGM 2016-09-01 00:02:00    800              sea 5.06 0.24 15.17 5.07 87.2
#>   sd_vvp   gap   dbz  eta      dens   DBZH    n n_dbz n_all n_dbz_all rcs
#> 1    NaN  TRUE   NaN  NaN       NaN    NaN    0     0     0         0  11
#> 2    NaN  TRUE   NaN  NaN       NaN    NaN    0     0     0         0  11
#> 3   2.81  TRUE  1.54 30.8 2.8000000   3.77  326   356 22485     28416  11
#> 4   2.80 FALSE  3.36 46.9 4.2636364   0.50 9006 13442 65947    104455  11
#> 5   2.42 FALSE -7.89  3.5 0.3181818 -10.33 2313 11145 21321     63542  11
#>   sd_vvp_threshold radar_latitude radar_longitude radar_height radar_wavelength
#> 1                2           42.2          -75.98            0             10.6
#> 2                2           42.2          -75.98            0             10.6
#> 3                2           42.2          -75.98            0             10.6
#> 4                2           42.2          -75.98            0             10.6
#> 5                2           42.2          -75.98            0             10.6
#>     day             sunrise              sunset
#> 1 FALSE 2016-09-01 10:32:54 2016-09-01 23:33:47
#> 2 FALSE 2016-09-01 10:32:54 2016-09-01 23:33:47
#> 3 FALSE 2016-09-01 10:32:54 2016-09-01 23:33:47
#> 4 FALSE 2016-09-01 10:32:54 2016-09-01 23:33:47
#> 5 FALSE 2016-09-01 10:32:54 2016-09-01 23:33:47

# Do not add lat/lon/height_antenna information
vpts_df <- as.data.frame(example_vpts, geo = FALSE)

# Do not add day/sunrise/sunset information
vpts_df <- as.data.frame(example_vpts, suntime = FALSE)

# Override the latitude/longitude information stored in the object when
# calculating sunrise/sunset information
vpts_df <- as.data.frame(example_vpts, lat = 50, lon = 4)