zhujiedong / ReadLICOR6800

read LICOR LI-6800 data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Purpose

This package is use to read the data of LI-6800 photosynthesis system from LICOR. Currently it only contains 2 functions, one is for read a single excel file (read_li6800), and another (read_li6800_folder) is read a folder contains data files from LI-6800 as a dataframe, with a coloum of tags.

Important

I use openxlsx to read the excel data, because it can deal with the Formulas in LI-6800 excel data without any further pre-processing.

ReadLICOR6800

Installation

You can install the development version of ReadLICOR6800 from GitHub with:

# install.packages("devtools")
devtools::install_github("zhujiedong/ReadLICOR6800")

Example

Read a single file

This is a basic example which shows you how to solve a common problem:

library(ReadLICOR6800)
aci <- read_li6800('inst/extdata/racirtest1.xlsx', startRow = 15)
aci[1:3, 1:6]
#>   obs         time elapsed              date   hhmmss averaging
#> 2   1 1617082892.5       0 20210330 13:41:32 13:41:32         2
#> 3   2   1617082895     2.5 20210330 13:41:35 13:41:35         2
#> 4   3 1617082896.5       4 20210330 13:41:36 13:41:36         2
names(aci)
#>   [1] "obs"            "time"           "elapsed"        "date"          
#>   [5] "hhmmss"         "averaging"      "TIME"           "E"             
#>   [9] "Emm"            "A"              "Ca"             "Ci"            
#>  [13] "Pci"            "Pca"            "gsw"            "gbw"           
#>  [17] "gtw"            "gtc"            "Rabs"           "TleafEB"       
#>  [21] "TleafCnd"       "SVPleaf"        "RHcham"         "VPcham"        
#>  [25] "SVPcham"        "VPDleaf"        "LatHFlux"       "SenHFlux"      
#>  [29] "NetTherm"       "EBSum"          "Asty"           "Esty"          
#>  [33] "Adyn"           "Crd"            "Csd"            "dCsd/dt"       
#>  [37] "αVc"            "Edyn"           "Hr"             "Hs"            
#>  [41] "dHs/dt"         "αVh"            "Leak"           "LeakPct"       
#>  [45] "CorrFact"       "CorrFactPct"    "Fan"            "DarkAdaptedID" 
#>  [49] "Qmax_d"         "Fo"             "Fm"             "Fv/Fm"         
#>  [53] "A_dark"         "LightAdaptedID" "Qmax"           "Fs"            
#>  [57] "Fm'"            "PhiPS2"         "PS2/1"          "Qabs_fs"       
#>  [61] "A_fs"           "ETR"            "PhiCO2"         "NPQ"           
#>  [65] "alt..Fo'"       "DarkPulseID"    "Fmin"           "Fo'"           
#>  [69] "Fv'/Fm'"        "qP"             "qN"             "qP_Fo"         
#>  [73] "qN_Fo"          "qL"             "1-qL"           "Qin"           
#>  [77] "Qabs"           "alpha"          "convert"        "S"             
#>  [81] "K"              "Geometry"       "Custom"         "UseDynamic"    
#>  [85] "TIME"           "CO2_s"          "CO2_r"          "H2O_s"         
#>  [89] "H2O_r"          "CO2_a"          "H2O_a"          "Flow"          
#>  [93] "Pa"             "ΔPcham"         "Tair"           "Tleaf"         
#>  [97] "Tleaf2"         "Offset"         "Offset2"        "Fan_speed"     
#> [101] "Qamb_in"        "Qamb_out"       "Q"              "f_red"         
#> [105] "f_blue"         "f_farred"       "F"              "Q_modavg"      
#> [109] "F_dc"           "Pc"             "Tled"           "TDigital"      
#> [113] "TPreamp"        "TPwrSpy"        "TDrive"         "Q_red"         
#> [117] "Q_blue"         "Q_farred"       "TSPF"           "state"         
#> [121] "F_avg"          "dF/dt"          "dF_dc/dt"       "F_dc_avg"      
#> [125] "period"         "time"           "hhmmss"         "co2_t"         
#> [129] "h2o_t"          "count"          "co2_adj"        "h2o_adj"       
#> [133] "co2_match"      "h2o_match"      "co2_at"         "h2o_at"        
#> [137] "co2_cv"         "h2o_cv"         "MatchValveR"    "MatchValveS"   
#> [141] "MatchCO2"       "MatchH2O"       "cf_co2_a"       "cf_co2_b"      
#> [145] "cf_co2_c"       "cf_co2_d"       "cf_h2o_a"       "cf_h2o_b"      
#> [149] "cf_h2o_c"       "cf_h2o_d"       "co2_fit_low"    "co2_fit_high"  
#> [153] "h2o_fit_low"    "h2o_fit_high"   "co2_elapsed"    "h2o_elapsed"   
#> [157] "DIAG"           "Flow_s"         "Flow_r"         "Txchg"         
#> [161] "Tirga"          "Tchopper"       "Ts"             "Tr"            
#> [165] "CO2_%"          "Desiccant_%"    "Humidifier_%"   "Txchg_sp"      
#> [169] "CO2_r_sp"       "H2O_r_sp"       "SS_s"           "SS_r"          
#> [173] "data_tag"
aci$data_tag
#>   [1] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#>   [6] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#>  [11] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#>  [16] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#>  [21] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#>  [26] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#>  [31] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#>  [36] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#>  [41] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#>  [46] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#>  [51] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#>  [56] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#>  [61] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#>  [66] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#>  [71] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#>  [76] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#>  [81] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#>  [86] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#>  [91] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#>  [96] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [101] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [106] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [111] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [116] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [121] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [126] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [131] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [136] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [141] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [146] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [151] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [156] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [161] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [166] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [171] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [176] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [181] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [186] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [191] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [196] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [201] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [206] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [211] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [216] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [221] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [226] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [231] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [236] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [241] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [246] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [251] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [256] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [261] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [266] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [271] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [276] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [281] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [286] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [291] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [296] "racirtest1" "racirtest1" "racirtest1"

