Skip to contents

Create the DataValues table

Usage

create_data_values(
  L0_flat,
  ValueID,
  DataValue,
  ValueAccuracy = NULL,
  LocalDateTime,
  UTCOffset,
  DateTimeUTC = NULL,
  SiteCode,
  VariableCode,
  OffsetValue = NULL,
  OffsetTypeCode = NULL,
  CensorCode = NULL,
  QualifierCode = NULL,
  MethodCode,
  QualityControlLevelCode,
  SourceCode,
  NoDataValue
)

Arguments

L0_flat

(tbl_df, tbl, data.frame) The fully joined source L0 dataset, in "flat" format (see details).

ValueID

(character) Column in L0_flat containing the identifier assigned to each unique data value.

DataValue

(character) Column in L0_flat containing the numeric value of the observation.

ValueAccuracy

(character) Optional. Column in L0_flat containing the umeric value that describes the measurement accuracy of the data value.

LocalDateTime

(character) Column in L0_flat containing local date and time at which the data value was observed.

UTCOffset

(character) Column in L0_flat containing offset in hours from UTC time of the corresponding LocalDateTime value.

DateTimeUTC

(character) Column in L0_flat containing UTC date and time at which the data value was observed.

SiteCode

(character) Column in L0_flat containing code used by organization that collects the data to identify the site.

VariableCode

(character) Column in L0_flat containing code used by the organization that collects the data to identify the variable.

OffsetValue

(character) Optional. Column in L0_flat containing distance from a datum or control point to the point at which a data value was observed.

OffsetTypeCode

(character) if OffsetValue is used. Column in L0_flat containing code used by the organization that collects the data to identify the OffsetType.

CensorCode

(character) Column in L0_flat containing text indication of whether the data value is censored. Defaults to "nc" (Not Censored).

QualifierCode

(character) Optional. Column in L0_flat containing a flag indicating a peculiarity with a particular data value.

MethodCode

(character) Column in L0_flat containing the code used by the organization that collects the data to identify the Method.

QualityControlLevelCode

(character) Column in L0_flat containing the code which identifies the level of quality control that the value has been subjected to.

SourceCode

(character) Column in L0_flat containing the code which identifies the organization that created the data.

NoDataValue

(character) Column in L0_flat containing numeric value used to encode when a data value is not available for this variable.

Value

(tbl_df, tbl, data.frame) The DataValues table.

Details

This function appends columns to the L0_flat table and returns the augmented table.

"flat" format refers to the fully joined source L0 dataset in "wide" form with the exception of the core observation variables, which are in "long" form (i.e. using the variable_name, value, unit columns of the observation table). This "flat" format is the "widest" an L1 hymetDP dataset can be consistently spread due to the frequent occurrence of L0 source datasets with > 1 core observation variable.

Examples


flat <- hymet_L0_flat

  DataValues <- hymetDP::create_data_values(
    L0_flat = flat,
    ValueID = "ValueID",
    DataValue = "DataValue",
    ValueAccuracy = NULL,
    LocalDateTime = "LocalDateTime",
    UTCOffset = "UTCOffset",
    DateTimeUTC = "DateTimeUTC",
    SiteCode = "SiteCode",
    VariableCode = "VariableCode",
    OffsetValue = NULL,
    OffsetTypeCode = NULL,
    CensorCode = NULL,
    QualifierCode = NULL,
    MethodCode = "MethodCode",
    QualityControlLevelCode = "QualityControlLevelCode",
    SourceCode = "SourceCode",
    NoDataValue = "NoDataValue")

  DataValues
#> # A tibble: 30,003 × 15
#>    ValueID DataValue ValueAccuracy LocalDateTime  UTCOffset DateTimeUTC SiteCode
#>    <chr>       <dbl>         <dbl> <chr>              <dbl> <chr>       <chr>   
#>  1 1           144.             NA 2002-01-11 23…        13 2002-01-11… 1       
#>  2 2             0.1            NA 2002-01-11 23…        13 2002-01-11… 1       
#>  3 3            16.3            NA 2002-01-11 23…        13 2002-01-11… 1       
#>  4 4           121.             NA 2002-01-12 00…        13 2002-01-11… 1       
#>  5 5             0.1            NA 2002-01-12 00…        13 2002-01-11… 1       
#>  6 6            16.4            NA 2002-01-12 00…        13 2002-01-11… 1       
#>  7 7           116.             NA 2002-01-12 00…        13 2002-01-11… 1       
#>  8 8             0.1            NA 2002-01-12 00…        13 2002-01-11… 1       
#>  9 9            16.9            NA 2002-01-12 00…        13 2002-01-11… 1       
#> 10 10          139.             NA 2002-01-12 00…        13 2002-01-11… 1       
#> # … with 29,993 more rows, and 8 more variables: VariableCode <chr>,
#> #   OffsetValue <dbl>, OffsetTypeCode <chr>, CensorCode <chr>,
#> #   QualifierCode <chr>, MethodCode <chr>, SourceCode <chr>,
#> #   QualityControlLevelCode <chr>