Suggested workflow for merging data tables

  • Asked
  • Active
  • Viewed 3077 times
0

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

0

Accepted answer

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 alt text

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.

Your answer

Markdown text. Shortcuts: Ctrl+B bold, Ctrl+I italic, Ctrl+K link, Ctrl+E code, Ctrl+Shift+V paste as plain text. Tab indents list items and code; press Escape, then Tab, to leave the text box.

Insert an image

Say what the image shows, for people who can't see it.

Menu

Keyboard shortcuts

Anywhere

?
Show this list
/
Search
g h
Go to the home page
g q
Go to the questions
g t
Go to the tags
g u
Go to the users
a
Ask a question

Lists of questions

j k
Next or previous question
Enter
Open the question

Question pages

j k
Next or previous post

Shortcuts never apply while you type in a text field. Members can turn them off in their preferences.