by use the default arguments, the returned dataframe will contain a new column contains the name of the file called data_tag, it is used to distinguish files when reading all the files in a folder. the data_tag can also be changed to a custom one, use the tags="custom tags", where custom tags is what you need.

if you need to read only one file, it is not needed:

aci <- read_li6800("inst/extdata/racirtest1.xlsx", add_tags = FALSE)
names(aci)
#>   [1] "obs"            "time"           "elapsed"        "date"          
#>   [5] "hhmmss"         "averaging"      "TIME"           "E"             
#>   [9] "Emm"            "A"              "Ca"             "Ci"            
#>  [13] "Pci"            "Pca"            "gsw"            "gbw"           
#>  [17] "gtw"            "gtc"            "Rabs"           "TleafEB"       
#>  [21] "TleafCnd"       "SVPleaf"        "RHcham"         "VPcham"        
#>  [25] "SVPcham"        "VPDleaf"        "LatHFlux"       "SenHFlux"      
#>  [29] "NetTherm"       "EBSum"          "Asty"           "Esty"          
#>  [33] "Adyn"           "Crd"            "Csd"            "dCsd/dt"       
#>  [37] "αVc"            "Edyn"           "Hr"             "Hs"            
#>  [41] "dHs/dt"         "αVh"            "Leak"           "LeakPct"       
#>  [45] "CorrFact"       "CorrFactPct"    "Fan"            "DarkAdaptedID" 
#>  [49] "Qmax_d"         "Fo"             "Fm"             "Fv/Fm"         
#>  [53] "A_dark"         "LightAdaptedID" "Qmax"           "Fs"            
#>  [57] "Fm'"            "PhiPS2"         "PS2/1"          "Qabs_fs"       
#>  [61] "A_fs"           "ETR"            "PhiCO2"         "NPQ"           
#>  [65] "alt..Fo'"       "DarkPulseID"    "Fmin"           "Fo'"           
#>  [69] "Fv'/Fm'"        "qP"             "qN"             "qP_Fo"         
#>  [73] "qN_Fo"          "qL"             "1-qL"           "Qin"           
#>  [77] "Qabs"           "alpha"          "convert"        "S"             
#>  [81] "K"              "Geometry"       "Custom"         "UseDynamic"    
#>  [85] "TIME"           "CO2_s"          "CO2_r"          "H2O_s"         
#>  [89] "H2O_r"          "CO2_a"          "H2O_a"          "Flow"          
#>  [93] "Pa"             "ΔPcham"         "Tair"           "Tleaf"         
#>  [97] "Tleaf2"         "Offset"         "Offset2"        "Fan_speed"     
#> [101] "Qamb_in"        "Qamb_out"       "Q"              "f_red"         
#> [105] "f_blue"         "f_farred"       "F"              "Q_modavg"      
#> [109] "F_dc"           "Pc"             "Tled"           "TDigital"      
#> [113] "TPreamp"        "TPwrSpy"        "TDrive"         "Q_red"         
#> [117] "Q_blue"         "Q_farred"       "TSPF"           "state"         
#> [121] "F_avg"          "dF/dt"          "dF_dc/dt"       "F_dc_avg"      
#> [125] "period"         "time"           "hhmmss"         "co2_t"         
#> [129] "h2o_t"          "count"          "co2_adj"        "h2o_adj"       
#> [133] "co2_match"      "h2o_match"      "co2_at"         "h2o_at"        
#> [137] "co2_cv"         "h2o_cv"         "MatchValveR"    "MatchValveS"   
#> [141] "MatchCO2"       "MatchH2O"       "cf_co2_a"       "cf_co2_b"      
#> [145] "cf_co2_c"       "cf_co2_d"       "cf_h2o_a"       "cf_h2o_b"      
#> [149] "cf_h2o_c"       "cf_h2o_d"       "co2_fit_low"    "co2_fit_high"  
#> [153] "h2o_fit_low"    "h2o_fit_high"   "co2_elapsed"    "h2o_elapsed"   
#> [157] "DIAG"           "Flow_s"         "Flow_r"         "Txchg"         
#> [161] "Tirga"          "Tchopper"       "Ts"             "Tr"            
#> [165] "CO2_%"          "Desiccant_%"    "Humidifier_%"   "Txchg_sp"      
#> [169] "CO2_r_sp"       "H2O_r_sp"       "SS_s"           "SS_r"
head(aci$data_tags)
#> NULL

