[Reddyproc-users] Ask for help on REddyProc in R

Sun Xiangmin sunxm19 at gmail.com
Fri Jun 9 18:22:15 CEST 2017


Hi, All:

This is my code to use REddyProc for my two sites, n stands for north tower
and s stands for south.  This code is used for H and LE, but it similar to
CO2. Hope it helps you to write your own code.


##############=============================Gap
Filling========================####
######load data
###remember to add storage to flux for H and LE


######load data
# data(tower_n_2016_all)
tower_n_2016_all$new_NEE=tower_n_2016_all$co2_flux +
tower_n_2016_all$co2_strg
tower_n_2016_all$new_H=tower_n_2016_all$H + tower_n_2016_all$H_strg
tower_n_2016_all$new_LE=tower_n_2016_all$LE +tower_n_2016_all$LE_strg
tower_n_2016_all <- createTimestamp(tower_n_2016_all)
tower_n_2016_all <- fillTimestamp(tower_n_2016_all, "timestamp")
EddyData_north <- tower_n_2016_all[
,c("year","DOY","hour","new_NEE","new_LE","new_H","Rg_1_1_1","air_temperature","Ts_1_1_1","RH","VPD","u.")]
EddyData_north <- plyr::rename(EddyData_north, c("year"="Year",
"DOY"="DoY", "hour"="Hour", "new_NEE"="NEE","new_LE"="LE",
 "new_H"="H","Rg_1_1_1"="Rg", "air_temperature"= "Tair",  "Ts_1_1_1"=
"Tsoil","RH"="rH","VPD"= "VPD","u."="Ustar"))

##EddyData_north$NEE <-EddyData_north$co2_flux + EddyData_north$co2_strg

## EddyData_north <- EddyData_north[, -grep("co2_flux",
names(EddyData_north))]
###  EddyData_north <- EddyData_north[,
-grep("co2_strg",names(EddyData_north))]
summary(EddyData_north)
#EddyData_north$Tair = EddyData_north$Tair -273.15
EddyData_north$Tsoil = EddyData_north$Tsoil -273.15
EddyData_north$DoY =  floor(EddyData_north$DoY)
EddyData_north$VPD = EddyData_north$VPD/100

#summary(EddyData_north$NEE) =removeOutliers(EddyData_north$NEE, na.rm=TRUE)
#EddyData_north$LE =removeOutliers(EddyData_north$LE, na.rm=TRUE)
#EddyData_north$H =removeOutliers(EddyData_north$H, na.rm=TRUE)
#EddyData_north$Tsoil =removeOutliers(EddyData_north$Tsoil, na.rm=TRUE)
#EddyData_north$Rg =removeOutliers(EddyData_north$Rg, na.rm=TRUE)
EddyData_north = EddyData_north[-1,]

#######################################
library(REddyProc)

EddyData_north_WithPosix <- fConvertTimeToPosix(EddyData_north, 'YDH',
Year.s='Year', Day.s='DoY', Hour.s='Hour')

EddyProc.C_north <- sEddyProc$new("north", EddyData_north_WithPosix,
c('LE','Rg','Tair','VPD', 'Ustar'))

(uStarTh <- EddyProc.C_north$sEstUstarThreshold(NEEColName = "LE")$uStarTh)

EddyProc.C_north$sMDSGapFillAfterUstar('LE')
# Note the collumns with suffix _WithUstar
colnames(EddyProc.C_north$sExportResults())

#+++ Export gap filled and partitioned data to standard data frame
FilledEddyData.F_north_LE <- EddyProc.C_north$sExportResults()
############################
EddyProc.C_north <- sEddyProc$new("north", EddyData_north_WithPosix,
c('H','Rg','Tair','VPD', 'Ustar'))

(uStarTh <- EddyProc.C_north$sEstUstarThreshold(NEEColName = "H")$uStarTh)

EddyProc.C_north$sMDSGapFillAfterUstar('H',UstarSuffix.s = "WithUstar_H")

FilledEddyData.F_north_H <- EddyProc.C_north$sExportResults()

## colnames(EddyProc.C_north$sExportResults()) # Note the collumns with
suffix _WithUstar


#+++ Save results into (tab-delimited) text file in directory \out
CombinedData.F_north <- cbind(EddyData_north, FilledEddyData.F_north_LE,
FilledEddyData.F_north_H)


CombinedData.F_north_1 <- fConvertTimeToPosix(CombinedData.F_north,
TFormat.s='YDH', Year.s = "Year",
                                              Month.s = "none", Day.s =
"DoY", Hour.s = "Hour",
                                              Min.s = "none", TName.s =
"timestamp")
names(CombinedData.F_north)
head(CombinedData.F_north_1)

Gap_filled_north_final_result <-
  CombinedData.F_north_1[, c("timestamp", "Year", "DoY","Hour",
"LE_WithUstar_f","H_WithUstar_H_f","Rg")]
###==========================================gap Filling
Done==============================#####

ᐧ

On Fri, Jun 9, 2017 at 2:11 AM, Thomas Wutzler <twutz at bgc-jena.mpg.de>
wrote:

> Dear Fulin Yang,
>
> thanks for your interest in our REddyProc package.
>
> Unfortunately, we cannot offer general help on R.
> The package is developed for people to make use of the power and
> flexibility of a general programming language such as R.
>
> For simple standard applications we provide the web-tool, which is
> completely based on REddyProc:
> https://www.bgc-jena.mpg.de/bgi/index.php/Services/REddyProcWeb
>
> If you are near Jena, you may apply for an R beginners course of the
> IMPRS at our institute: http://www.imprs-gbgc.de
> Probably, you will find something similar near to you.
>
> Otherwise there are good R tutorials on the web for different backgrounds.
>
> I strongly recommend you, finding a colleague with some R experience to
> help you getting started and help you with problems. Most of the
> R-related problems are difficult to describe in general but are quickly
> solved by case by people with some experience.
>
>
> Yours,
> Thomas
>
> On 09.06.2017 03:58, Fulin Yang wrote:
> > Dear Prof. Thomas Wutzler,
> >
> >
> >
> > I am a new user of REddyPro in R, which is great contributions to the
> > eddy flux data processing.
> >
> >
> >
> > Previously, I used online version to perform flux data gap-filling and
> > partioning. It worked very well.
> >
> >
> >
> > Now, I try the R version, and have a big problem, due to not familiar to
> > R language. Maybe there are lots people like me, I think.
> >
> >
> >
> > I have to ask you for help. Do you have something like simple training
> > PPT with pictures on using of REddyPro in R, or some training videos,
> > please share me. This is very helpful for beginners. Many thanks,
> >
> >
> >
> > Best wishes,
> >
> >
> >
> > Fulin Yang
> >
> >
>
>
> _______________________________________________
> Reddyproc-users mailing list
> Reddyproc-users at lists.r-forge.r-project.org
> http://lists.r-forge.r-project.org/cgi-bin/mailman/
> listinfo/reddyproc-users
>
>


-- 
Xiangmin (Sam) Sun

PhD student
Department of Ecosystem Science and Management (ESSM)

Search, Search, Research!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/reddyproc-users/attachments/20170609/0c3351d2/attachment.html>


More information about the Reddyproc-users mailing list