Hi, My inventory uses nested sub-plots of different areas for different sized trees. In the Collect schema these trees are stored in different tables. I currently calculate variables (e.g. AGB, Carbon) for each sub-plot separately, define the plot area for each sub-plot, and can view and interact with the calculated variables in Saiku. I would like to merge the outputs from the sub-plots so that I can display the calculated variables for all tree sizes in Saiku as a single variable. I think I need to merge the data in R and then write to the Postgres database but I don't know where in the Calc processing chain this should happen to make the merged outputs available in Saiku. Can you recommend a workflow for this task? Thanks for your help. Jonathan asked 30 Jul '21, 10:37 jpdash |
Dear Jonathan, Collect allows to use same attribute names in multiple tables, Calc does not allow. Indeed, this is a bad practice in Collect too. The duplicate attribute names are changed in Calc while importing the Collect data. Similarly, result variable names must be unique in Calc. So merging of entities is very tricky. Secondly, in Calc computing of 'results per hectare' takes place at the very end of the calculation chain (system/0xx-persist-user-scripts.R) and we cannot not edit this part. However, I offer this solution: You should have an (extra) attribute (text/integer/code) for each subplot that defines the subplot type. You may have this already. Export all tree data (tables) into CSV or Excel files. Survey Designer: keep the original tables as they are now but create with DUPLICATE method a new table 'tree_combined' for tree data, Publish and import all tree data into this new (blank) table (i.e. entity). In Calc:
add some results variable(s) for 'tree_combined' and in tree_combined$plot_area script write something like
In this way you get your original Saiku reports plus results for combined tree data. Hope this helps, Lauri P.S. I will study your case still, it is very interesting and if I find a better solution, I will tell it here. answered 30 Jul '21, 13:51 Lauri (OF) ♦♦ |