soilDB
soilDB copied to clipboard
multiple sensors -- fetchSCAN
There are some SCAN/SNOTEL stations with multiple (above-ground) sensors per sensor prefix. For example:
library(soilDB)
m <- SCAN_sensor_metadata(site.code=c(482,613))
m[, 1:3]
site.code Label Element
1 482 WTEQ.I-1 Snow Water Equivalent
2 482 WTEQ.I-2 Snow Water Equivalent
3 482 PREC.I-1 Precipitation Accumulation
4 482 PREC.I-2 Precipitation Accumulation
5 482 TOBS.I-1 Air Temperature Observed
6 482 TOBS.I-2 Air Temperature Observed
7 482 TOBS.I-3 Air Temperature Observed
8 482 TMAX.D-1 Air Temperature Maximum
9 482 TMIN.D-1 Air Temperature Minimum
As of ab70a989fa8c9c86d495e3d3f1e4e5a9921caa59 fetchSCAN()
will issue a message and then naively use the first sensor.
A better solution would require significant changes to fetchSCAN()
and / or working with SCAN admins.
There are apparently some SCAN sites with multiple below-ground sensors too.
Several possible solutions:
- include all sensors and add an ID (done)
- include a message when there are > 2 IDs per sensor type
- keep the first sensor (current approach for above-ground sensors)
- keep the sensor with the most data associated with it (by year)
- apply an aggregation function
Examples to follow-up on.
## station 482
##
## WTEQ.I WTEQ.I-2 PREC.I PREC.I-2 TOBS.I TOBS.I-2 TOBS.I-3 TMAX.D TMIN.D TAVG.D SNWD.I SMS.I_8 STO.I_8
## example of multiple versions of the below-ground sensors
## due to sensor repair, replacement, upgrades, loss of function, ???
##
## station 2196
##
## "STO.I-1:-2", "STO.I-1:-4", "STO.I-1:-8", "STO.I-1:-20", "STO.I-1:-40",
## "STO.I-2:-2", "STO.I-2:-4", "STO.I-2:-8", "STO.I-2:-20", "STO.I-2:-40"
## example of multiple versions of the below-ground sensors
## due to sensor repair, replacement, upgrades, loss of function, ???
RE: site 2196
I am pretty sure that these are actually duplicate below-ground sensors. Both sensors are active as of 2021. The values are very similar but not identical.
library(soilDB)
f <- fetchSCAN(2196, 2021)
#> multiple sensors per depth [site 2196] STO.I_2, STO.I_4, STO.I_8, STO.I_20, STO.I_40, STO.I-2_2, STO.I-2_4, STO.I-2_8, STO.I-2_20, STO.I-2_40
#> 7301 records (0.33 Mb transferred)
f1 <- subset(f$STO, f$STO$sensor.id == "STO.I_2")
f2 <- subset(f$STO, f$STO$sensor.id == "STO.I-2_2")
plot(f1$value~f1$Date, type="l", lty = 2)
lines(f2$value~f2$Date, lty = 3)
summary(lm(f1$value ~ f2$value))
#>
#> Call:
#> lm(formula = f1$value ~ f2$value)
#>
#> Residuals:
#> Min 1Q Median 3Q Max
#> -0.214075 -0.051135 -0.000856 0.044210 0.185177
#>
#> Coefficients:
#> Estimate Std. Error t value Pr(>|t|)
#> (Intercept) -0.0991436 0.0058147 -17.05 <2e-16 ***
#> f2$value 1.0093109 0.0004542 2222.12 <2e-16 ***
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#>
#> Residual standard error: 0.06935 on 363 degrees of freedom
#> Multiple R-squared: 0.9999, Adjusted R-squared: 0.9999
#> F-statistic: 4.938e+06 on 1 and 363 DF, p-value: < 2.2e-16
Good, those are simpler to account for. Keep in mind those notes and this issue has to do with all of the potential reasons for multiple sensors / type / depth. These were examples to follow-up on.
Do you have an example site ID where a sensor was replaced? I'd like to see one of those
An example might be sitenum=783