But be sure to supply the right startRow to read the data. It is the header of the measuring data, start with ‘obs’(the first column)

Read all files from a folder

It is similar with read_li6800, but usually we may need to specify the tags to distinguish the combined dataframe that from lots of excel files, if tags=NULL(default), data_tagcolumn will use the file name as a tag:

list.files("inst/extdata/")
#> [1] "racirtest1.xlsx" "racirtest3.xlsx"

aci <- read_li6800_folder("inst/extdata/")
names(aci)
#>   [1] "obs"            "time"           "elapsed"        "date"          
#>   [5] "hhmmss"         "averaging"      "TIME"           "E"             
#>   [9] "Emm"            "A"              "Ca"             "Ci"            
#>  [13] "Pci"            "Pca"            "gsw"            "gbw"           
#>  [17] "gtw"            "gtc"            "Rabs"           "TleafEB"       
#>  [21] "TleafCnd"       "SVPleaf"        "RHcham"         "VPcham"        
#>  [25] "SVPcham"        "VPDleaf"        "LatHFlux"       "SenHFlux"      
#>  [29] "NetTherm"       "EBSum"          "Asty"           "Esty"          
#>  [33] "Adyn"           "Crd"            "Csd"            "dCsd/dt"       
#>  [37] "αVc"            "Edyn"           "Hr"             "Hs"            
#>  [41] "dHs/dt"         "αVh"            "Leak"           "LeakPct"       
#>  [45] "CorrFact"       "CorrFactPct"    "Fan"            "DarkAdaptedID" 
#>  [49] "Qmax_d"         "Fo"             "Fm"             "Fv/Fm"         
#>  [53] "A_dark"         "LightAdaptedID" "Qmax"           "Fs"            
#>  [57] "Fm'"            "PhiPS2"         "PS2/1"          "Qabs_fs"       
#>  [61] "A_fs"           "ETR"            "PhiCO2"         "NPQ"           
#>  [65] "alt..Fo'"       "DarkPulseID"    "Fmin"           "Fo'"           
#>  [69] "Fv'/Fm'"        "qP"             "qN"             "qP_Fo"         
#>  [73] "qN_Fo"          "qL"             "1-qL"           "Qin"           
#>  [77] "Qabs"           "alpha"          "convert"        "S"             
#>  [81] "K"              "Geometry"       "Custom"         "UseDynamic"    
#>  [85] "TIME"           "CO2_s"          "CO2_r"          "H2O_s"         
#>  [89] "H2O_r"          "CO2_a"          "H2O_a"          "Flow"          
#>  [93] "Pa"             "ΔPcham"         "Tair"           "Tleaf"         
#>  [97] "Tleaf2"         "Offset"         "Offset2"        "Fan_speed"     
#> [101] "Qamb_in"        "Qamb_out"       "Q"              "f_red"         
#> [105] "f_blue"         "f_farred"       "F"              "Q_modavg"      
#> [109] "F_dc"           "Pc"             "Tled"           "TDigital"      
#> [113] "TPreamp"        "TPwrSpy"        "TDrive"         "Q_red"         
#> [117] "Q_blue"         "Q_farred"       "TSPF"           "state"         
#> [121] "F_avg"          "dF/dt"          "dF_dc/dt"       "F_dc_avg"      
#> [125] "period"         "time"           "hhmmss"         "co2_t"         
#> [129] "h2o_t"          "count"          "co2_adj"        "h2o_adj"       
#> [133] "co2_match"      "h2o_match"      "co2_at"         "h2o_at"        
#> [137] "co2_cv"         "h2o_cv"         "MatchValveR"    "MatchValveS"   
#> [141] "MatchCO2"       "MatchH2O"       "cf_co2_a"       "cf_co2_b"      
#> [145] "cf_co2_c"       "cf_co2_d"       "cf_h2o_a"       "cf_h2o_b"      
#> [149] "cf_h2o_c"       "cf_h2o_d"       "co2_fit_low"    "co2_fit_high"  
#> [153] "h2o_fit_low"    "h2o_fit_high"   "co2_elapsed"    "h2o_elapsed"   
#> [157] "DIAG"           "Flow_s"         "Flow_r"         "Txchg"         
#> [161] "Tirga"          "Tchopper"       "Ts"             "Tr"            
#> [165] "CO2_%"          "Desiccant_%"    "Humidifier_%"   "Txchg_sp"      
#> [169] "CO2_r_sp"       "H2O_r_sp"       "SS_s"           "SS_r"          
#> [173] "data_tag"
head(aci$data_tag)
#> [1] "racirtest1" "racirtest1" "racirtest1" "racirtest1" "racirtest1"
#> [6] "racirtest1"
tail(aci$data_tag)
#> [1] "racirtest3" "racirtest3" "racirtest3" "racirtest3" "racirtest3"
#> [6] "racirtest3"

