path="D:/Fluxnet/OUTCOME/MDS_TRY"
outpath="C:/Users/Lenovo/Desktop/R/outcome_try"
getwd()
setwd("D:/Fluxnet/OUTCOME/MDS_TRY")
#+++ load libraries used in this vignette
library(REddyProc)
library(dplyr)
file <- dir(path)
for(i in 1:length(file)){
EddyData <- fLoadTXTIntoDataframe(file[i])
#+++ Replace long runs of equal NEE values by NA
EddyData <- filterLongRuns(EddyData, "LE")
#+++ Add time stamp in POSIX time format and filter long runs of equal values
EddyDataWithPosix <- fConvertTimeToPosix(
EddyData, 'YDH',Year = 'Year',Day = 'DoY', Hour = 'Hour')
EProcMDS <- sEddyProc$new(
file[i], EddyDataWithPosix, c('LE', 'Rg', 'Tair', 'VPD'))
#Initialize 'NEE' as variable to fill
EProcMDS$sFillInit('LE')
# Set variables and tolerance intervals
V1 = 'Rg'; T1 = 50 # Global radiation 'Rg' within +/-50 W m-2
V2 = 'VPD'; T2 = 5 # Vapour pressure deficit 'VPD' within 5 hPa
V3 = 'Tair'; T3 = 2.5 # Air temperature 'Tair' within +/-2.5 degC
# Step 1: Look-up table with window size +/-7 days
ResultStep1 <- EProcMDS$sFillLUT(7, V1, T1, V2, T2, V3, T3)
# Step 2: Look-up table with window size +/-14 days
ResultStep2 <- EProcMDS$sFillLUT(14, V1, T1, V2, T2, V3, T3)
# Step 3: Look-up table with window size +/-7 days, Rg only
ResultStep3 <- EProcMDS$sFillLUT(7, V1, T1)
# Step 4: Mean diurnal course with window size 0 (same day)
ResultStep4 <- EProcMDS$sFillMDC(0)
# Step 5: Mean diurnal course with window size +/-1, +/-2 days
ResultStep5a <- EProcMDS$sFillMDC(1)
ResultStep5b <- EProcMDS$sFillMDC(2)
# Step 6: Look-up table with window size +/-21, +/-28, ..., +/-70
for (WinDays in seq(21, 70, 7) )
ResultStep6 <- EProcMDS$sFillLUT(WinDays, V1, T1, V2, T2, V3, T3)
# Step 7: Look-up table with window size +/-14, +/-21, ..., +/-70, Rg only
for (WinDays in seq(14, 70, 7) )
ResultStep7 <- EProcMDS$sFillLUT(WinDays, V1, T1)
# Step 8: Mean diurnal course with window size +/-7, +/-14, ..., +/-210 days
for (WinDays in seq(7, 210, 7) )
ResultStep8 <- EProcMDS$sFillMDC(WinDays)
# Export results, columns are named 'VAR_'
FilledEddyData <- EProcMDS$sExportResults()
format(FilledEddyData, scientific = F)
head(FilledEddyData)
fWriteDataframeToFile(format(FilledEddyData, scientific = F),paste(file[i]), outpath)
}
【MDS】
最新推荐文章于 2024-11-06 21:12:53 发布
本文深入探讨了机器学习中的一种重要降维技术——多维尺度缩放(MDS),解释了其基本原理,介绍了如何使用MDS进行数据可视化,并通过实例展示了MDS在高维数据处理中的应用。同时,讨论了MDS与其他降维方法如PCA和t-SNE的对比,帮助读者理解MDS在特定场景下的优势。
摘要由CSDN通过智能技术生成