diff --git a/merge.data.NZ.R b/merge.data.NZ.R
index 8c5ab3413aed43dd7073e467567513eb418b1de0..fb49cfdf504204039a880c6b0a7ae96d0beb30fa 100644
--- a/merge.data.NZ.R
+++ b/merge.data.NZ.R
@@ -41,12 +41,13 @@ data.nz$D <- data.nz[["D0"]]  ## diameter in cm
 data.nz$dead <- as.numeric(is.na(data.nz[["D1"]]))  ## dummy variable for dead tree 0 alive 1 dead
 data.nz$plot <- data.nz$plid; data.nz$plid <- NULL
 data.nz$htot <- rep(NA, nrow(data.nz))  ## Max height is already available so have as missing
-data.nz$tree.id <- rep(NA, nrow(data.nz)) 
-#data.nz$tree.id <- gsub("__", "_", data.nz$tree.id)
-#data.nz$tree.id <- gsub("_", ".", data.nz$tree.id)  ## tree unique id
+data.nz$tree.id <- data.nz$tag
+head(subset(data.nz,subset=data.nz$tag %in% names(table(data.nz$tag))[table(data.nz$tag)==2])) ### 3 individuals with two observation with strange value check with Daniel and David add an issue
+data.nz$obs.id <- 1:nrow(data.nz)
+data.nz$census <- re(1,nrow(data.nz)) # only one census NEED TO CHECK WITH DANIEL AND DAVID add issue
 data.nz$weights <- 1/(20*20) ## need to check with david
 
-########################################## CHANGE COORDINATE SYSTEM DON'T KNOW THE EPSG CODE HERE change coordinates
+########################################## CHANGE COORDINATE SYSTEM 
 ########################################## system of Easting Northing to be in lat long WGS84
 library(sp)
 library(dismo)
@@ -71,8 +72,13 @@ dev.off()
 
 rm(data.sp, data.sp2)
 
-###################### ECOREGION merge greco to have no ecoregion with low number of observation
+###################### ECOREGION merge to have no ecoregion with low number of observation
 table(data.nz$Broad)
+## merging two ecoregion based on Daniel Laughlin advice.
+data.nz$Broad[data.nz$Broad=="Wetland"] <- "BeechHumid"
+data.nz$Broad[data.nz$Broad=="ConiferDry"] <- "BeechHumid"
+
+
 
 ###################### PERCENT DEAD
 perc.dead <- tapply(data.nz[["dead"]], INDEX = data.nz[["plot"]], FUN = function.perc.dead2)
