Commit 496bf320 authored by Georges Kunstler's avatar Georges Kunstler
Browse files

pb with new ius data

parent 6b35996d
......@@ -37,7 +37,7 @@ include mk/cible.tree.traits.mk
TRY: $(D2)/TRY/data.TRY.std.rds
$(D2)/TRY/data.TRY.std.rds:
Rscript scripts/format.data/TRY.R
R CMD BATCH scripts/format.data/TRY.R
#-------------------------------------------------------
GLOBAL: $(D3)/Done.txt
......@@ -54,19 +54,19 @@ $(D3)/Done.t.txt: scripts/process.data/merge.all.processed.data.R $(sites)
TEST.TREE: $(D4)/Done.txt tree.all.sites
$(D4)/Done.txt: scripts/format.data/test.tree.R $(D3tree)
Rscript $<
R CMD BATCH $<
#-------------------------------------------------------
TEST.TRAITS: $(D5)/Done.txt #traits.all.sites
$(D5)/Done.txt: scripts/find.trait/test.traits.R $(D3traits)
Rscript $<
R CMD BATCH $<
#-------------------------------------------------------
TEST.CWM: $(D6)/Done.txt
$(D6)/Done.txt: scripts/process.data/test.tree.CWM.R $(D3Done)
Rscript $<
R CMD BATCH $<
#-------------------------------------------------------
......
......@@ -24,7 +24,7 @@ fun.test.one.trait.data <- function(i, data, trait.name, t.min, t.max) {
fun.test.range.traits <- function(data.traits, set) {
trait.name <- c("Leaf.N.mean", "Seed.mass.mean", "SLA.mean",
"Wood.density.mean", "Max.height.mean")
t.min <- c(2, 0.0001, 1, 0.1, 1)
t.min <- c(2, 0.0001, 0.9, 0.1, 1)
t.max <- c(60, 600000, 100, 1.5, 100)
vec.test <- sapply(1:5, fun.test.one.trait.data,
data.traits, trait.name, t.min, t.max)
......@@ -34,31 +34,6 @@ fun.test.range.traits <- function(data.traits, set) {
else { print("All traits within suitable range") }
}
fun.test.one.trait <- function(t, t.min, t.max){
if(sum(!is.na(t))) {
res <- (max(t, na.rm = TRUE) >t.max ) | (min(t, na.rm = TRUE)<t.min)
}
else{ res <- FALSE }
return(res)
}
fun.test.one.trait.data <- function(i, data, trait.name, t.min, t.max) {
fun.test.one.trait(data[[trait.name[i]]], t.min[i], t.max[i])
}
fun.test.range.traits <- function(data.traits, set) {
trait.name <- c("Leaf.N.mean", "Seed.mass.mean", "SLA.mean",
"Wood.density.mean", "Max.height.mean")
t.min <- c(2, 0.00001, 1, 0.1, 1)
t.max <- c(60, 600000, 140, 1.5, 100)
vec.test <- sapply(1:5, fun.test.one.trait.data, data.traits,
trait.name, t.min, t.max)
if(any(vec.test))
stop(paste("Trait",
paste(trait.name[vec.test], collapse = " ") ,
"out of range for set", set))
}
## test type of variable
fun.test.type.data <- function(t.name, data, type.t, set) {
t <- data[[t.name]]
......
......@@ -41,8 +41,8 @@ fun.std.data.global <- function(data.TRAITS, mean.global, sd.global) {
traits.mean <- c("Leaf.N.mean", "Seed.mass.mean", "SLA.mean", "Wood.density.mean", "Max.height.mean")
for (i in traits.mean) {
data.TRAITS[[i]] <- scale(log10(data.TRAITS[[i]]),
center = rep_len(mean.global[i], nrow(data.TRAITS)),
scale = rep_len(sd.global[i], nrow(data.TRAITS))) }
center = mean.global[i],
scale = sd.global[i]) }
return(data.TRAITS)
}
......@@ -237,7 +237,7 @@ fun.CWM.abs.all <- function(df, traits = c("Leaf.N", "Seed.mass", "SLA",
names.abs <- paste(traits, "abs.CWM.fill", sep = '.')
df.res <- as.data.frame(lapply(traits, fun.CWM.abs.trait, data = df))
names(df.res) <- names.abs
df.res[['obs.id']] <- df[['obs.id']]
df.res$obs.id <- df[['obs.id']]
return(df.res)
}
......@@ -270,8 +270,8 @@ fun.CWM.Tn <- function(data){
Seed.mass.perc.genus = sum(!Seed.mass.genus,
na.rm = TRUE)/count,
Seed.mass.perc.species = (sum(!Seed.mass.genus,na.rm = TRUE)+
sum(!is.na(Seed.mass.genus)))/count
) %>% select(-count) %>%x ungroup()
sum(!is.na(Seed.mass.genus)))/count) %>%
select(-count) %>% ungroup()
data <- left_join(data, data.plot, by = 'plot.c')
## remove BA obs tree
......@@ -799,8 +799,8 @@ fun.reform.data.and.remove.outlier <- function(data.all,
data.all[ , tree.id := paste(ecocode, tree.id)]
data.all[ , obs.id := paste(ecocode, obs.id)]
if(std.traits.TF) fun.standardized.traits(data.all)
data.all[ , plot.c := paste(plot, census)]
data.all <- as.data.frame(data.all)
data.all[ , plot.c = paste(plot, census)]
plots.select <- drop(as.matrix(group_by(data.all, plot) %>%
summarise(select = sample(plot.c, 1)) %>%
select(select)))
......
BCI: $(D3)/BCI/Done.no.txt $(D3)/BCI/Done.log.txt
$(D3)/BCI/Done.no.txt: R/process.data/process-fun.R $(D2)/BCI/traits.csv
Rscript -e "source('$<'); process_bigplot_dataset('BCI', Rlim=15,std.traits='no');"
$(D3)/BCI/Done.no.txt: scripts/process.data/BCI.no.R R/process.data/process-fun.R $(D2)/BCI/traits.csv
R CMD BATCH $< ; rm BCI.no.Rout
$(D3)/BCI/Done.log.txt: R/process.data/process-fun.R $(D2)/BCI/traits.csv
Rscript -e "source('$<'); process_bigplot_dataset('BCI', Rlim=15,std.traits='log');"
$(D3)/BCI/Done.log.txt: scripts/process.data/BCI.log.R R/process.data/process-fun.R $(D2)/BCI/traits.csv
R CMD BATCH $< ; rm BCI.log.Rout
$(D2)/BCI/traits.csv: scripts/find.trait/BCI.R R/find.trait/trait-fun.R $(D2)/BCI/tree.csv
Rscript $<
R CMD BATCH $< ; rm BCI.Rout
$(D2)/BCI/tree.csv: scripts/format.data/BCI.R $(shell find $(D1)/BCI -type f)
Rscript $<
R CMD BATCH $< ; rm BCI.Rout
Canada: $(D3)/Canada/Done.no.txt $(D3)/Canada/Done.log.txt
$(D3)/Canada/Done.no.txt: R/process.data/process-fun.R $(D2)/Canada/traits.csv
Rscript -e "source('$<'); process_inventory_dataset('Canada',std.traits='no');"
$(D3)/Canada/Done.no.txt: scripts/process.data/Canada.no.R R/process.data/process-fun.R $(D2)/Canada/traits.csv
R CMD BATCH $< ; rm Canada.no.Rout
$(D3)/Canada/Done.log.txt: R/process.data/process-fun.R $(D2)/Canada/traits.csv
Rscript -e "source('$<'); process_inventory_dataset('Canada',std.traits='log');"
$(D3)/Canada/Done.log.txt: scripts/process.data/Canada.log.R R/process.data/process-fun.R $(D2)/Canada/traits.csv
R CMD BATCH $< ; rm Canada.log.Rout
$(D2)/Canada/traits.csv: scripts/find.trait/Canada.R R/find.trait/trait-fun.R $(D2)/Canada/tree.csv $(D2)/TRY/data.TRY.std.rds
Rscript $<
R CMD BATCH $< ; rm Canada.Rout
$(D2)/Canada/tree.csv: scripts/format.data/Canada.R $(shell find $(D1)/Canada -type f)
Rscript $<
R CMD BATCH $< ; rm Canada.Rout
France: $(D3)/France/Done.no.txt $(D3)/France/Done.log.txt
$(D3)/France/Done.no.txt: R/process.data/process-fun.R $(D2)/France/traits.csv
Rscript -e "source('$<'); process_inventory_dataset('France',std.traits='no');"
$(D3)/France/Done.no.txt: scripts/process.data/France.no.R R/process.data/process-fun.R $(D2)/France/traits.csv
R CMD BATCH $< ; rm France.no.Rout
$(D3)/France/Done.log.txt: R/process.data/process-fun.R $(D2)/France/traits.csv
Rscript -e "source('$<'); process_inventory_dataset('France',std.traits='log');"
$(D3)/France/Done.log.txt: scripts/process.data/France.log.R R/process.data/process-fun.R $(D2)/France/traits.csv
R CMD BATCH $< ; rm France.log.Rout
$(D2)/France/traits.csv: scripts/find.trait/France.R R/find.trait/trait-fun.R $(D2)/France/tree.csv $(D2)/TRY/data.TRY.std.rds
Rscript $<
R CMD BATCH $< ; rm France.Rout
$(D2)/France/tree.csv: scripts/format.data/France.R $(shell find $(D1)/France -type f)
Rscript $<
R CMD BATCH $< ; rm France.Rout
Fushan: $(D3)/Fushan/Done.no.txt $(D3)/Fushan/Done.log.txt
$(D3)/Fushan/Done.no.txt: R/process.data/process-fun.R $(D2)/Fushan/traits.csv
Rscript -e "source('$<'); process_bigplot_dataset('Fushan', Rlim=15,std.traits='no');"
$(D3)/Fushan/Done.no.txt: scripts/process.data/Fushan.no.R R/process.data/process-fun.R $(D2)/Fushan/traits.csv
R CMD BATCH $< ; rm Fushan.no.Rout
$(D3)/Fushan/Done.log.txt: R/process.data/process-fun.R $(D2)/Fushan/traits.csv
Rscript -e "source('$<'); process_bigplot_dataset('Fushan', Rlim=15,std.traits='log');"
$(D3)/Fushan/Done.log.txt: scripts/process.data/Fushan.log.R R/process.data/process-fun.R $(D2)/Fushan/traits.csv
R CMD BATCH $< ; rm Fushan.log.Rout
$(D2)/Fushan/traits.csv: scripts/find.trait/Fushan.R R/find.trait/trait-fun.R $(D2)/Fushan/tree.csv
Rscript $<
R CMD BATCH $< ; rm Fushan.Rout
$(D2)/Fushan/tree.csv: scripts/format.data/Fushan.R $(shell find $(D1)/Fushan -type f)
Rscript $<
R CMD BATCH $< ; rm Fushan.Rout
Japan: $(D3)/Japan/Done.no.txt $(D3)/Japan/Done.log.txt
$(D3)/Japan/Done.no.txt: R/process.data/process-fun.R $(D2)/Japan/traits.csv
Rscript -e "source('$<'); process_bigplot_dataset('Japan', Rlim=15,std.traits='no');"
$(D3)/Japan/Done.no.txt: scripts/process.data/Japan.no.R R/process.data/process-fun.R $(D2)/Japan/traits.csv
R CMD BATCH $< ; rm Japan.no.Rout
$(D3)/Japan/Done.log.txt: R/process.data/process-fun.R $(D2)/Japan/traits.csv
Rscript -e "source('$<'); process_bigplot_dataset('Japan', Rlim=15,std.traits='log');"
$(D3)/Japan/Done.log.txt: scripts/process.data/Japan.log.R R/process.data/process-fun.R $(D2)/Japan/traits.csv
R CMD BATCH $< ; rm Japan.log.Rout
$(D2)/Japan/traits.csv: scripts/find.trait/Japan.R R/find.trait/trait-fun.R $(D2)/Japan/tree.csv
Rscript $<
R CMD BATCH $< ; rm Japan.Rout
$(D2)/Japan/tree.csv: scripts/format.data/Japan.R $(shell find $(D1)/Japan -type f)
Rscript $<
R CMD BATCH $< ; rm Japan.Rout
Luquillo: $(D3)/Luquillo/Done.no.txt $(D3)/Luquillo/Done.log.txt
$(D3)/Luquillo/Done.no.txt: R/process.data/process-fun.R $(D2)/Luquillo/traits.csv
Rscript -e "source('$<'); process_bigplot_dataset('Luquillo', Rlim=15,std.traits='no');"
$(D3)/Luquillo/Done.no.txt: scripts/process.data/Luquillo.no.R R/process.data/process-fun.R $(D2)/Luquillo/traits.csv
R CMD BATCH $< ; rm Luquillo.no.Rout
$(D3)/Luquillo/Done.log.txt: R/process.data/process-fun.R $(D2)/Luquillo/traits.csv
Rscript -e "source('$<'); process_bigplot_dataset('Luquillo', Rlim=15,std.traits='log');"
$(D3)/Luquillo/Done.log.txt: scripts/process.data/Luquillo.log.R R/process.data/process-fun.R $(D2)/Luquillo/traits.csv
R CMD BATCH $< ; rm Luquillo.log.Rout
$(D2)/Luquillo/traits.csv: scripts/find.trait/Luquillo.R R/find.trait/trait-fun.R $(D2)/Luquillo/tree.csv
Rscript $<
R CMD BATCH $< ; rm Luquillo.Rout
$(D2)/Luquillo/tree.csv: scripts/format.data/Luquillo.R $(shell find $(D1)/Luquillo -type f)
Rscript $<
R CMD BATCH $< ; rm Luquillo.Rout
Mbaiki: $(D3)/Mbaiki/Done.no.txt $(D3)/Mbaiki/Done.log.txt
$(D3)/Mbaiki/Done.no.txt: R/process.data/process-fun.R $(D2)/Mbaiki/traits.csv
Rscript -e "source('$<'); process_bigplot_dataset('Mbaiki', Rlim=15,std.traits='no');"
$(D3)/Mbaiki/Done.no.txt: scripts/process.data/Mbaiki.no.R R/process.data/process-fun.R $(D2)/Mbaiki/traits.csv
R CMD BATCH $< ; rm Mbaiki.no.Rout
$(D3)/Mbaiki/Done.log.txt: R/process.data/process-fun.R $(D2)/Mbaiki/traits.csv
Rscript -e "source('$<'); process_bigplot_dataset('Mbaiki', Rlim=15,std.traits='log');"
$(D3)/Mbaiki/Done.log.txt: scripts/process.data/Mbaiki.log.R R/process.data/process-fun.R $(D2)/Mbaiki/traits.csv
R CMD BATCH $< ; rm Mbaiki.log.Rout
$(D2)/Mbaiki/traits.csv: scripts/find.trait/Mbaiki.R R/find.trait/trait-fun.R $(D2)/Mbaiki/tree.csv
Rscript $<
R CMD BATCH $< ; rm Mbaiki.Rout
$(D2)/Mbaiki/tree.csv: scripts/format.data/Mbaiki.R $(shell find $(D1)/Mbaiki -type f)
Rscript $<
R CMD BATCH $< ; rm Mbaiki.Rout
NSW: $(D3)/NSW/Done.no.txt $(D3)/NSW/Done.log.txt
$(D3)/NSW/Done.no.txt: R/process.data/process-fun.R $(D2)/NSW/traits.csv
Rscript -e "source('$<'); process_inventory_dataset('NSW',std.traits='no');"
$(D3)/NSW/Done.no.txt: scripts/process.data/NSW.no.R R/process.data/process-fun.R $(D2)/NSW/traits.csv
R CMD BATCH $< ; rm NSW.no.Rout
$(D3)/NSW/Done.log.txt: R/process.data/process-fun.R $(D2)/NSW/traits.csv
Rscript -e "source('$<'); process_inventory_dataset('NSW',std.traits='log');"
$(D3)/NSW/Done.log.txt: scripts/process.data/NSW.log.R R/process.data/process-fun.R $(D2)/NSW/traits.csv
R CMD BATCH $< ; rm NSW.log.Rout
$(D2)/NSW/traits.csv: scripts/find.trait/NSW.R R/find.trait/trait-fun.R $(D2)/NSW/tree.csv $(D2)/TRY/data.TRY.std.rds
Rscript $<
R CMD BATCH $< ; rm NSW.Rout
$(D2)/NSW/tree.csv: scripts/format.data/NSW.R $(shell find $(D1)/NSW -type f)
Rscript $<
R CMD BATCH $< ; rm NSW.Rout
NVS: $(D3)/NVS/Done.no.txt $(D3)/NVS/Done.log.txt
$(D3)/NVS/Done.no.txt: R/process.data/process-fun.R $(D2)/NVS/traits.csv
Rscript -e "source('$<'); process_inventory_dataset('NVS',std.traits='no');"
$(D3)/NVS/Done.no.txt: scripts/process.data/NVS.no.R R/process.data/process-fun.R $(D2)/NVS/traits.csv
R CMD BATCH $< ; rm NVS.no.Rout
$(D3)/NVS/Done.log.txt: R/process.data/process-fun.R $(D2)/NVS/traits.csv
Rscript -e "source('$<'); process_inventory_dataset('NVS',std.traits='log');"
$(D3)/NVS/Done.log.txt: scripts/process.data/NVS.log.R R/process.data/process-fun.R $(D2)/NVS/traits.csv
R CMD BATCH $< ; rm NVS.log.Rout
$(D2)/NVS/traits.csv: scripts/find.trait/NVS.R R/find.trait/trait-fun.R $(D2)/NVS/tree.csv $(D2)/TRY/data.TRY.std.rds
Rscript $<
R CMD BATCH $< ; rm NVS.Rout
$(D2)/NVS/tree.csv: scripts/format.data/NVS.R $(shell find $(D1)/NVS -type f)
Rscript $<
R CMD BATCH $< ; rm NVS.Rout
Paracou: $(D3)/Paracou/Done.no.txt $(D3)/Paracou/Done.log.txt
$(D3)/Paracou/Done.no.txt: R/process.data/process-fun.R $(D2)/Paracou/traits.csv
Rscript -e "source('$<'); process_bigplot_dataset('Paracou', Rlim=15,std.traits='no');"
$(D3)/Paracou/Done.no.txt: scripts/process.data/Paracou.no.R R/process.data/process-fun.R $(D2)/Paracou/traits.csv
R CMD BATCH $< ; rm Paracou.no.Rout
$(D3)/Paracou/Done.log.txt: R/process.data/process-fun.R $(D2)/Paracou/traits.csv
Rscript -e "source('$<'); process_bigplot_dataset('Paracou', Rlim=15,std.traits='log');"
$(D3)/Paracou/Done.log.txt: scripts/process.data/Paracou.log.R R/process.data/process-fun.R $(D2)/Paracou/traits.csv
R CMD BATCH $< ; rm Paracou.log.Rout
$(D2)/Paracou/traits.csv: scripts/find.trait/Paracou.R R/find.trait/trait-fun.R $(D2)/Paracou/tree.csv
Rscript $<
R CMD BATCH $< ; rm Paracou.Rout
$(D2)/Paracou/tree.csv: scripts/format.data/Paracou.R $(shell find $(D1)/Paracou -type f)
Rscript $<
R CMD BATCH $< ; rm Paracou.Rout
Spain: $(D3)/Spain/Done.no.txt $(D3)/Spain/Done.log.txt
$(D3)/Spain/Done.no.txt: R/process.data/process-fun.R $(D2)/Spain/traits.csv
Rscript -e "source('$<'); process_inventory_dataset('Spain',std.traits='no');"
$(D3)/Spain/Done.no.txt: scripts/process.data/Spain.no.R R/process.data/process-fun.R $(D2)/Spain/traits.csv
R CMD BATCH $< ; rm Spain.no.Rout
$(D3)/Spain/Done.log.txt: R/process.data/process-fun.R $(D2)/Spain/traits.csv
Rscript -e "source('$<'); process_inventory_dataset('Spain',std.traits='log');"
$(D3)/Spain/Done.log.txt: scripts/process.data/Spain.log.R R/process.data/process-fun.R $(D2)/Spain/traits.csv
R CMD BATCH $< ; rm Spain.log.Rout
$(D2)/Spain/traits.csv: scripts/find.trait/Spain.R R/find.trait/trait-fun.R $(D2)/Spain/tree.csv $(D2)/TRY/data.TRY.std.rds
Rscript $<
R CMD BATCH $< ; rm Spain.Rout
$(D2)/Spain/tree.csv: scripts/format.data/Spain.R $(shell find $(D1)/Spain -type f)
Rscript $<
R CMD BATCH $< ; rm Spain.Rout
Sweden: $(D3)/Sweden/Done.no.txt $(D3)/Sweden/Done.log.txt
$(D3)/Sweden/Done.no.txt: R/process.data/process-fun.R $(D2)/Sweden/traits.csv
Rscript -e "source('$<'); process_inventory_dataset('Sweden',std.traits='no');"
$(D3)/Sweden/Done.no.txt: scripts/process.data/Sweden.no.R R/process.data/process-fun.R $(D2)/Sweden/traits.csv
R CMD BATCH $< ; rm Sweden.no.Rout
$(D3)/Sweden/Done.log.txt: R/process.data/process-fun.R $(D2)/Sweden/traits.csv
Rscript -e "source('$<'); process_inventory_dataset('Sweden',std.traits='log');"
$(D3)/Sweden/Done.log.txt: scripts/process.data/Sweden.log.R R/process.data/process-fun.R $(D2)/Sweden/traits.csv
R CMD BATCH $< ; rm Sweden.log.Rout
$(D2)/Sweden/traits.csv: scripts/find.trait/Sweden.R R/find.trait/trait-fun.R $(D2)/Sweden/tree.csv $(D2)/TRY/data.TRY.std.rds
Rscript $<
R CMD BATCH $< ; rm Sweden.Rout
$(D2)/Sweden/tree.csv: scripts/format.data/Sweden.R $(shell find $(D1)/Sweden -type f)
Rscript $<
R CMD BATCH $< ; rm Sweden.Rout
Swiss: $(D3)/Swiss/Done.no.txt $(D3)/Swiss/Done.log.txt
$(D3)/Swiss/Done.no.txt: R/process.data/process-fun.R $(D2)/Swiss/traits.csv
Rscript -e "source('$<'); process_inventory_dataset('Swiss',std.traits='no');"
$(D3)/Swiss/Done.no.txt: scripts/process.data/Swiss.no.R R/process.data/process-fun.R $(D2)/Swiss/traits.csv
R CMD BATCH $< ; rm Swiss.no.Rout
$(D3)/Swiss/Done.log.txt: R/process.data/process-fun.R $(D2)/Swiss/traits.csv
Rscript -e "source('$<'); process_inventory_dataset('Swiss',std.traits='log');"
$(D3)/Swiss/Done.log.txt: scripts/process.data/Swiss.log.R R/process.data/process-fun.R $(D2)/Swiss/traits.csv
R CMD BATCH $< ; rm Swiss.log.Rout
$(D2)/Swiss/traits.csv: scripts/find.trait/Swiss.R R/find.trait/trait-fun.R $(D2)/Swiss/tree.csv $(D2)/TRY/data.TRY.std.rds
Rscript $<
R CMD BATCH $< ; rm Swiss.Rout
$(D2)/Swiss/tree.csv: scripts/format.data/Swiss.R $(shell find $(D1)/Swiss -type f)
Rscript $<
R CMD BATCH $< ; rm Swiss.Rout
US: $(D3)/US/Done.no.txt $(D3)/US/Done.log.txt
$(D3)/US/Done.no.txt: R/process.data/process-fun.R $(D2)/US/traits.csv
Rscript -e "source('$<'); process_inventory_dataset('US',std.traits='no');"
$(D3)/US/Done.no.txt: scripts/process.data/US.no.R R/process.data/process-fun.R $(D2)/US/traits.csv
R CMD BATCH $< ; rm US.no.Rout
$(D3)/US/Done.log.txt: R/process.data/process-fun.R $(D2)/US/traits.csv
Rscript -e "source('$<'); process_inventory_dataset('US',std.traits='log');"
$(D3)/US/Done.log.txt: scripts/process.data/US.log.R R/process.data/process-fun.R $(D2)/US/traits.csv
R CMD BATCH $< ; rm US.log.Rout
$(D2)/US/traits.csv: scripts/find.trait/US.R R/find.trait/trait-fun.R $(D2)/US/tree.csv $(D2)/TRY/data.TRY.std.rds
Rscript $<
R CMD BATCH $< ; rm US.Rout
$(D2)/US/tree.csv: scripts/format.data/US.R $(shell find $(D1)/US -type f)
Rscript $<
R CMD BATCH $< ; rm US.Rout
set.big: $(D3)/set.big/Done.no.txt $(D3)/set.big/Done.log.txt
$(D3)/set.big/Done.no.txt: R/process.data/process-fun.R $(D2)/set.big/traits.csv
Rscript -e "source('$<'); process_bigplot_dataset('set.big', Rlim=15,std.traits='no');"
$(D3)/set.big/Done.no.txt: scripts/process.data/set.big.no.R R/process.data/process-fun.R $(D2)/set.big/traits.csv
R CMD BATCH $< ; rm set.big.no.Rout
$(D3)/set.big/Done.log.txt: R/process.data/process-fun.R $(D2)/set.big/traits.csv
Rscript -e "source('$<'); process_bigplot_dataset('set.big', Rlim=15,std.traits='log');"
$(D3)/set.big/Done.log.txt: scripts/process.data/set.big.log.R R/process.data/process-fun.R $(D2)/set.big/traits.csv
R CMD BATCH $< ; rm set.big.log.Rout
$(D2)/set.big/traits.csv: scripts/find.trait/set.big.R R/find.trait/trait-fun.R $(D2)/set.big/tree.csv
Rscript $<
R CMD BATCH $< ; rm set.big.Rout
$(D2)/set.big/tree.csv: scripts/format.data/set.big.R $(shell find $(D1)/set.big -type f)
Rscript $<
R CMD BATCH $< ; rm set.big.Rout
set.inv: $(D3)/set.inv/Done.no.txt $(D3)/set.inv/Done.log.txt
$(D3)/set.inv/Done.no.txt: R/process.data/process-fun.R $(D2)/set.inv/traits.csv
Rscript -e "source('$<'); process_inventory_dataset('set.inv',std.traits='no');"
$(D3)/set.inv/Done.no.txt: scripts/process.data/set.inv.no.R R/process.data/process-fun.R $(D2)/set.inv/traits.csv
R CMD BATCH $< ; rm set.inv.no.Rout
$(D3)/set.inv/Done.log.txt: R/process.data/process-fun.R $(D2)/set.inv/traits.csv
Rscript -e "source('$<'); process_inventory_dataset('set.inv',std.traits='log');"
$(D3)/set.inv/Done.log.txt: scripts/process.data/set.inv.log.R R/process.data/process-fun.R $(D2)/set.inv/traits.csv
R CMD BATCH $< ; rm set.inv.log.Rout
$(D2)/set.inv/traits.csv: scripts/find.trait/set.inv.R R/find.trait/trait-fun.R $(D2)/set.inv/tree.csv $(D2)/TRY/data.TRY.std.rds
Rscript $<
R CMD BATCH $< ; rm set.inv.Rout
$(D2)/set.inv/tree.csv: scripts/format.data/set.inv.R $(shell find $(D1)/set.inv -type f)
Rscript $<
R CMD BATCH $< ; rm set.inv.Rout
......@@ -31,12 +31,13 @@ data.max.height <- data.frame(sp = data.max.height$SpCd,
write.csv(data.max.height, file = "output/formatted/US/max.height.csv")
#### READ DATA US
data.us <- read.csv("data/raw/US/FIA51_trees.csv",
data.us <- read.csv("data/raw/US/FIA51_trees_w_supp.csv",
header = TRUE, stringsAsFactors = FALSE)
#MCV remove trees <10 cm dbh
library(dplyr)
data.us <- filter(data.us, InitDbh>=10 & !is.na(InitDbh) )
## data.us <- filter(data.us, IntervalYears>=2 & !is.na(IntervalYears) )
data.us.plot <- read.csv("data/raw/US/PlotIDInfo3.csv",
header = TRUE, stringsAsFactors = FALSE)
......@@ -50,10 +51,10 @@ data.us$PlotID <- NULL
## WHEN WE ANALYZE THAT DATASET LATER ON
## FORMAT INDIVIDUAL TREE DATA
## change unit and names of variables to be the same in all data for the tree
data.us$G <- 10 * (data.us$FinalDbh - data.us$InitDbh)/data.us$IntervalYears
data.us$G <- 10 * (data.us$FinalDbh - data.us$InitDbh)/abs(data.us$IntervalYears)
## diameter growth in mm per year
data.us$BA.G <- (pi*(data.us$FinalDbh/2)^2-pi*(data.us$InitDbh/2)^2)/
data.us$IntervalYears ## ba growth in cm^2/year
abs(data.us$IntervalYears) ## ba growth in cm^2/year
data.us$G[which(data.us$InitDbh == 0 | data.us$FinalDbh == -999)] <- NA
data.us$BA.G[which(data.us$InitDbh == 0 | data.us$FinalDbh == -999)] <- NA
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment