L1_designtable

Author

COMPASS workflows team

Published

2025-03-15 18:54:17-04:00

This script

Initializing

Design table “metadata//design_table.csv” and has 2425 rows, 3940 after expansion.

HTML outfile is “L1_designtable.html”.

Design table summary

Research name distribution

Code
# Drop rows without research names
dt_ex_rn <- dt_ex[!is.na(dt_ex$research_name),]

overall <- with(dt_ex_rn, table(Site, Plot))
knitr::kable(overall)
C F OW S SWAMP TR UP W WTE
CRC 0 0 24 0 0 54 54 89 0
GCW 0 0 0 0 0 46 0 46 0
GWI 0 0 0 0 0 50 50 89 0
MSM 0 0 26 0 0 54 54 89 0
OWC 0 0 24 0 0 90 30 89 60
PTR 0 0 18 0 0 54 43 89 0
SWH 0 0 0 0 54 74 39 89 0
TMP 237 247 0 237 0 0 0 0 0
Code
overall_df <- as.data.frame(overall)
overall_df$Freq[overall_df$Freq == 0] <- NA_integer_
library(ggplot2)
theme_set(theme_bw())
ggplot(overall_df, aes(Site, Plot, size = Freq)) + 
    geom_point(na.rm = TRUE) + 
    ggtitle("research_name distribution by site and plot")

Loggernet variables to research name mapping

Code
# Make a 'clean' variable column
# Remove the (1), (2), etc.
dt_ex$lv_clean <- gsub("\\([0-9,]*\\)", "", dt_ex$loggernet_variable)
# Remove the A or B or C at end after number
dt_ex$lv_clean <- gsub("[ABC]$", "", dt_ex$lv_clean)
dt_ex$lv_clean <- gsub("Volt[ABC]_Avg", "Volt_Avg", dt_ex$lv_clean)

