Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit ff7c8a2
Author: lance-david <lance.david@usda.gov>
Date:   Fri Apr 14 08:51:16 2023 -0600

    Initialization of variables in fmcfir.f
    Label change for AK variant elevation reporting 10's feet to 100's feet

commit 3501d6e
Merge: e6e741b a287651
Author: LANCE R. DAVID <lance.david@usda.gov>
Date:   Thu Mar 30 07:49:59 2023 -0600

    Merge pull request #37 from forest-service/_pr28_Crookston

    Added testing of the fvs[Get|Set]SpeciesAttrs code.

commit a287651
Author: Nicholas Crookston <ncrookston.fs@gmail.com>
Date:   Mon Mar 13 13:42:29 2023 -0700

    Added testing of the fvs[Get|Set]SpeciesAttrs code.

    Fixed a bug in how stoppoint 7 works. Added more code to the test of the
    APIviaR that would have shown the error had the test been added prior to
    now.  Updated the 'save' files to account for these changes.

    Added test for using fvsCutNow() option in rFVS and added code and
    tests that trap using the thinprsc keyword in a way that causes a conflict
    with the use of the rFVS fvsCutNow function.

commit e6e741b
Author: Daniel Wagner <daniel.s.wagner@usda.gov>
Date:   Sun Mar 12 15:51:31 2023 -0400

    clean up of X1 variable from fvsvol.f

commit 3cd3d05
Merge: 524cfb8 2b05de7
Author: LANCE R. DAVID <lance.david@usda.gov>
Date:   Fri Feb 24 13:30:57 2023 -0700

    Merge pull request #36 from forest-service/Q2-2023-Ver-Numbering

    Updated to version and revision numbers for Q2

commit 2b05de7
Author: Daniel Wagner <daniel.s.wagner@usda.gov>
Date:   Fri Feb 24 15:26:42 2023 -0500

    Updated to version and revision numbers for Q2

commit 524cfb8
Merge: 229d13f ffbaba3
Author: LANCE R. DAVID <lance.david@usda.gov>
Date:   Fri Feb 24 12:07:12 2023 -0700

    Merge pull request #35 from forest-service/new-event-monitor-variables

    New event monitor variables

commit ffbaba3
Merge: 124d8ec 229d13f
Author: Daniel Wagner <daniel.s.wagner@usda.gov>
Date:   Fri Feb 24 10:16:21 2023 -0500

    Merge branch 'development' of https://code.fs.usda.gov/forest-service/ForestVegetationSimulator into new-event-monitor-variables

commit 124d8ec
Merge: 5c02911 e373625
Author: Daniel Wagner <daniel.s.wagner@usda.gov>
Date:   Fri Feb 17 11:32:05 2023 -0500

    Merge branch 'development' of https://code.fs.usda.gov/forest-service/ForestVegetationSimulator into new-event-monitor-variables

commit 5c02911
Merge: 5668311 652f6a3
Author: Daniel Wagner <daniel.s.wagner@usda.gov>
Date:   Thu Feb 16 13:18:37 2023 -0500

    Merge branch 'development' of https://code.fs.usda.gov/forest-service/ForestVegetationSimulator into new-event-monitor-variables

commit 5668311
Author: Daniel Wagner <daniel.s.wagner@usda.gov>
Date:   Thu Feb 16 13:18:05 2023 -0500

    Initial event monitor expansion code to include
    before and after stand height weighed by basal area.
    STILL NEEDS TO BE VERIFIED AND TESTED
  • Loading branch information
