TreeMig Code
Loading...
Searching...
No Matches
PrepareOutput.f90
Go to the documentation of this file.
1!==============================================================================
2!
3! Name : PrepareOutput
4!
5! Remarks: contains the SUBROUTINEs
6!
7! PrepareOutput (<TreeMig)
8! CloseOutputFiles (<TreeMig)
9!
10!==============================================================================
11
12
13!==============================================================================
32!==============================================================================
33SUBROUTINE prepareoutput(nspc)
34
35 use all_par, only: writeoutput
42 IMPLICIT NONE
43
44 ! Passed variables>--------------------------------------------------------------------------------
45 INTEGER, INTENT(in) :: nspc ! site index
46
47 ! Local variables>---------------------------------------------------------------------------------
48 INTEGER :: i
49 ! prepare constant output files (.txt) for additional information
50 ! species specific, in height classes
51 call openandwriteheader(laipertreehcloutfile, nspc) ! leaf area
53 call openandwriteheader(biompertreehcloutfile, nspc) ! biomass
54 call openandwriteheader(seedprodfractpertreehcloutfile, nspc) ! fraction of total seed production
55 ! for all species
56 call openandwriteheader(heightperhcloutfile, nspc) ! height
57 ! in light classes
59 !-----
60 if(writeoutput%netcdf) return
61 !----- only for .txt output
62 !----- open file for biomass output
63 if (writeoutput%biomass) call openandwriteheader(biomassoutfile, nspc)
64 !----- open file for number output
65 if (writeoutput%number) call openandwriteheader(numberoutfile, nspc)
66 !----- open file for seedBank output - only works if the seeds are stored in the seedBank variable
67 if (writeoutput%seeds) call openandwriteheader(seedoutfile, nspc)
68 !----- open file for antagonist output
69 if (writeoutput%antagonists) call openandwriteheader(antaoutfile, nspc)
70 !----- open file for pollen output
71 if (writeoutput%pollen) call openandwriteheader(pollenoutfile, nspc)
72 !----- open file for LAI output
73 if (writeoutput%lai) call openandwriteheader(laioutfile, nspc)
74 !----- open file for ingrowth output
75 if (writeoutput%ingrowth) call openandwriteheader(ingrowthoutfile, nspc)
76 !----- open file for NPP output
77 if (writeoutput%NPP) call openandwriteheader(nppoutfile, nspc)
78 !----- open file for biodiversity output
79 if (writeoutput%biodiv) call openandwriteheader(biodivoutfile, nspc)
80 !---- open file for basal area output
81 if (writeoutput%basalArea) call openandwriteheader(basareaoutfile, nspc)
82 !---- open file for height structure output
84
85 !---- open file for height structure output
86 if (writeoutput%hstruct) then
87 do i = 1, 16
89 end do
90 end if
91end SUBROUTINE prepareoutput
92!==============================================================================
114!==============================================================================
122 use netcdf, only: nf90_close
123 use all_par, only: writeoutput
124 IMPLICIT NONE
125 INTEGER :: i
126
132
133 if(writeoutput%netcdf) then
134 call m_check(nf90_close(nc_file_id), __line__, __file__)
135 return ! in this case no need to close the other files, they were never opened
136 end if
137
138 if (writeoutput%biomass) call closefile(biomassoutfile)
139 if (writeoutput%number) call closefile(numberoutfile)
140 if (writeoutput%seeds) call closefile(seedoutfile)
141 if (writeoutput%antagonists) call closefile(antaoutfile)
142 if (writeoutput%pollen) call closefile(pollenoutfile)
143 if (writeoutput%lai) call closefile(laioutfile)
144 if (writeoutput%ingrowth) call closefile(ingrowthoutfile)
145 if (writeoutput%basalArea) call closefile(basareaoutfile)
146 if (writeoutput%NPP) call closefile(nppoutfile)
147 if (writeoutput%biodiv) call closefile(biodivoutfile)
149 if (writeoutput%hstruct) then
150 do i = 1, 16
152 end do
153 end if
154end SUBROUTINE
155
156!done
subroutine openandwriteheaderlight(thefile)
OpenAndWriteHeaderLight
subroutine openandwriteheader(thefile, nspc)
OpenAndWriteHeader
subroutine m_check(status, linenumber, filename)
m_check
subroutine closeoutputfiles
CloseOutputFiles
subroutine prepareoutput(nspc)
PrepareOutput
type(wroutp) writeoutput
Definition All_par.f90:143
subroutine closefile(thefile)
closeFile
type(file) nppoutfile
type(file) biodivoutfile
type(file) numberoutfile
type(file) lightdistrperhcloutfile
type(file) biomassoutfile
type(file) pollenoutfile
type(file) heightperhcloutfile
type(file) ingrowthoutfile
type(file) seedprodfractpertreehcloutfile
type(file) seedoutfile
type(file), dimension(16) heightstructoutfiles
type(file) antaoutfile
type(file) lightandleafareaperlightclass
type(file) laioutfile
type(file) biompertreehcloutfile
type(file) laipertreehcloutfile
type(file) basareaoutfile
type(file) dbhpertreehcloutfile