Closed michaelstrupler closed 3 months ago
"if timesteps are not regular (i.e. if function convertToRegularTimesteps is not applied), the function subsetContiguous gives an error."
Can you, please provide a minimal working example (MWE) of error in subsetContiguous
with non-equidistant time steps?
The following MWE works with non-equidistant time steps on current master.
fName <- system.file(
"genData/SMANIE_Chamber1_26032015.zip", package = "RespChamberProc")
ds0 <- readDat(
unz(fName, filename = unzip(fName, list = TRUE)[1,"Name"] ),tz = "UTC")
ds <- ds0 %>%
filter(UQ(sym("TIMESTAMP")) < as.POSIXct("2015-03-26 06:29:12", tz = "UTC"))
ds$Pa <- ds$AirPres * 100 # convert hPa to Pa
ds$CO2_dry <- corrConcDilution(ds, colConc = "CO2_LI840", colVapour = "H2O_LI840")
ds$H2O_dry <- corrConcDilution(ds, colConc = "H2O_LI840", colVapour = "H2O_LI840")
ds$VPD <- calcVPD( ds$SurTemp, ds$Pa, ds$H2O_LI840)
#
diff(ds$TIMESTAMP)
ds <- mutate(ds, TIMESTAMP = TIMESTAMP + pmin(0.04, pmax(-0.04,rnorm(n(),0.0, 0.2))))
#
dsChunked <- subsetContiguous(ds, colTime = "TIMESTAMP", colIndex = "Collar")
Hi Thomas,
Please find attached the MWE and the sample data (zipped) we used.
if we don’t interpolate the timesteps and convert them to a regular interval of 1 sec, we get the following error:
Warning message:
Unknown or uninitialised column: iChunk
.
head(dsChunk)
A tibble: 0 × 1
ℹ 1 variable: iChunk
Thanks and best regards, Michael
 