dt_ex$tb_clean <- gsub("[ABC]$", "", dt_ex$Table)
dt_ex$tb_clean <- tolower(dt_ex$tb_clean)
dt_ex$lv_clean <- with(dt_ex, paste(tb_clean, lv_clean, sep = "."))
mappings <- aggregate(lv_clean ~ research_name, data = dt_ex, FUN = function(x) paste(unique(x), sep = ","))
names(mappings)[2] <- "loggernet variable(s)"
knitr::kable(mappings)
research_name loggernet variable(s)
battery_voltage checktable.BattV , sapflow.BattV_Avg , waterlevel600.BattV_Avg , terostable.BattV_Avg , climavue50_24hr.BattV_Min , exotable.Battery_v , waterlevel200.Aquatroll_ID, redox5.BattV
gw_act_cond waterlevel600.Actual_Conductivity600, waterlevel200.Actual_Conductivity
gw_bar_pressure waterlevel600.Barometric_Pressure600
gw_battery waterlevel600.Battery_Int600
gw_density waterlevel600.Water_Density600, waterlevel200.Water_Density
gw_depth waterlevel600.Depth600, waterlevel200.Depth
gw_part_pressure waterlevel600.RDO_part_Pressure600
gw_perc_sat waterlevel600.RDO_perc_sat600
gw_ph waterlevel600.pH600
gw_ph_mv waterlevel600.pH_mV600
gw_ph_orp waterlevel600.pH_ORP600
gw_pressure waterlevel600.Pressure600, waterlevel200.Pressure
gw_rdo_conc waterlevel600.RDO_concen600
gw_resistivity waterlevel600.Resistivity600, waterlevel200.Resistivity
gw_salinity waterlevel600.Salinity600, waterlevel200.Salinity
gw_spec_cond waterlevel600.Specific_Conductivity600, waterlevel200.Specific_Conductivity
gw_tds waterlevel600.TDS600, waterlevel200.TDS
gw_temperature waterlevel600.Temperature600, waterlevel200.Temperature
gw_temperature_int waterlevel600.Temperature_Int600
gw_voltage waterlevel600.Voltage
gw_voltage_ext waterlevel600.Voltage_Ext600
redox_10cm redox5.RedoxRa, redox5.RedoxRb
redox_20cm redox5.RedoxRa, redox5.RedoxRb
redox_35cm redox5.RedoxRa, redox5.RedoxRb
redox_55cm redox5.RedoxRa, redox5.RedoxRb
sapflow_3.5cm sapflow.DiffVolt_Avg
sapflow_5cm sapflow.DiffVolt_Avg
soil_EC_10cm terostable.Teros
soil_EC_15cm terosdata.Teros
soil_EC_30cm terostable.Teros, terosdata.Teros
soil_EC_5cm terosdata.Teros
soil_temp_10cm terostable.Teros
soil_temp_15cm terosdata.Teros
soil_temp_30cm terostable.Teros, terosdata.Teros
soil_temp_5cm terosdata.Teros
soil_vwc_10cm terostable.Teros
soil_vwc_15cm terosdata.Teros
soil_vwc_30cm terostable.Teros, terosdata.Teros
soil_vwc_5cm terosdata.Teros
solar_voltage checktable.SolarV
sonde_cable exotable.Cable_v
sonde_conductivity exotable.Conductivity
sonde_depth exotable.Depth_m
sonde_fdom exotable.FDOM_QSU
sonde_fdom_rfu exotable.FDOM_RFU
sonde_nlf_cond exotable.NLF_conductivity
sonde_odo_local exotable.ODO_local
sonde_odo_mgl exotable.ODO_MgL
sonde_odo_sat exotable.ODO_sat
sonde_orp exotable.ORP_mv
sonde_ph exotable.pH
sonde_ph_mv exotable.pH_mv
sonde_pressure exotable.Pressure_psia
sonde_salinity exotable.Salinity_PPT
sonde_spcond exotable.Specific_Conductivity_uScm
sonde_tds exotable.TDS_mg_L
sonde_temp exotable.Temp_
sonde_tss exotable.TSS_MgL
sonde_turb_raw exotable.Turbidity_Raw
sonde_turbidity exotable.Turbidity_FNU
sonde_vpos exotable.Vertical_Position_m
sonde_wipercur exotable.Wiper_Current_ma
sonde_wiperpos exotable.Wiper_Position_mv
wx_barpress15 climavue50_15min.BP_mbar , gcrew_met_15min.Barometric_Pressure_PB110B_Avg
wx_bpmax15 climavue50_15min.BP_mbar_Max
wx_bpmax24 climavue50_24hr.BP_mbar_Max
wx_bpmin15 climavue50_15min.BP_mbar_Min
wx_bpmin24 climavue50_24hr.BP_mbar_Min
wx_bptmn15 climavue50_15min.BP_mbar_TMn
wx_bptmn24 climavue50_24hr.BP_mbar_TMn
wx_bptmx15 climavue50_15min.BP_mbar_TMx
wx_bptmx24 climavue50_24hr.BP_mbar_TMx
wx_dist_min15 climavue50_15min.Dist_km_Min
wx_dist_tmn15 climavue50_15min.Dist_km_TMn
wx_gcrew_rain15 gcrew_met_15min.Rain_cm_Tot
wx_invalid_wind15 climavue50_15min.Invalid_Wind_Tot
wx_maxws_tmx15 climavue50_15min.MaxWS_ms_TMx
wx_maxws_tmx24 climavue50_24hr.MaxWS_ms_TMx
wx_maxws15 climavue50_15min.MaxWS_ms_Max, gcrew_met_15min.WS_ms_RM_Max
wx_maxws24 climavue50_24hr.MaxWS_ms_Max
wx_minws15 gcrew_met_15min.WS_ms_RM_Min
wx_par_den15 climavue50_15min.PAR_Den_C_Avg, gcrew_met_15min.PAR_Den_C_Avg
wx_par_den24 climavue50_24hr.PAR_Den_C_Avg
wx_par_tot15 climavue50_15min.PAR_Tot_C_Tot
wx_par_tot24 climavue50_24hr.PAR_Tot_C_Tot
wx_rain15 climavue50_15min.Rain_mm_Tot
wx_rain24 climavue50_24hr.Rain_mm_Tot
wx_rh15 climavue50_15min.RH , gcrew_met_15min.CleanRH
wx_rh24 climavue50_24hr.RH_Max
wx_rht15 climavue50_15min.RHT_C_Avg
wx_rht24 climavue50_24hr.RH_Min
wx_rhtmax24 climavue50_24hr.RHT_C_Max
wx_rhtmin24 climavue50_24hr.RHT_C_Min
wx_slr_fd15 climavue50_15min.SlrFD_W_Avg, gcrew_met_15min.SlrW_Avg
wx_slr_fd24 climavue50_24hr.SlrFD_W_Avg
wx_slr_tf15 climavue50_15min.SlrTF_MJ_Tot, gcrew_met_15min.SlrMJ_Tot
wx_slr_tf24 climavue50_24hr.SlrTF_MJ_Tot
wx_strikes15 climavue50_15min.Strikes_Tot
wx_svp15 gcrew_met_15min.SVP
wx_tempavg15 climavue50_15min.AirT_C_Avg, gcrew_met_15min.AirTC_Avg
wx_tempavg24 climavue50_24hr.AirT_C_Avg
wx_tempmax15 climavue50_15min.AirT_C_Max
wx_tempmax24 climavue50_24hr.AirT_C_Max
wx_tempmin15 climavue50_15min.AirT_C_Min
wx_tempmin24 climavue50_24hr.AirT_C_Min
wx_temptmn15 climavue50_15min.AirT_C_TMn
wx_temptmn24 climavue50_24hr.AirT_C_TMn
wx_temptmx15 climavue50_15min.AirT_C_TMx
wx_temptmx24 climavue50_24hr.AirT_C_TMx
wx_tilt_ns15 climavue50_15min.TiltNS_deg_Avg
wx_tilt_ns24 climavue50_24hr.TiltNS_deg_Max
wx_tilt_we15 climavue50_15min.TiltWE_deg_Avg
wx_tilt_we24 climavue50_24hr.TiltWE_deg_Max
wx_vappress15 climavue50_15min.VP_mbar_Avg
wx_vappress24 climavue50_24hr.VP_mbar_Avg
wx_vp15 gcrew_met_15min.VP
wx_winddir_sd115 climavue50_15min.WindDir_SD1_WVT
wx_winddir15 climavue50_15min.WindDir_D1_WVT, gcrew_met_15min.WindDir_RM_Avg
wx_winderrors24 climavue50_24hr.WS_ms_S_WVT
wx_windspeed15 climavue50_15min.WS_ms_S_WVT, gcrew_met_15min.WS_ms_RM_Avg
Code
lv_to_rn <- aggregate(Site ~ lv_clean + research_name, data = dt_ex, FUN = function(x) length(unique(x)))

