Answers to: Example of using external equation for volume calculation (Open Foris Calc)http://www.openforis.org/support/questions/456/example-of-using-external-equation-for-volume-calculation-open-foris-calc<p>Hi,</p>
<p>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. </p>
<p>Thank you.</p>enMon, 19 Sep 2016 09:07:42 +0200Answer by phuquy188http://www.openforis.org/support/questions/456/example-of-using-external-equation-for-volume-calculation-open-foris-calc/732<p>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?</p>phuquy188Mon, 19 Sep 2016 09:07:42 +0200http://www.openforis.org/support/questions/456/example-of-using-external-equation-for-volume-calculation-open-foris-calc/732Answer by Mino Tognahttp://www.openforis.org/support/questions/456/example-of-using-external-equation-for-volume-calculation-open-foris-calc/484<p>Dear Khanal,</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>Please let me know if this answers your questions or if you need further information.</p>
<p>Thank you,</p>
<p>Mino</p>Mino TognaWed, 24 Feb 2016 16:00:00 +0100http://www.openforis.org/support/questions/456/example-of-using-external-equation-for-volume-calculation-open-foris-calc/484Comment by Khanal on Mino Togna's answerhttp://www.openforis.org/support/questions/456/example-of-using-external-equation-for-volume-calculation-open-foris-calc#481<p>Dear Mino, </p>
<p>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? </p>
<p>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? </p>
<p>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? </p>
<p>Thank you.</p>KhanalSat, 20 Feb 2016 04:14:01 +0100http://www.openforis.org/support/questions/456/example-of-using-external-equation-for-volume-calculation-open-foris-calc#481Answer by Mino Tognahttp://www.openforis.org/support/questions/456/example-of-using-external-equation-for-volume-calculation-open-foris-calc/470<p>Dear Khanal,</p>
<p>The equations themselves are correct.
However, i have noticed two small issues, mainly because i forgot to mention them:</p>
<ol>
<li>
<p>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.</p>
</li>
<li>
<p>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.</p>
</li>
</ol>
<p>I have made those updates and the file is available here: <a href="https://www.dropbox.com/s/hsdx8ga5a34kyk3/equation_vol_with_bark_for_all_incl_misc.csv?dl=0">https://www.dropbox.com/s/hsdx8ga5a34kyk3/equation_vol_with_bark_for_all_incl_misc.csv?dl=0</a> </p>
<p>Please let me know if you are still facing problems or if you have other questions,</p>
<p>Thank you,</p>
<p>Mino</p>Mino TognaThu, 18 Feb 2016 09:40:13 +0100http://www.openforis.org/support/questions/456/example-of-using-external-equation-for-volume-calculation-open-foris-calc/470Comment by Khanal on Mino Togna's answerhttp://www.openforis.org/support/questions/456/example-of-using-external-equation-for-volume-calculation-open-foris-calc#468<p>Dear Mino,</p>
<p>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 : <a href="https://dl.dropboxusercontent.com/u/111213395/equation_vol_with_bark_for_all_incl_misc.csv">https://dl.dropboxusercontent.com/u/111213395/equation_vol_with_bark_for_all_incl_misc.csv</a> Any advice?</p>KhanalWed, 17 Feb 2016 16:06:50 +0100http://www.openforis.org/support/questions/456/example-of-using-external-equation-for-volume-calculation-open-foris-calc#468Comment by Mino Togna on Mino Togna's answerhttp://www.openforis.org/support/questions/456/example-of-using-external-equation-for-volume-calculation-open-foris-calc#465<p>Dear Khanal,</p>
<p>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.</p>
<p>Thank you</p>
<p>Mino</p>Mino TognaTue, 16 Feb 2016 15:13:52 +0100http://www.openforis.org/support/questions/456/example-of-using-external-equation-for-volume-calculation-open-foris-calc#465Comment by Khanal on Mino Togna's answerhttp://www.openforis.org/support/questions/456/example-of-using-external-equation-for-volume-calculation-open-foris-calc#464<p>Thank you Mino.</p>
<p>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. </p>
<p>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?</p>
<p>Best Regards,</p>KhanalTue, 16 Feb 2016 14:15:02 +0100http://www.openforis.org/support/questions/456/example-of-using-external-equation-for-volume-calculation-open-foris-calc#464Answer by Mino Tognahttp://www.openforis.org/support/questions/456/example-of-using-external-equation-for-volume-calculation-open-foris-calc/463<p>Dear Khanal,</p>
<p>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.</p>
<p>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.</p>
<p>Please let us know if you have additional questions.</p>
<p>Thank you,
Mino</p>Mino TognaTue, 16 Feb 2016 12:36:00 +0100http://www.openforis.org/support/questions/456/example-of-using-external-equation-for-volume-calculation-open-foris-calc/463