Michael Strupler, Dr. Sc.
On 10 Jun 2024, at 16:28, Thomas Wutzler @.***> wrote:
"if timesteps are not regular (i.e. if function convertToRegularTimesteps is not applied), the function subsetContiguous gives an error."
Can you, please provide a minimal working example (MWE) of error in subsetContiguous with non-equidistant time steps?
The following MWE works with non-equidistant time steps on current master.
fName <- system.file( "genData/SMANIE_Chamber1_26032015.zip", package = "RespChamberProc") ds0 <- readDat( unz(fName, filename = unzip(fName, list = TRUE)[1,"Name"] ),tz = "UTC") ds <- ds0 %>% filter(UQ(sym("TIMESTAMP")) < as.POSIXct("2015-03-26 06:29:12", tz = "UTC")) ds$Pa <- ds$AirPres * 100 # convert hPa to Pa ds$CO2_dry <- corrConcDilution(ds, colConc = "CO2_LI840", colVapour = "H2O_LI840") ds$H2O_dry <- corrConcDilution(ds, colConc = "H2O_LI840", colVapour = "H2O_LI840") ds$VPD <- calcVPD( ds$SurTemp, ds$Pa, ds$H2O_LI840) # diff(ds$TIMESTAMP) ds <- mutate(ds, TIMESTAMP = TIMESTAMP + pmin(0.04, pmax(-0.04,rnorm(n(),0.0, 0.2)))) # dsChunked <- subsetContiguous(ds, colTime = "TIMESTAMP", colIndex = "Collar")
— Reply to this email directly, view it on GitHub https://github.com/bgctw/RespChamberProc/issues/7#issuecomment-2158524134, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ3TPVN3WGCNTYG2AJNMFWLZGWZ2TAVCNFSM6AAAAABI23DHXWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJYGUZDIMJTGQ. You are receiving this because you authored the thread.
Dear Michael,
I debugged the code and data that you sent additionally by email. The problem is with argument "gapLength = 1" in
dsChunk <- subsetContiguous(ds, colTime = "TIMESTAMP", colIndex = "Collar",
gapLength = 1, minNRec = 180, minTime = 180, indexNA = 13)
where you tell that differences in timestamps larger than 1 second indicate the start of another contiguous series. The default of 12 seconds is convenient for a chamber that you move around and place it on different collars and initiate another measurement cycle or automatic chambers that only run (an log) each x minutes.
With non-equidistant time steps, there were many changes below 1 second. so that resulting contiguous series were shorter than 180 records or 180s, so that there was no valid contiguous series.
Please, try with an increased value of gapLength
, or keep the default of 12 seconds.
Then RespChamberProc should work with the original TimeStamps.
Yours Thomas
Dear Thomas,
Thanks for clarification regarding the increased value of gapLength. Ok, I see, so the function to create continuous timestamps becomes obsolete.
Thanks again, Michael
On 11 Jun 2024, at 15:48, Thomas Wutzler @.***> wrote:
Dear Michael,
I debugged the code and data that you sent additionally by email. The problem is with argument "gapLength = 1" in
dsChunk <- subsetContiguous(ds, colTime = "TIMESTAMP", colIndex = "Collar", gapLength = 1, minNRec = 180, minTime = 180, indexNA = 13) where you tell that differences in timestamps larger than 1 second indicate the start of another contiguous series. The default of 12 seconds is convenient for a chamber that you move around and place it on different collars and initiate another measurement cycle or automatic chambers that only run (an log) each x minutes.
With non-equidistant time steps, there were many changes below 1 second. so that resulting contiguous series were shorter than 180 records or 180s, so that there was no valid contiguous series.
Please, try with an increased value of gapLength, or keep the default of 12 seconds. Then RespChamberProc should work with the original TimeStamps.
Yours Thomas
— Reply to this email directly, view it on GitHub https://github.com/bgctw/RespChamberProc/issues/7#issuecomment-2160815523, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ3TPVITVJLIRTQ73TACR43ZG353LAVCNFSM6AAAAABI23DHXWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRQHAYTKNJSGM. You are receiving this because you authored the thread.
Hi Thomas,
Thought the gapLength should be adapted to the new setup the issue I see is that PICARRO collect data continuously and there is no time off when moving the chamber except the valve (collar) number.
Cheers Oscar
On 11 Jun 2024, at 16:42, Michael Strupler @.***> wrote:
Dear Thomas,
Thanks for clarification regarding the increased value of gapLength. Ok, I see, so the function to create continuous timestamps becomes obsolete.
Thanks again, Michael
On 11 Jun 2024, at 15:48, Thomas Wutzler @.***> wrote:
Dear Michael,
I debugged the code and data that you sent additionally by email. The problem is with argument "gapLength = 1" in
dsChunk <- subsetContiguous(ds, colTime = "TIMESTAMP", colIndex = "Collar", gapLength = 1, minNRec = 180, minTime = 180, indexNA = 13) where you tell that differences in timestamps larger than 1 second indicate the start of another contiguous series. The default of 12 seconds is convenient for a chamber that you move around and place it on different collars and initiate another measurement cycle or automatic chambers that only run (an log) each x minutes.
With non-equidistant time steps, there were many changes below 1 second. so that resulting contiguous series were shorter than 180 records or 180s, so that there was no valid contiguous series.
Please, try with an increased value of gapLength, or keep the default of 12 seconds. Then RespChamberProc should work with the original TimeStamps.
Yours Thomas
— Reply to this email directly, view it on GitHub https://urldefense.com/v3/__https://github.com/bgctw/RespChamberProc/issues/7*issuecomment-2160815523__;Iw!!D9dNQwwGXtA!UD1dN_YlfcCJD9Tixbhk9POzeEP8F2A4FPxHxv5nbxx1PZzFijUqhgpy1-mmJurMmSDdZBik2e0M5NU4LAGSa9xKAcDW$, or unsubscribe https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AJ3TPVITVJLIRTQ73TACR43ZG353LAVCNFSM6AAAAABI23DHXWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRQHAYTKNJSGM__;!!D9dNQwwGXtA!UD1dN_YlfcCJD9Tixbhk9POzeEP8F2A4FPxHxv5nbxx1PZzFijUqhgpy1-mmJurMmSDdZBik2e0M5NU4LAGSa7zywy2C$. You are receiving this because you authored the thread.
Dear Oscar, note the "either" in the function documentation: "to determine these chunks, either a change in an index variable (input by between the measurements) or a gap in time is used."
The raw timesteps of the PICARRO output look like this, i.e. they are not regular:
convertToRegularTimesteps
is not applied), the functionsubsetContiguous
gives an error.I have added the /functions subfolder here in Oscar's repository: RespChamberProc/main/functions