Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support to get/set species attributes related to the TreeSzCp keyword. Added a test to Rapi.R #35

Merged
merged 1 commit into from Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions base/apisubs.f
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,19 @@ subroutine fvsSpeciesAttr(name,nch,action,attr,rtnCode)
case ("reghmult")
if (action=="get") attr = xrhmlt
if (action=="set") xrhmlt = real(attr,4)
C values from TREESZCP keyword
case ("maxdbh")
if (action=="get") attr = sizcap(:MAXSP,1)
if (action=="set") sizcap(:MAXSP,1) = real(attr,4)
case ("minmort")
if (action=="get") attr = sizcap(:MAXSP,2)
if (action=="set") sizcap(:MAXSP,2) = real(attr,4)
case ("maxdbhcd")
if (action=="get") attr = sizcap(:MAXSP,3)
if (action=="set") sizcap(:MAXSP,3) = real(attr,4)
case ("maxht")
if (action=="get") attr = sizcap(:MAXSP,4)
if (action=="set") sizcap(:MAXSP,4) = real(attr,4)

case default
rtnCode = 1
Expand Down
3 changes: 3 additions & 0 deletions tests/APIviaR/Rapi.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ fvsSetSpeciesAttrs(list(baimult=rep(1.1,fvsGetDims()["maxspecies"]),
spAttrs = fvsGetSpeciesAttrs(c("baimult","spsdi","spccf","spsiteindx"))
spAttrs

spAttrs = fvsGetSpeciesAttrs(c("maxdbh","minmort","maxdbhcd","maxht"))
spAttrs

rtn = fvsSetSpeciesAttrs(spAttrs)
cat ("rtn = ",rtn,"\n")

Expand Down
43 changes: 35 additions & 8 deletions tests/APIviaR/Rapi.out.save
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,33 @@ $caseID
22 1.1 841.2368 0.000000 98.00000
23 1.1 841.2368 0.000000 0.00000
>
> spAttrs = fvsGetSpeciesAttrs(c("maxdbh","minmort","maxdbhcd","maxht"))
> spAttrs
maxdbh minmort maxdbhcd maxht
1 999 1 0 999
2 999 1 0 999
3 999 1 0 999
4 999 1 0 999
5 999 1 0 999
6 999 1 0 999
7 999 1 0 999
8 999 1 0 999
9 999 1 0 999
10 999 1 0 999
11 999 1 0 999
12 999 1 0 999
13 999 1 0 999
14 999 1 0 999
15 999 1 0 999
16 999 1 0 999
17 999 1 0 999
18 999 1 0 999
19 999 1 0 999
20 999 1 0 999
21 999 1 0 999
22 999 1 0 999
23 999 1 0 999
>
> rtn = fvsSetSpeciesAttrs(spAttrs)
> cat ("rtn = ",rtn,"\n")
rtn = 0
Expand Down Expand Up @@ -311,7 +338,7 @@ these trees will be added to the run at 2013
> ## continue the run
> fvsRun(0,0)

IE FVS VARIANT -- RV:20230106
IE FVS VARIANT -- RV:20230929


STAND = S248112 MANAGEMENT CODE = NONE
Expand All @@ -336,7 +363,7 @@ YEAR /ACRE BA SDI HT QMD CU FT /ACRE CU FT BD FT BA SDI HT QMD ACC MOR
2080 139 250 361 119 18.2 10978 0 0 0 250 361 119 18.2 200 98
2090 121 258 361 125 19.8 11999 0 0 0 258 361 125 19.8 0 0

IE FVS VARIANT -- RV:20230106
IE FVS VARIANT -- RV:20230929


STAND = S248112 MANAGEMENT CODE = NONE
Expand All @@ -361,7 +388,7 @@ YEAR /ACRE BA SDI HT QMD CU FT /ACRE CU FT BD FT BA SDI HT QMD ACC MOR
2080 114 241 338 126 19.7 11058 0 0 0 241 338 126 19.7 181 99
2090 99 246 335 133 21.3 11880 0 0 0 246 335 133 21.3 0 0

IE FVS VARIANT -- RV:20230106
IE FVS VARIANT -- RV:20230929


STAND = S248112 MANAGEMENT CODE = NONE
Expand Down Expand Up @@ -512,7 +539,7 @@ msg= BeforeEstab ids= S248112 NONE year= 2010
2080 134 170 265 114 15.3 7649 0 0 0 170 265 114 15.3 201 52
2090 125 192 287 122 16.8 9143 0 0 0 192 287 122 16.8 0 0

IE FVS VARIANT -- RV:20230106
IE FVS VARIANT -- RV:20230929


STAND = S248112 MANAGEMENT CODE = NONE
Expand All @@ -537,7 +564,7 @@ YEAR /ACRE BA SDI HT QMD CU FT /ACRE CU FT BD FT BA SDI HT QMD ACC MOR
2080 114 241 338 126 19.7 11058 0 0 0 241 338 126 19.7 181 99
2090 99 246 335 133 21.3 11880 0 0 0 246 335 133 21.3 0 0

IE FVS VARIANT -- RV:20230106
IE FVS VARIANT -- RV:20230929


STAND = S248112 MANAGEMENT CODE = NONE
Expand All @@ -562,7 +589,7 @@ YEAR /ACRE BA SDI HT QMD CU FT /ACRE CU FT BD FT BA SDI HT QMD ACC MOR
2080 116 240 339 125 19.5 11212 0 0 0 240 339 125 19.5 180 101
2090 101 244 334 131 21.1 12010 0 0 0 244 334 131 21.1 0 0

IE FVS VARIANT -- RV:20230106
IE FVS VARIANT -- RV:20230929


STAND = S248112 MANAGEMENT CODE = NONE
Expand Down Expand Up @@ -645,7 +672,7 @@ stop point 7 test result= TRUE (should be TRUE)
2080 114 241 338 126 19.7 11058 0 0 0 241 338 126 19.7 181 99
2090 99 246 335 133 21.3 11880 0 0 0 246 335 133 21.3 0 0

IE FVS VARIANT -- RV:20230106
IE FVS VARIANT -- RV:20230929


STAND = S248112 MANAGEMENT CODE = NONE
Expand All @@ -670,7 +697,7 @@ YEAR /ACRE BA SDI HT QMD CU FT /ACRE CU FT BD FT BA SDI HT QMD ACC MOR
2080 116 240 339 125 19.5 11212 0 0 0 240 339 125 19.5 180 101
2090 101 244 334 131 21.1 12010 0 0 0 244 334 131 21.1 0 0

IE FVS VARIANT -- RV:20230106
IE FVS VARIANT -- RV:20230929


STAND = S248112 MANAGEMENT CODE = NONE
Expand Down