The script Filtering_snow_height.R in folder inst want to increase quality of data of snow height signal measured with a SR50AT sensor produced by Campbell Scientific (Link). In our data there is some problems, for exmaple some data are out of a phisycal range. To identify these sampling problems we apply some thresholds on range and on increasing/decreasing rate filtering improbable values. After these process the main objective is filtering remaining noise. We apply 2 methods: a moving average filter with a window of 5 hours and a Savitzky-Golay smoothing filter.Documentation of Savitzky-Golay smoothing filter are available online (https://cran.r-project.org/web/packages/signal/signal.pdf)[1]. The main problem of moving average is the smoothing of true snowfall peaks, the Savitzky-Golay smoothing filter seems to exclude this, if we set a small a filter length. In our analysis we observe some strange phenomenous during snow melting. The snow height signal, expecially during warm and sunny days in spring, has a minimum in the middle of afternoon and increase during the night. Our first hypothesis was that the temperature correction applied, as suggest in User Manual, was not enough. The second hypotesys was that the snow react in a different way depending on his status. So the ultrasonic signal penetrates more in melted snow than in fresh or not melted snow. Open issues: how to filter this snow signal?
Section 1: in this section you have to select git_folder and file of data. This files must contain the column: Snow_Height
Section 2: here the script import data and extract snow column using the input section.
Section 3: more realistic data are created in this section using snow depth calibration point. In the file Snow_Depth_Calibration_file.csv in folder data/Snow_Depth_Calibration/ you can insert real snow surveys (snow height under ultrasoni sensor), or virtual snow survey (observing time series and set the value at the dates of end of snow season as 0 cm). With these informations we can calibrate snow height time series. The calibration function apply a linear transformation between 2 snow depth measurements, and a constant transformation from the last snow survey and the end of time series.
Section 4: in this section the algorithm substitute value out of range and value with high increasing/decreasing rate with NA. Data out of phisycal range are considered improbable, as data that change fastly.
Section 5: here the algorithm perform a filtering of snow height signal in two different ways. The first is a moving average filter, which has the problem of smoothing of true snowfall signal. The second is a Savitzky-Golay smoothing filter that seems to work better than moving average expecially setting small value for filter period. The smoothig process can create values with not realistic behaviour, so a rate thresholds as in section 3 is applied on filtered value, as suggested in Comai thesis [2]. At the end of Section 5 you can select which is your favourite smoothing filter to save in Section 6
Section 6: in this section the algorithm save a dataframe cointaining some partial results of filtering snow signal as:
INPUT:
METHOD:
Select in section METHOD the one of the following smoothing filter. Assign to SMOOTH_METHOD: "Savitzky_Golay"
OUTPUT:
Snow_file.RData: in folder data/Output/Snow_Filtering_RData/ an .RData file which contain a list of zoo time series of:
Snow_file.csv: in folder data/Output/Snow_Filtering/ a.csv file which contains some time series of snow height and manipulation. The columns are:
Note: in the output names above the algorithm substitute automatically "file" with the name of station, setting in file <- "..." (INPUT 2)
NOTE
Note on file Snow_Depth_Calibration_FILE.csv. This file contain all snow surveys and snow calibration point used to calibrate raw data of ultrasonic snow sensor.
Open script Filtering_snow_height.R and:
[1] William H. Press, Saul A. Teukolsky, William T. Vetterling, Brian P. Flannery, Numerical Recipes in C: The Art of Scientific Computing , 2nd edition, Cambridge Univ. Press, N.Y., 1992.
[2] Comai T. ,Analisi spaziale e temporale delle precipitazioni nevose nelle alpi italiane, Rel. Rigon Riccardo, Università degli Studi di Trento, AA 2013/2014
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.