PageRenderTime 45ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/OPENFVS_DIR_RESTRUCT_TEST_BRANCH/src/variants/ls/src/sumout.f

http://open-fvs.googlecode.com/
FORTRAN Legacy | 158 lines | 79 code | 0 blank | 79 comment | 0 complexity | a2295af37565af3b5e557c381c20981a MD5 | raw file
  1. SUBROUTINE SUMOUT(IOSUM,I17,IPT,ITYPE,JOPRT,JOSTND,JOSUM,
  2. > LEN,MGMID,NPLT,SAMWT,ITITLE)
  3. IMPLICIT NONE
  4. C----------
  5. C **SUMOUT--LS DATE OF LAST REVISION: 07/11/08
  6. C----------
  7. C
  8. C WRITES SUMMARY OUTPUT.
  9. C
  10. C IOSUM = THE SUMMARY OUTPUT ARRAY FROM THE FVS MODEL.
  11. C 1: YEAR
  12. C 2: AGE
  13. C 3: TREES/ACRE
  14. C * 4: MERCH CU FT (PULP AND SAWLOG)
  15. C * 5: MERCH CU FT (SAWLOG)
  16. C * 6: MERCH BD FT (SAWLOG)
  17. C 7: REMOVED TREES/ACRE
  18. C * 8: REMOVED MERCH CU FT (PULP AND SAWLOG)
  19. C * 9: REMOVED MERCH CU FT (SAWLOG)
  20. C * 10: REMOVED MERCH BD FT (SAWLOG)
  21. C 11: BASAL AREA/ACRE
  22. C 12: CCF
  23. C 13: AVERAGE DOMINANT HEIGHT
  24. C 14: PERIOD LENGTH (YEARS)
  25. C 15: ACCRETION (ANNUAL IN CU FT/ACRE)
  26. C 16: MORTALITY (ANNUAL IN CU FT/ACRE)
  27. C 17: SAMPLE WEIGHT
  28. C
  29. C NOTE: * Indicates R9 specific. !!!!!!!!!
  30. C
  31. C IPT = POINTER ARRAY USED TO ACCESS IOSUM IN CRONOLOGICAL
  32. C ORDER. IF IPT(1)=0, IOSUM IS ASSUMED TO BE IN
  33. C CRONOLOGICAL ORDER.
  34. C ITYPE = SUMMARY TABLE TYPE
  35. C JOSTND= DATA SET REFERENCE NUMBER FOR 'PRINTED' COPY (WITH
  36. C HEADINGS AND CARRAGE CONTROL BYTE). IF JOSTND=0, NO
  37. C DATA WILL BE WRITTEN.
  38. C JOPRT = PRINTER OUTPUT FOR MESSAGES.
  39. C JOSUM = DATA SET REFERENCE NUMBER FOR 'NON-PRINTED' COPY (WITH
  40. C OUT HEADINGS, NO CARRAGE CONTROL BYTE). IF JOSUM=0,
  41. C NO DATA WILL BE WRITTEN.
  42. C LEN = NUMBER OF ROWS (ENTRIES) IN IOSUM.
  43. C MGMID = MANAGEMENT IDENTIFICATION FIELD. ASSUMED ALPHANUMERIC.
  44. C NPLT = PLOT IDENTIFICATION FIELD. ASSUMED ALPHANUMERIC.
  45. C
  46. COMMONS
  47. C
  48. C
  49. INCLUDE 'PRGPRM.F77'
  50. C
  51. C
  52. INCLUDE 'SUMTAB.F77'
  53. C
  54. COMMONS
  55. C
  56. CHARACTER CISN*11,NPLT*26,TIM*8,DAT*10,MGMID*4,VVER*7,REV*10
  57. CHARACTER ITITLE*72
  58. INTEGER IPT(LEN)
  59. INTEGER*4 IOSUM(I17,LEN)
  60. INTEGER JOSUM,JOSTND,JOPRT,ITYPE,I17,ISTLNB,I12,J,I,K,LEN
  61. REAL SAMWT,OLDAGE,AGE,YMAI,REM
  62. LOGICAL LNOR,LPRT,LDSK
  63. C
  64. C **************************************************************
  65. C
  66. C STEP1: SET SWITCHES.
  67. C
  68. LPRT= JOSTND .GT. 0
  69. LDSK= JOSUM .GT. 0
  70. IF (.NOT. (LPRT.OR.LDSK)) RETURN
  71. LNOR= IPT(1) .NE. 0
  72. C
  73. CALL PPISN (CISN)
  74. CALL VARVER (VVER)
  75. CALL REVISE (VVER,REV)
  76. CALL GRDTIM (DAT,TIM)
  77. IF(LDSK) WRITE (JOSUM,2) LEN,NPLT,MGMID,SAMWT,VVER,DAT,TIM,
  78. & REV,CISN
  79. 2 FORMAT ('-999',I5,1X,A26,1X,A4,E15.7,5(1X,A))
  80. C
  81. C STEP2: WRITE HEADING; SKIP A FEW LINES, DO NOT START A NEW PAGE.
  82. C
  83. IF (LPRT) THEN
  84. WRITE (JOSTND,5) NPLT,MGMID,ITITLE(1:ISTLNB(ITITLE))
  85. 5 FORMAT(/' STAND ID: ',A26,4X,'MGMT ID: ',A4,4X,A/)
  86. WRITE (JOSTND,10)
  87. 10 FORMAT(//33X,'SUMMARY STATISTICS (PER ACRE OR STAND BASED ON TOTAL
  88. & STAND AREA)',/,1X,
  89. & 127(1H-),/16X,'START OF SIMULATION PERIOD',21X,'REMOVALS',13X,
  90. & 'AFTER TREATMENT',4X,'GROWTH THIS PERIOD',/10X,45(1H-),1X,
  91. & 23(1H-),1X,21(1H-),2X,18(1H-),3X,'MAI',/10X,'NO OF',14X,'TOP',
  92. & 6X,'MERCH SAWLG SAWLG NO OF MERCH SAWLG SAWLG',14X,'TOP RES ',
  93. & 'PERIOD ACCRE MORT MERCH',/1X,'YEAR AGE TREES BA SDI CCF ',
  94. & 'HT QMD CU FT CU FT BD FT TREES CU FT CU FT BD FT BA SDI ',
  95. & 'CCF HT QMD YEARS PER YEAR CU FT',/1X,'---- --- ----- ',
  96. & '--- ---- --- --- ---- ',7('----- '),'--- ---- --- --- ---- ',
  97. & '------ ---- ----- -----')
  98. ENDIF
  99. C
  100. C
  101. C STEP3: LOOP THRU ALL ROWS IN IOSUM...WRITE OUTPUT.
  102. C
  103. C THIS STEP TAKES JUST THE FIRST 12 ITEMS IN THE IOSUM ARRAY
  104. C
  105. I12=I17-5
  106. TOTREM=0.0
  107. MAIFLG=0
  108. NEWSTD = 0
  109. OLDAGE = 0.0
  110. DO 50 J=1,LEN
  111. I=J
  112. IF (LNOR) I=IPT(J)
  113. C
  114. AGE = IOSUM(2,I)
  115. IF(AGE .LT. OLDAGE) TOTREM = 0.0
  116. OLDAGE = AGE
  117. IF(AGE.EQ.0.0 .OR. (MAIFLG.EQ.1 .AND. NEWSTD.NE.1)) THEN
  118. YMAI = 0.0
  119. MAIFLG = 1
  120. GO TO 11
  121. ENDIF
  122. C----------
  123. C MAI for R-9 is based upon total sawlog AND pulpwood CF volume.
  124. C----------
  125. REM=IOSUM(4,I)
  126. YMAI=(TOTREM + REM )/AGE
  127. TOTREM=TOTREM+IOSUM(8,I)
  128. 11 CONTINUE
  129. IF(LPRT)
  130. & WRITE(JOSTND,20) (IOSUM(K,I),K=1,3),IOLDBA(I),ISDI(I),
  131. & IBTCCF(I),IBTAVH(I),QSDBT(I),(IOSUM(K,I),K=4,11),
  132. & ISDIAT(I),IOSUM(12,I),IOSUM(13,I),QDBHAT(I),
  133. & (IOSUM(K,I),K=14,16),YMAI
  134. 20 FORMAT(1X,2I4,I6,I4,I5,2I4,F5.1,7I6,I4,I5,2I4,F5.1,2X,
  135. & I6,I5,I6,2X,F6.1)
  136. C
  137. IF(LDSK)
  138. & WRITE(JOSUM,9014) (IOSUM(K,I),K=1,3),IOLDBA(I),ISDI(I),
  139. & IBTCCF(I),IBTAVH(I),QSDBT(I),(IOSUM(K,I),K=4,11),
  140. & ISDIAT(I),IOSUM(12,I),IOSUM(13,I),QDBHAT(I),
  141. & (IOSUM(K,I),K=14,16),YMAI
  142. 9014 FORMAT(2I4,I6,I4,I5,2I4,F5.1,7I6,I4,I5,2I4,F5.1,2X,I6,
  143. & I5,I6,2X,F6.1)
  144. C
  145. IF(IOSUM(11,I).EQ.0 .AND. IOSUM(12,I).EQ.0 .AND.
  146. * ISDIAT(I).EQ.0 .AND. IOSUM(7,I).NE.0) THEN
  147. NEWSTD = 1
  148. TOTREM = 0.0
  149. ENDIF
  150. IF(AGE .EQ. 0.0 .AND. IOSUM(3,I) .EQ. 0.0) NEWSTD=1
  151. 50 CONTINUE
  152. C
  153. IF (.NOT.LDSK) RETURN
  154. WRITE (JOPRT,60) LEN,JOSUM
  155. 60 FORMAT(/' NOTE:',I3,' LINES OF SUMMARY DATA HAVE BEEN WRITTEN',
  156. > ' TO THE FILE REFERENCED BY LOGICAL UNIT',I3)
  157. RETURN
  158. END