wagnerds committed May 22, 2023
1 parent 229d13f commit 25aca6c
Show file tree
Hide file tree
Showing 14 changed files with 341 additions and 198 deletions.
8 changes: 5 additions & 3 deletions base/algkey.f
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ SUBROUTINE ALGKEY (CTOK,LEN,NUM,IRC)
C IOPT1 - 8 = THE TABLES THAT CONTAIN THE OPCODES.
C
INTEGER IRC,NUM,LEN,N1,I,N2,N3,N4,N5,N6,N7,N8
PARAMETER (N1=1,N2=8,N3=26,N4=21,N5=22,N6=41,N7=29,N8=34)
PARAMETER (N1=1,N2=8,N3=26,N4=21,N5=22,N6=41,N7=31,N8=34)
CHARACTER CTOK*20,CTAB1(N1)*1,CTAB2(N2)*2,CTAB3(N3)*3,CTAB4(N4)*4,
> CTAB5(N5)*5,CTAB6(N6)*6,CTAB7(N7)*7,CTAB8(N8)*8
INTEGER IOPT1(N1),IOPT2(N2),IOPT3(N3),IOPT4(N4),IOPT5(N5),
Expand Down Expand Up @@ -78,6 +78,7 @@ SUBROUTINE ALGKEY (CTOK,LEN,NUM,IRC)
C 116 BSDI
C 117 BRDEN
C 118 BRDEN2
C 119 BHTWTBA
C
C 126 HABTYPE
C 127 SLOPE
Expand Down Expand Up @@ -125,6 +126,7 @@ SUBROUTINE ALGKEY (CTOK,LEN,NUM,IRC)
C 216 ADBHWTBA
C 217 ARDEN2
C 218 ASDI2
C 219 AHTWTBA
C
C GROUP 3 VARIABLES, THOSE KNOWN AFTER CYCLE 1.
C
Expand Down Expand Up @@ -298,11 +300,11 @@ SUBROUTINE ALGKEY (CTOK,LEN,NUM,IRC)
> 'BSDIMAX','ASDIMAX','BSCLASS','ASCLASS','BSTRDBH',
> 'ASTRDBH','MINSOIL','BCANCOV','ACANCOV','POTFLEN',
> 'PCTCOST','PROPSTK','SALVVOL','POINTID','STRSTAT',
> 'TREEBIO'/,
> 'TREEBIO','BHTWTBA','AHTWTBA'/,
> IOPT7 /401,404,405,10400,126,131,7008,7004,10500,
> 10600,133,406,7009,115,213,416,417,418,
> 419,421,424,425,11900,436,144,12300,12400,12500,
> 12900/
> 12900,119,219/
C
DATA CTAB8 /'NUMTREES',
> 'AVBTCUFT','AVBMCUFT','MSPERIOD','CENDYEAR',
Expand Down
21 changes: 10 additions & 11 deletions base/fvs.f
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,10 @@ SUBROUTINE FVS(IRTNCD)
!DEC$ ATTRIBUTES DLLEXPORT, C, DECORATE, ALIAS : "FVS" :: FVS
!DEC$ ATTRIBUTES REFERENCE :: IRTNCD

Cx INTEGER I,IA,N,K,NTODO,ITODO,IACTK,IDAT,NP !Remove these
INTEGER I,IA,N,K
REAL STAGEA,STAGEB
LOGICAL DEBUG,LCVGO
INTEGER IBA
Cx CHARACTER*150 SYSCMD !Remove these
Cx INTEGER MYACT(1) !Remove these
Cx REAL PRM(1) !Remove these
Cx DATA MYACT/100/ !Remove these
INTEGER IRSTRTCD,ISTOPDONE,IRTNCD,ISTOPRES,lenCl
C
C ****************** EXECUTION BEGINS ******************
Expand All @@ -83,6 +78,7 @@ SUBROUTINE FVS(IRTNCD)

call fvsRestart (IRSTRTCD)
call fvsGetRtnCode(IRTNCD)

IF (DEBUG) WRITE(JOSTND,*) "In FVS, IRSTRTCD=",IRSTRTCD,
> " IRTNCD=",IRTNCD
if (IRTNCD.ne.0) return
Expand Down Expand Up @@ -164,12 +160,6 @@ SUBROUTINE FVS(IRTNCD)
C CALCULATE TREES/ACRE ( = LOAD PROB )
C
CALL NOTRE
CALL fvsStopPoint (7,ISTOPRES)
IF (ISTOPRES.NE.0) RETURN
CALL fvsGetRtnCode(IRTNCD)
IF (IRTNCD.NE.0) RETURN
C BRANCH HERE IF RESTARTING FROM STOPCODE 7
19 CONTINUE
C
C WESTERN ROOT DISEASE MODEL VER. 3.0 INITIALIZATION
C
Expand All @@ -190,6 +180,15 @@ SUBROUTINE FVS(IRTNCD)
C
CALL OPCSET(ICYC)
C
C PROCESS STOPPOINT 7