@@ -81,10 +87,26 @@ data.nz <- merge(data.nz, data.frame(plot = names(perc.dead), perc.dead = perc.d
 
 ########################################################### PLOT SELECTION FOR THE ANALYSIS
 vec.abio.var.names <- c("MAT", "MAP")
-vec.basic.var <- c("tree.id", "sp", "spname", "plot", "ecocode", "D", "G", "dead", 
-    "year", "htot", "Lon", "Lat", "perc.dead")
+vec.basic.var <- c("obs.id","tree.id", "sp", "spname", "plot", "ecocode", "D", "G", "dead", 
+    "year", "htot", "Lon", "Lat", "perc.dead","weights","census")
 data.tree <- subset(data.nz, select = c(vec.basic.var, vec.abio.var.names))
 
+### read TRAITS data TODO
+
+#### GENERATE ONE OBJECT PER ECOREGION
+
+# vector of ecoregion name
+ecoregion.unique <- unique(data.tree[["ecocode"]])
+
+
+#### lapply function
+
+
+system.time(lapply(ecoregion.unique, FUN = fun.data.per.ecoregion, data.tot = data.tree, 
+    plot.name = "plot", weight.full.plot = NA, name.country = "NZ", data.TRY = NA, 
+    species.lookup = species.clean)) 
+
+
 ############################################## COMPUTE MATRIX OF COMPETITION INDEX WITH SUM OF BA PER SPECIES IN EACH PLOT in
 ############################################## m^2/ha without the target species
 data.BA.SP <- BA.SP.FUN(id.tree = as.vector(data.nz[["tree.id"]]), diam = as.vector(data.nz[["D"]]), 
diff --git a/merge.data.US.R b/merge.data.US.R
index 9091f2934dcd08a2117daf97c48fbd0b91e1f2d5..307cfcc9c334ff3b366941f8844e834f58df9c7f 100644
--- a/merge.data.US.R
+++ b/merge.data.US.R
@@ -37,6 +37,7 @@ data.us$subplot <- paste(as.character(data.us[["PlotID"]]), as.character(data.us
     sep = ".")  ## plot code
 data.us$htot <- rep(NA, length(data.us[["Species"]]))  ## height of tree in m - MISSING
 data.us$tree.id <- as.character(data.us$TreeID)
+data.us$obs.id <- 1:nrow(data.us)
 ## tree unique id
 data.us$sp.name <- NA
 ## census is missing use as only one census and check with mark
@@ -84,13 +85,10 @@ data.us[["sp"]] <- paste("sp", data.us[["sp"]], sep = ".")
 
 ## variables to keep
 vec.abio.var.names <- c("MAT", "MAP")
-vec.basic.var <- c("tree.id", "sp", "plot", "subplot", "ecocode", "D", "G", "dead", 
+vec.basic.var <- c("obs.id","tree.id", "sp", "plot", "subplot", "ecocode", "D", "G", "dead", 
     "year", "htot", "Lon", "Lat", "perc.dead", "weights","census")
 data.tree <- subset(data.us, select = c(vec.basic.var, vec.abio.var.names))
 rm(data.us)
-
-## creat row unique id
-data.tree$obs.id <- as.character(1:nrow(data.tree))
 gc()
 
 ### read TRY data
diff --git a/ms/Makefile b/ms/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..30a9f5a14ef026faac5a48e6b184b28e15a7a2ba
--- /dev/null
+++ b/ms/Makefile
@@ -0,0 +1,14 @@
+all: metadata base
+
+base: data.format.pdf
+
+%.pdf: %.md
+	pandoc $< -V linkcolor:black -V geometry:a4paper -V geometry:margin=1in --listings --include-in-header=include.tex -o $@
+
+metadata: 
+	Rscript knit_site_description.R
+
+clean:
+	rm -f *.pdf
+
+.PHONY: all base metadata clean
diff --git a/ms/requirements/include.tex b/ms/include.tex
similarity index 100%
rename from ms/requirements/include.tex
rename to ms/include.tex
diff --git a/ms/metadata/France/files/dataIFN.FRANCE.csv b/ms/metadata/France/files/dataIFN.FRANCE.csv
index b3c662ecf081ff4d5536a6ed502fdedbc29a1a34..67d58d41864250465734f39520d4b19a61fb187a 100644
--- a/ms/metadata/France/files/dataIFN.FRANCE.csv
+++ b/ms/metadata/France/files/dataIFN.FRANCE.csv
@@ -1,36 +1,36 @@
-use	var	units	description		
-1	idp	NA	plot number (a single census)		
-1	a	NA	tree number within the plot		
-1	veget	NA	1 alive 2 or 3 dead		
-1	simplif	NA	indicator with tree with only dbh measurement no growth		
-1	acci	NA	0 tree not damaged else tree damaged (1 broken 2 partil unrooten 3 bended 4 burned)		
-1	espar	NA	species code		
-1	ori	NA	origin of the tree (0 resprout 1 from seed 2 resprout from windthrown tree)		
-0	lib	NA	percentage of canopy in full light in three class (0 	 between 0 and 2/3 	 more than 2/3)
-0	mortb	NA 	percentage of branch mortality in 5 classes		
-1	c13	cm	circumference at 1m30		
-1	ir5	mm	radial growth over 5 years ( !!! not diameter growth)		
-1	htot	m	height		
-0	r	%	percentage of wood of bad quality		
-1	age	yr	age		
-1	w	1/ha	weighting fqtcor to convert qt hectqr bqsis		
-1	YEAR	yr	year of measurment		
-1	datemort	NA	died less than 5 years ago =1 more than 5 years ago =2		
-1	dead	NA	0 alive 1 dead		
-1	SER	NA	ecoregion (first letter large scale ecoregion number smaller division)		
-1	sgdd	?/day	sum of degree days above 5.56?C		
-1	WB.y	mm	water budget in mm over the year		
-1	WB.s	mm	water budget in mm over the growing season		
-1	WS.y	NA	water stress index over the year		
-1	WS.s	NA	water stress index over the growing season		
-1	MAT	?C	mean annual temperature		
-1	SAP	mm	annual sum of precipitation		
-1	xl93	m	x in lambert 93		
-1	yl93	m	y in lambert 93		
-0	dep	NA	French department (admin region)		
-0	csa	NA	type of forest 1 closed forest 2 small patch 3 open forest		
-1	plisi	NA	presence of forest edge		
-1	sfo	NA 	forest structure in 5 class		
-0	incid	NA	percentage of disturbance in 5 classes only after 2009		
-1	dc	NA	type of harvesting 0 = no harvesting orther harvesting		
-1	tplant	NA	type of plantation 0 = no plantation other plantation		
+use,var,units,description
+1,idp,NA,plot number (a single census)
+1,a,NA,tree number within the plot
+1,veget,NA,1 alive 2 or 3 dead
+1,simplif,NA,indicator with tree with only dbh measurement no growth
+1,acci,NA,0 tree not damaged else tree damaged (1 broken 2 partil unrooten 3 bended 4 burned)
+1,espar,NA,species code
+1,ori,NA,origin of the tree (0 resprout 1 from seed 2 resprout from windthrown tree)
+0,lib,NA,percentage of canopy in full light in three class (0 ;   between 0 and 2/3 ;m ore than 2/3)
+0,mortb,NA ,percentage of branch mortality in 5 classes
+1,c13,cm,circumference at 1m30
+1,ir5,mm,radial growth over 5 years ( !!! not diameter growth)
+1,htot,m,height
+0,r,%,percentage of wood of bad quality
+1,age,yr,age
+1,w,1/ha,weighting fqtcor to convert qt hectqr bqsis
+1,YEAR,yr,year of measurment
+1,datemort,NA,died less than 5 years ago =1 more than 5 years ago =2
+1,dead,NA,0 alive 1 dead
+1,SER,NA,ecoregion (first letter large scale ecoregion number smaller division)
+1,sgdd,C/day,sum of degree days above 5.56?C
+1,WB.y,mm,water budget in mm over the year
+1,WB.s,mm,water budget in mm over the growing season
+1,WS.y,NA,water stress index over the year
+1,WS.s,NA,water stress index over the growing season
+1,MAT,Degree C,mean annual temperature
+1,SAP,mm,annual sum of precipitation
+1,xl93,m,x in lambert 93
+1,yl93,m,y in lambert 93
+0,dep,NA,French department (admin region)
+0,csa,NA,type of forest 1 closed forest 2 small patch 3 open forest
+1,plisi,NA,presence of forest edge
+1,sfo,NA ,forest structure in 5 class
+0,incid,NA,percentage of disturbance in 5 classes only after 2009
+1,dc,NA,type of harvesting 0 = no harvesting orther harvesting
+1,tplant,NA,type of plantation 0 = no plantation other plantation
diff --git a/ms/metadata/France/files/species.csv b/ms/metadata/France/files/species.csv
index 41f2a604c4c48988e0ed01a521c74a9992fc2d86..cd8fc5d4df7d122fd4830f60f01e4a0bfef3d00b 100644
--- a/ms/metadata/France/files/species.csv
+++ b/ms/metadata/France/files/species.csv
@@ -1,4 +1,4 @@
-use	var	units	description
-1	code	NA	species code = espar in IFN file
-1	Latin_name	NA	Latin name
-0	 Exotic_Native_cultivated	NA	exotic native
+use,var,units,description
+1,code,NA,species code = espar in IFN file
+1,Latin_name,NA,Latin name
+0, Exotic_Native_cultivated,NA,exotic native