lv_to_site <- aggregate(research_name ~ Site + tb_clean + lv_clean, data = dt_ex, FUN = length)
for(tb in unique(lv_to_site$tb_clean)) {
    x <- lv_to_site[lv_to_site$tb_clean == tb,]
    p <- ggplot(x, aes(Site, lv_clean, size = research_name)) +
        geom_point(na.rm = TRUE) +
        ggtitle(tb)
    print(p)
}

Reproducibility

Code
sessionInfo()
R version 4.4.2 (2024-10-31)
Platform: aarch64-apple-darwin20
Running under: macOS Sonoma 14.7.4

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.0.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/New_York
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ggplot2_3.5.1    testthat_3.2.1.1 readr_2.1.5      tidyr_1.3.1     
[5] lubridate_1.9.3 

loaded via a namespace (and not attached):
 [1] bit_4.0.5         gtable_0.3.5      jsonlite_1.8.8    crayon_1.5.2     
 [5] dplyr_1.1.4       compiler_4.4.2    brio_1.1.5        tidyselect_1.2.1 
 [9] parallel_4.4.2    scales_1.3.0      yaml_2.3.8        fastmap_1.2.0    
[13] R6_2.5.1          labeling_0.4.3    generics_0.1.3    knitr_1.46       
[17] htmlwidgets_1.6.4 tibble_3.2.1      desc_1.4.3        munsell_0.5.1    
[21] rprojroot_2.0.4   pillar_1.9.0      tzdb_0.4.0        rlang_1.1.3      
[25] utf8_1.2.4        xfun_0.44         bit64_4.0.5       pkgload_1.3.4    
[29] timechange_0.3.0  cli_3.6.2         withr_3.0.0       magrittr_2.0.3   
[33] grid_4.4.2        digest_0.6.35     vroom_1.6.5       rstudioapi_0.16.0
[37] hms_1.1.3         lifecycle_1.0.4   waldo_0.5.2       vctrs_0.6.5      
[41] evaluate_0.23     glue_1.7.0        farver_2.1.2      colorspace_2.1-0 
[45] fansi_1.0.6       rmarkdown_2.27    purrr_1.0.2       tools_4.4.2      
[49] pkgconfig_2.0.3   htmltools_0.5.8.1