CALL fvsStopPoint (7,ISTOPRES)
IF (ISTOPRES.NE.0) RETURN
CALL fvsGetRtnCode(IRTNCD)
IF (IRTNCD.NE.0) RETURN
C BRANCH HERE IF RESTARTING FROM STOPCODE 7
19 CONTINUE
C
C CALIBRATE GROWTH FUNCTIONS AND FILL GAPS
C SDICLS IS CALLED HERE SO CROWNS WILL DUB CORRECTLY IN VARIANTS
C USING THE WEIBULL DISTRIBUTION
Expand Down
2 changes: 1 addition & 1 deletion base/grincr.f
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ SUBROUTINE GRINCR (DEBUG,IPMODI,LTMGO,LMPBGO,LDFBGO,
CALL fvsGetRestartCode (ISTOPRES)
IF (DEBUG) WRITE (JOSTND,5) ICYC,ISTOPRES,NPLT
5 FORMAT (/' IN GRINCR, ICYC=',I3,'; ISTOPRES=',I3,'; NPLT=',A)
GOTO (1,16,17,71,72), ISTOPRES+1
GOTO (1,16,17,71,72,1), ISTOPRES+1

C STOP HAS NOT OCCURED

Expand Down
2 changes: 1 addition & 1 deletion base/tregro.f
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ SUBROUTINE TREGRO
CALL fvsGetRestartCode (ISTOPRES)
IF (DEBUG) WRITE(JOSTND,2) ICYC,ISTOPRES
2 FORMAT (' IN TREGRO, ICYC=',I3,' ISTOPRES=',I3)
IF (ISTOPRES.GE.5) GOTO 10
IF (ISTOPRES.GE.5 .and. .not. ISTOPRES.EQ.7) GOTO 10
C-----------
C CALL GRINCR TO COMPUTE INCREMENTS AND SEE IF BUG MODELS ARE ACTIVE.
C-----------
Expand Down
5 changes: 5 additions & 0 deletions canada/bc/initre.f
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,11 @@ SUBROUTINE INITRE
ENDIF
PRMS(1)=EFF
IF (LNOTBK(2)) PRMS(1)=ARRAY(2)
IF (PRMS(1).LT.0.) THEN
CALL KEYDMP (JOSTND,IRECNT,KEYWRD,ARRAY,KARD)
CALL ERRGRO (.TRUE.,4)
GOTO 10
ENDIF
IF (LNOTBK(3)) THEN
PRMS(2)=ARRAY(3)
I=2
Expand Down
2 changes: 1 addition & 1 deletion common/INCLUDESVN.F77
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
C COMMON
C----------
C
DATA SVN/"FS2023.1"/
DATA SVN/"FS2023.2"/
C
C-----END SEGMENT
22 changes: 22 additions & 0 deletions fire/base/fmcfir.f
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,28 @@ SUBROUTINE FMCFIR (IYR,FMOIS,WMULT,SWIND,CFTMP,OINIT1,OACT1,HPA)
LOGICAL DEBUG
INTEGER I,J
REAL WMULT,SAVWND,FLAME,BYRAM,RINIT1,CFB
C
C INITIALIZE VARAIBLES THAT ARE NOT PASSED AS PARAMETERS.
C
I = 0
J = 0
IRTNCD = 0
OLDND = 0
OLDNL = 0
B = 0.0
BOUNDL = 0.0
BOUNDU = 0.0
BYRAM = 0.0
CFB = 0.0
DIFF = 0.0
HPA2 = 0.0
HPA3 = 0.0
INIT1 = 0.0
FLAME = 0.0
OLDEPT = 0.0
RACT = 0.0
RINIT1 = 0.0
SAVWND = 0.0

CALL DBCHK (DEBUG,'FMCFIR',6,ICYC)
IF (DEBUG) WRITE(JOSTND,7) ICYC,FMOIS,CBD
Expand Down
30 changes: 25 additions & 5 deletions tests/APIviaR/Rapi.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ fvsGetSpeciesCodes()
# list supported activity codes
fvsAddActivity()


## first run
fvsSetCmdLine("--keywordfile=base.key")

fvsRun(7,0)
fvsRun(2,2030)
fvsGetStandIDs()

Expand All @@ -36,9 +36,13 @@ fvsGetEventMonitorVariables(c("myaba","another"))
# get and output tree attributes
fvsGetTreeAttrs(treeAttrs)

fvsSetSpeciesAttrs(list(baimult=rep(1.1,fvsGetDims()["maxspecies"]),
mortmult=rep(.9,fvsGetDims()["maxspecies"])))

# get and set some species attributes
spAttrs = fvsGetSpeciesAttrs(c("spsdi","spccf","spsiteindx"))
spAttrs = fvsGetSpeciesAttrs(c("baimult","spsdi","spccf","spsiteindx"))
spAttrs

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

Expand Down Expand Up @@ -68,10 +72,10 @@ fvsRun(2,1993)
addtrees <- fvsGetTreeAttrs(treeAttrs)
addtrees <- subset(addtrees,dbh<2)[,c("dbh","species","ht","cratio","plot","tpa")]

# these trees will be added to the run at 2013
cat ("these trees will be added to the run at 2013\n")
addtrees

# add a yearloss and thindbh for 1993
# add a yardloss and thindbh for 1993
fvsAddActivity(1993,"base_yardloss",c(0.50, 0.70, 0.50))
fvsAddActivity(1993,"base_thindbh",c(0.00,12.00,1.00,0.00,0.00))

Expand All @@ -82,7 +86,13 @@ fvsRun(6,2013)
fvsAddTrees(addtrees)
fvsGetTreeAttrs(treeAttrs)

# continue the run
# continyue the run until 2033, stoppoint 2, then simulate a harvest of 50% OF species 3
fvsRun(2,2033)
curTrees <- fvsGetTreeAttrs(c("species"))
cut = ifelse(curTrees$species == 3, .5, 0)
fvsCutNow(cut)

## continue the run
fvsRun(0,0)

#get and output summary statistics
Expand All @@ -108,5 +118,15 @@ rtn = fvsInteractRun(
BeforeEstab= 'testInteract("BeforeEstab")',
SimEnd = 'testInteract("SimEnd ")')

## test stop point 7
fvsSetCmdLine("--keywordfile=base.key")
fvsRun()
sp7no=fvsGetSummary()
fvsSetCmdLine("--keywordfile=base.key")
fvsRun(7,0)
fvsRun()
sp7yes=fvsGetSummary()
good=identical(sp7no,sp7yes)
cat("stop point 7 test result=",good," (should be TRUE)\n")


Loading

0 comments on commit 25aca6c

Please sign in to comment.