Hi,

I am trying to calculate tree volume by applying species-wise volume equations. In R it can be done by looping through codes in equation list and tree data. However, I am not sure how to set this up in my Open Foris Calc "volume Calculation Module". I would very much appreciate any hint.

Thank you.

asked 15 Feb '16, 06:53

Khanal's gravatar image

Khanal
11113
accept rate: 0%


Dear Khanal,

First, you need to import a valid CSV file containing the equations. The first column is the code, that is used to identify your data. The second is the equation itself, and the third is the possible further condition you might apply.

After importing the equations, you might need to add a calculation step type 'External equation' and then select from the equation list the one you previously uploaded. Once selected, you might need to identify the variables of your entity that are used to match the variables of your equations.

Please let us know if you have additional questions.

Thank you, Mino

permanent link

answered 16 Feb '16, 12:36

Mino%20Togna's gravatar image

Mino Togna ♦♦
4365
accept rate: 10%

Thank you Mino.

I had formatted and uploaded a csv with equations. Following your suggestions, I created a new module of type "external equation" whereby I could specify the fields including Equation list, code variable from the uploaded equation csv. I think I got answer to my earlier question.

However, When I test execute it with species_code matching with code in equation list, the following error message appears "org.openforis.calc.r.RException: org.rosuda.REngine.REngineException: Parse error at org.openforis.calc.r.R.eval(R.java:124)." Is there something I am missing?

Best Regards,

(16 Feb '16, 14:15) Khanal Khanal's gravatar image

Dear Khanal,

Can make sure or you attach here that the CSV file you are using is valid ?No empty lines; at least one of the column code and condition is specified; your data doesnt contain null values for the species code.

Thank you

Mino

(16 Feb '16, 15:13) Mino Togna ♦♦ Mino%20Togna's gravatar image

Dear Mino,

Thank you for the kind help. Actually my csv had missing value for code (recorded as NA) and no condition. Now, I fixed it. However, I am still getting the same error message. My csv is at : https://dl.dropboxusercontent.com/u/111213395/equation_vol_with_bark_for_all_incl_misc.csv Any advice?

(17 Feb '16, 16:06) Khanal Khanal's gravatar image

Dear Khanal,

The equations themselves are correct. However, i have noticed two small issues, mainly because i forgot to mention them:

  1. The column condition must return a boolean value. In fact, the system will add a logic AND in addition to the code variable condition. The line 6 of your CSV contains a condition value, however it doesn't return a boolean value. E.g. that column could be changed as !is.na(abs(height_p)) or removed if it's not what you need.

  2. The last row, should contain an equation to apply when none of the previous ones match with your data. If there's no such default equation to apply to the data, a simple NA should be added.

I have made those updates and the file is available here: https://www.dropbox.com/s/hsdx8ga5a34kyk3/equation_vol_with_bark_for_all_incl_misc.csv?dl=0

Please let me know if you are still facing problems or if you have other questions,

Thank you,

Mino

permanent link

answered 18 Feb '16, 09:40

Mino%20Togna's gravatar image

Mino Togna ♦♦
4365
accept rate: 10%

Dear Mino,

After uploading the new equation list csv, now on the external equation edit step, I can see a new variable "NA". When I specify "species code" for that variable, the same error appears. Shall I select something else here?

Regarding, the second issue suggested above, if I have different equation for 12 unique species and everything else has a default equation, is there somehow I can specify a condition?

One more thing, under equation list, I can select equation list name and upload a new csv for already specified name. How can I delete a equation list?

Thank you.

(20 Feb '16, 04:14) Khanal Khanal's gravatar image

Dear Khanal,

the NA appearing as variable is a bug. it has been fixed and will be released with the next version that is currently under testing.

Yes, you can specify condition. the third column of the CSV file is exactly that. However, in your case, the last row should contain the equation that will be applied when none of the above criteria matches with your data.

At the moment it's not possible to delete an equation list; you can delete a calculation step that is using that equation list if you don't want to use it anymore. the delete of the equation list has been added to our task lists.

Please let me know if this answers your questions or if you need further information.

Thank you,

Mino

permanent link

answered 24 Feb '16, 16:00

Mino%20Togna's gravatar image

Mino Togna ♦♦
4365
accept rate: 10%

Dear All I just reach calc. I want to write code to implement R commands in calc calculation. have you have the documentation and code samples to study it? can you share me?

permanent link

answered 19 Sep '16, 09:07

phuquy188's gravatar image

phuquy188
1113
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×61

question asked: 15 Feb '16, 06:53

question was seen: 3,017 times

last updated: 19 Sep '16, 09:07