when use custom tags, make sure the tags have the right order and right length with what the list.files() shows

aci <- read_li6800_folder("inst/extdata/", tags = paste('test', 1:2))
aci[1:3, 1:6]
#>   obs         time elapsed              date   hhmmss averaging
#> 1   1 1617082892.5       0 20210330 13:41:32 13:41:32         2
#> 2   2   1617082895     2.5 20210330 13:41:35 13:41:35         2
#> 3   3 1617082896.5       4 20210330 13:41:36 13:41:36         2
names(aci)
#>   [1] "obs"            "time"           "elapsed"        "date"          
#>   [5] "hhmmss"         "averaging"      "TIME"           "E"             
#>   [9] "Emm"            "A"              "Ca"             "Ci"            
#>  [13] "Pci"            "Pca"            "gsw"            "gbw"           
#>  [17] "gtw"            "gtc"            "Rabs"           "TleafEB"       
#>  [21] "TleafCnd"       "SVPleaf"        "RHcham"         "VPcham"        
#>  [25] "SVPcham"        "VPDleaf"        "LatHFlux"       "SenHFlux"      
#>  [29] "NetTherm"       "EBSum"          "Asty"           "Esty"          
#>  [33] "Adyn"           "Crd"            "Csd"            "dCsd/dt"       
#>  [37] "αVc"            "Edyn"           "Hr"             "Hs"            
#>  [41] "dHs/dt"         "αVh"            "Leak"           "LeakPct"       
#>  [45] "CorrFact"       "CorrFactPct"    "Fan"            "DarkAdaptedID" 
#>  [49] "Qmax_d"         "Fo"             "Fm"             "Fv/Fm"         
#>  [53] "A_dark"         "LightAdaptedID" "Qmax"           "Fs"            
#>  [57] "Fm'"            "PhiPS2"         "PS2/1"          "Qabs_fs"       
#>  [61] "A_fs"           "ETR"            "PhiCO2"         "NPQ"           
#>  [65] "alt..Fo'"       "DarkPulseID"    "Fmin"           "Fo'"           
#>  [69] "Fv'/Fm'"        "qP"             "qN"             "qP_Fo"         
#>  [73] "qN_Fo"          "qL"             "1-qL"           "Qin"           
#>  [77] "Qabs"           "alpha"          "convert"        "S"             
#>  [81] "K"              "Geometry"       "Custom"         "UseDynamic"    
#>  [85] "TIME"           "CO2_s"          "CO2_r"          "H2O_s"         
#>  [89] "H2O_r"          "CO2_a"          "H2O_a"          "Flow"          
#>  [93] "Pa"             "ΔPcham"         "Tair"           "Tleaf"         
#>  [97] "Tleaf2"         "Offset"         "Offset2"        "Fan_speed"     
#> [101] "Qamb_in"        "Qamb_out"       "Q"              "f_red"         
#> [105] "f_blue"         "f_farred"       "F"              "Q_modavg"      
#> [109] "F_dc"           "Pc"             "Tled"           "TDigital"      
#> [113] "TPreamp"        "TPwrSpy"        "TDrive"         "Q_red"         
#> [117] "Q_blue"         "Q_farred"       "TSPF"           "state"         
#> [121] "F_avg"          "dF/dt"          "dF_dc/dt"       "F_dc_avg"      
#> [125] "period"         "time"           "hhmmss"         "co2_t"         
#> [129] "h2o_t"          "count"          "co2_adj"        "h2o_adj"       
#> [133] "co2_match"      "h2o_match"      "co2_at"         "h2o_at"        
#> [137] "co2_cv"         "h2o_cv"         "MatchValveR"    "MatchValveS"   
#> [141] "MatchCO2"       "MatchH2O"       "cf_co2_a"       "cf_co2_b"      
#> [145] "cf_co2_c"       "cf_co2_d"       "cf_h2o_a"       "cf_h2o_b"      
#> [149] "cf_h2o_c"       "cf_h2o_d"       "co2_fit_low"    "co2_fit_high"  
#> [153] "h2o_fit_low"    "h2o_fit_high"   "co2_elapsed"    "h2o_elapsed"   
#> [157] "DIAG"           "Flow_s"         "Flow_r"         "Txchg"         
#> [161] "Tirga"          "Tchopper"       "Ts"             "Tr"            
#> [165] "CO2_%"          "Desiccant_%"    "Humidifier_%"   "Txchg_sp"      
#> [169] "CO2_r_sp"       "H2O_r_sp"       "SS_s"           "SS_r"          
#> [173] "data_tag"
head(aci$data_tag)
#> [1] "test 1" "test 1" "test 1" "test 1" "test 1" "test 1"
tail(aci$data_tag)
#> [1] "test 2" "test 2" "test 2" "test 2" "test 2" "test 2"

About

read LICOR LI-6800 data

License:GNU General Public License v3.0


Languages

Language:R 100.0%