SUEWS API Site
Documentation of SUEWS source code
suews_ctrl_output.f95
Go to the documentation of this file.
2 !===========================================================================================
3 ! generic output functions for SUEWS
4 ! authors: Ting Sun (ting.sun@reading.ac.uk)
5 !
6 ! disclamier:
7 ! This code employs the netCDF Fortran 90 API.
8 ! Full documentation of the netCDF Fortran 90 API can be found at:
9 ! https://www.unidata.ucar.edu/software/netcdf/netcdf-4/newdocs/netcdf-f90/
10 ! Part of the work is under the help of examples provided by the documentation.
11 !
12 ! purpose:
13 ! these subroutines write out the results of SUEWS in netCDF format.
14 !
15 !
16 ! history:
17 ! TS 20161209: initial version of netcdf function
18 ! TS 20161213: standalise the txt2nc procedure
19 ! TS 20170414: generic output procedures
20 ! TS 20171016: added support for DailyState
21 ! TS 20171017: combined txt and nc wrappers into one: reduced duplicate code at two places
22 !===========================================================================================
23
25 USE cbl_module
26 USE data_in
27 ! USE defaultNotUsed
28 ! USE ESTM_data
29 USE gis_data
30 ! USE initial
31 USE sues_data
32 USE time
33 USE strings
34
35 IMPLICIT NONE
36
37 INTEGER :: n
38
39 CHARACTER(len=10), PARAMETER :: & !Define useful formats here
40 fy = 'i0004,1X', & !4 digit integer for year
41 ft = 'i0004,1X', & !3 digit integer for id, it, imin
42 fd = 'f08.4,1X', & !3 digits + 4 dp for dectime
43 f94 = 'f09.4,1X', & !standard output format: 4 dp + 4 digits
44 f104 = 'f10.4,1X', & !standard output format: 4 dp + 5 digits
45 f106 = 'f10.6,1X', & !standard output format: 6 dp + 3 digits
46 f146 = 'f14.6,1X' !standard output format: 6 dp + 7 digits
47
48 CHARACTER(len=1), PARAMETER :: & ! Define aggregation methods here
49 at = 'T', & !time columns
50 aa = 'A', & !average
51 as = 'S', & !sum
52 al = 'L' !last value
53
54 CHARACTER(len=3) :: itext
55
56 ! define type: variable attributes
58 CHARACTER(len=20) :: header ! short name in headers
59 CHARACTER(len=12) :: unit ! unit
60 CHARACTER(len=10) :: fmt ! output format
61 CHARACTER(len=100) :: longnm ! long name for detailed description
62 CHARACTER(len=1) :: aggreg ! aggregation method
63 CHARACTER(len=10) :: group ! group: datetime, default, ESTM, Snow, etc.
64 INTEGER :: level ! output priority level: 0 for highest (defualt output)
65 END TYPE varattr
66
67 ! initialise valist
68 TYPE(varattr) :: varlistall(1200)
69
70 ! datetime:
71 DATA(varlistall(n), n=1, 5)/ &
72 varattr('Year', 'YYYY', fy, 'Year', at, 'datetime', 0), &
73 varattr('DOY', 'DOY', ft, 'Day of Year', at, 'datetime', 0), &
74 varattr('Hour', 'HH', ft, 'Hour', at, 'datetime', 0), &
75 varattr('Min', 'MM', ft, 'Minute', at, 'datetime', 0), &
76 varattr('Dectime', '-', fd, 'Decimal time', at, 'datetime', 0) &
77 /
78
79 ! defualt:
80 DATA(varlistall(n), &
81 n=5 + 1, &
83 varattr('Kdown', 'W m-2', f104, 'Incoming shortwave radiation', aa, 'SUEWS', 0), &
84 varattr('Kup', 'W m-2', f104, 'Outgoing shortwave radiation', aa, 'SUEWS', 0), &
85 varattr('Ldown', 'W m-2', f104, 'Incoming longwave radiation', aa, 'SUEWS', 0), &
86 varattr('Lup', 'W m-2', f104, 'Outgoing longwave radiation', aa, 'SUEWS', 0), &
87 varattr('Tsurf', 'degC', f104, 'Bulk surface temperature', aa, 'SUEWS', 0), &
88 varattr('QN', 'W m-2', f104, 'Net all-wave radiation', aa, 'SUEWS', 0), &
89 varattr('QF', 'W m-2', f104, 'Anthropogenic heat flux', aa, 'SUEWS', 0), &
90 varattr('QS', 'W m-2', f104, 'Net storage heat flux', aa, 'SUEWS', 0), &
91 varattr('QH', 'W m-2', f104, 'Sensible heat flux', aa, 'SUEWS', 0), &
92 varattr('QE', 'W m-2', f104, 'Latent heat flux', aa, 'SUEWS', 0), &
93 varattr('QHlumps', 'W m-2', f104, 'Sensible heat flux (using LUMPS)', aa, 'SUEWS', 1), &
94 varattr('QElumps', 'W m-2', f104, 'Latent heat flux (using LUMPS)', aa, 'SUEWS', 1), &
95 varattr('QHresis', 'W m-2', f104, 'Sensible heat flux (resistance method)', aa, 'SUEWS', 1), &
96 varattr('Rain', 'mm', f104, 'Rain', as, 'SUEWS', 0), &
97 varattr('Irr', 'mm', f104, 'Irrigation', as, 'SUEWS', 0), &
98 varattr('Evap', 'mm', f104, 'Evaporation', as, 'SUEWS', 0), &
99 varattr('RO', 'mm', f104, 'Runoff', as, 'SUEWS', 0), &
100 varattr('TotCh', 'mm', f146, 'Surface and soil moisture change', as, 'SUEWS', 0), &
101 varattr('SurfCh', 'mm', f146, 'Surface moisture change', as, 'SUEWS', 0), &
102 varattr('State', 'mm', f104, 'Surface Wetness State', al, 'SUEWS', 0), &
103 varattr('NWtrState', 'mm', f104, 'Surface wetness state (non-water surfaces)', al, 'SUEWS', 0), &
104 varattr('Drainage', 'mm', f104, 'Drainage', as, 'SUEWS', 0), &
105 varattr('SMD', 'mm', f94, 'Soil Moisture Deficit', al, 'SUEWS', 0), &
106 varattr('FlowCh', 'mm', f104, 'Additional flow into water body', as, 'SUEWS', 1), &
107 varattr('AddWater', 'mm', f104, 'Addtional water from other grids', as, 'SUEWS', 1), &
108 varattr('ROSoil', 'mm', f104, 'Runoff to soil', as, 'SUEWS', 1), &
109 varattr('ROPipe', 'mm', f104, 'Runoff to pipes', as, 'SUEWS', 1), &
110 varattr('ROImp', 'mm', f104, 'Runoff over impervious surfaces', as, 'SUEWS', 1), &
111 varattr('ROVeg', 'mm', f104, 'Runoff over vegetated surfaces', as, 'SUEWS', 1), &
112 varattr('ROWater', 'mm', f104, 'Runoff for water surface', as, 'SUEWS', 1), &
113 varattr('WUInt', 'mm', f94, 'InternalWaterUse', as, 'SUEWS', 1), &
114 varattr('WUEveTr', 'mm', f94, 'Water use for evergreen trees', as, 'SUEWS', 1), &
115 varattr('WUDecTr', 'mm', f94, 'Water use for deciduous trees', as, 'SUEWS', 1), &
116 varattr('WUGrass', 'mm', f94, 'Water use for grass', as, 'SUEWS', 1), &
117 varattr('SMDPaved', 'mm', f94, 'Soil moisture deficit for paved surface', al, 'SUEWS', 1), &
118 varattr('SMDBldgs', 'mm', f94, 'Soil moisture deficit for building surface', al, 'SUEWS', 1), &
119 varattr('SMDEveTr', 'mm', f94, 'Soil moisture deficit for evergreen tree surface', al, 'SUEWS', 1), &
120 varattr('SMDDecTr', 'mm', f94, 'Soil moisture deficit for deciduous tree surface', al, 'SUEWS', 1), &
121 varattr('SMDGrass', 'mm', f94, 'Soil moisture deficit for grass surface', al, 'SUEWS', 1), &
122 varattr('SMDBSoil', 'mm', f94, 'Soil moisture deficit for bare soil surface', al, 'SUEWS', 1), &
123 varattr('StPaved', 'mm', f94, 'Surface wetness state for paved surface', al, 'SUEWS', 1), &
124 varattr('StBldgs', 'mm', f94, 'Surface wetness state for building surface', al, 'SUEWS', 1), &
125 varattr('StEveTr', 'mm', f94, 'Surface wetness state for evergreen tree surface', al, 'SUEWS', 1), &
126 varattr('StDecTr', 'mm', f94, 'Surface wetness state for deciduous tree surface', al, 'SUEWS', 1), &
127 varattr('StGrass', 'mm', f94, 'Surface wetness state for grass surface', al, 'SUEWS', 1), &
128 varattr('StBSoil', 'mm', f94, 'Surface wetness state for bare soil surface', al, 'SUEWS', 1), &
129 varattr('StWater', 'mm', f104, 'Surface wetness state for water surface', al, 'SUEWS', 1), &
130 varattr('Zenith', 'degree', f104, 'Solar zenith angle', al, 'SUEWS', 0), &
131 varattr('Azimuth', 'degree', f94, 'Solar azimuth angle', al, 'SUEWS', 0), &
132 varattr('AlbBulk', '1', f94, 'Bulk albedo', aa, 'SUEWS', 0), &
133 varattr('Fcld', '1', f94, 'Cloud fraction', aa, 'SUEWS', 0), &
134 varattr('LAI', 'm2 m-2', f94, 'Leaf area index', aa, 'SUEWS', 0), &
135 varattr('z0m', 'm', f94, 'Roughness length for momentum', aa, 'SUEWS', 1), &
136 varattr('zdm', 'm', f94, 'Zero-plane displacement height', aa, 'SUEWS', 1), &
137 varattr('UStar', 'm s-1', f94, 'Friction velocity', aa, 'SUEWS', 0), &
138 varattr('Lob', 'm', f146, 'Obukhov length', aa, 'SUEWS', 0), &
139 varattr('RA', 's m-1', f104, 'Aerodynamic resistance', aa, 'SUEWS', 1), &
140 varattr('RS', 's m-1', f104, 'Surface resistance', aa, 'SUEWS', 1), &
141 varattr('Fc', 'umol m-2 s-1', f94, 'CO2 flux', aa, 'SUEWS', 0), &
142 varattr('FcPhoto', 'umol m-2 s-1', f94, 'CO2 flux from photosynthesis', aa, 'SUEWS', 1), &
143 varattr('FcRespi', 'umol m-2 s-1', f94, 'CO2 flux from respiration', aa, 'SUEWS', 1), &
144 varattr('FcMetab', 'umol m-2 s-1', f94, 'CO2 flux from metabolism', aa, 'SUEWS', 1), &
145 varattr('FcTraff', 'umol m-2 s-1', f94, 'CO2 flux from traffic', aa, 'SUEWS', 1), &
146 varattr('FcBuild', 'umol m-2 s-1', f94, 'CO2 flux from buildings', aa, 'SUEWS', 1), &
147 varattr('FcPoint', 'umol m-2 s-1', f94, 'CO2 flux from point source', aa, 'SUEWS', 1), &
148 varattr('QNSnowFr', 'W m-2', f94, 'Net all-wave radiation for non-snow area', aa, 'SUEWS', 2), &
149 varattr('QNSnow', 'W m-2', f94, 'Net all-wave radiation for snow area', aa, 'SUEWS', 2), &
150 varattr('AlbSnow', '-', f94, 'Snow albedo', aa, 'SUEWS', 2), &
151 varattr('QM', 'W m-2', f106, 'Snow-related heat exchange', aa, 'SUEWS', 2), &
152 varattr('QMFreeze', 'W m-2', f146, 'Internal energy change', aa, 'SUEWS', 2), &
153 varattr('QMRain', 'W m-2', f106, 'Heat released by rain on snow', aa, 'SUEWS', 2), &
154 varattr('SWE', 'mm', f104, 'Snow water equivalent', aa, 'SUEWS', 2), &
155 varattr('MeltWater', 'mm', f104, 'Meltwater', aa, 'SUEWS', 2), &
156 varattr('MeltWStore', 'mm', f104, 'Meltwater store', aa, 'SUEWS', 2), &
157 varattr('SnowCh', 'mm', f104, 'Change in snow pack', as, 'SUEWS', 2), &
158 varattr('SnowRPaved', 'mm', f94, 'Snow removed from paved surface', as, 'SUEWS', 2), &
159 varattr('SnowRBldgs', 'mm', f94, 'Snow removed from building surface', as, 'SUEWS', 2), &
160 varattr('Ts', 'degC', f94, 'Skin temperature', aa, 'SUEWS', 0), &
161 varattr('T2', 'degC', f94, 'Air temperature at 2 m', aa, 'SUEWS', 0), &
162 varattr('Q2', 'g kg-1', f94, 'Specific humidity at 2 m', aa, 'SUEWS', 0), &
163 varattr('U10', 'm s-1', f94, 'Wind speed at 10 m', aa, 'SUEWS', 0), &
164 varattr('RH2', '%', f94, 'Relative humidity at 2 m', aa, 'SUEWS', 0) &
165 /
166
167 ! BEERS (successor of SOLWEIG):
168 DATA(varlistall(n), &
171 varattr('azimuth', 'to_add', f106, 'azimuth', aa, 'BEERS', 0), &
172 varattr('altitude', 'to_add', f106, 'altitude', aa, 'BEERS', 0), &
173 varattr('GlobalRad', 'W m-2', f106, 'Global Irradiance', aa, 'BEERS', 0), &
174 varattr('DiffuseRad', 'W m-2', f106, 'Diffuse Radiation', aa, 'BEERS', 0), &
175 varattr('DirectRad', 'W m-2', f106, 'Direct Radiation', aa, 'BEERS', 0), &
176 varattr('Kdown2d', 'W m-2', f106, 'Incoming shortwave radiation at POI', aa, 'BEERS', 0), &
177 varattr('Kup2d', 'W m-2', f106, 'Outgoing shortwave radiation at POI', aa, 'BEERS', 0), &
178 varattr('Ksouth', 'W m-2', f106, 'Shortwave radiation from south at POI', aa, 'BEERS', 0), &
179 varattr('Kwest', 'W m-2', f106, 'Shortwave radiation from west at POI', aa, 'BEERS', 0), &
180 varattr('Knorth', 'W m-2', f106, 'Shortwave radiation from north at POI', aa, 'BEERS', 0), &
181 varattr('Keast', 'W m-2', f106, 'Shortwave radiation from east at POI', aa, 'BEERS', 0), &
182 varattr('Ldown2d', 'W m-2', f106, 'Incoming longwave radiation at POI', aa, 'BEERS', 0), &
183 varattr('Lup2d', 'W m-2', f106, 'Outgoing longwave radiation at POI', aa, 'BEERS', 0), &
184 varattr('Lsouth', 'W m-2', f106, 'Longwave radiation from west at POI', aa, 'BEERS', 0), &
185 varattr('Lwest', 'W m-2', f106, 'Longwave radiation from south at POI', aa, 'BEERS', 0), &
186 varattr('Lnorth', 'W m-2', f106, 'Longwave radiation from north at POI', aa, 'BEERS', 0), &
187 varattr('Least', 'W m-2', f106, 'Longwave radiation from east at POI', aa, 'BEERS', 0), &
188 varattr('Tmrt', 'degC', f106, 'Mean Radiant Temperature', aa, 'BEERS', 0), &
189 varattr('I0', 'W m-2', f106, 'theoretical value of maximum incoming solar radiation', aa, 'BEERS', 0), &
190 varattr('CI', '', f106, 'clearness index for Ldown', aa, 'BEERS', 0), &
191 ! varAttr('gvf', '', f106, 'Ground view factor', aA, 'BEERS', 0), &
192 varattr('SH_Ground', '', f106, 'shadowground', aa, 'BEERS', 0), &
193 varattr('SH_Walls', '', f106, 'shadowwalls', aa, 'BEERS', 0), &
194 varattr('SVF_Ground', '', f106, 'Sky View Factor from ground', aa, 'BEERS', 0), &
195 varattr('SVF_Roof', '', f106, 'Sky View Factor from roof', aa, 'BEERS', 0), &
196 varattr('SVF_BdVeg', '', f106, 'Sky View Factor from buildings and vegetation', aa, 'BEERS', 0), &
197 varattr('Emis_Sky', 'degC', f106, 'clear-sky emissivity from Prata (1996)', aa, 'BEERS', 0), &
198 varattr('Ta', 'degC', f104, 'Air temperature', aa, 'BEERS', 0), &
199 varattr('Tg', 'degC', f104, 'Ground Surface temperature', aa, 'BEERS', 0), &
200 varattr('Tw', 'degC', f104, 'Wall Surface temperature', aa, 'BEERS', 0) &
201 /
202
203 ! BL:
204 DATA(varlistall(n), &
207 varattr('z', 'to_add', f104, 'z', aa, 'BL', 0), &
208 varattr('theta', 'to_add', f104, 'theta', aa, 'BL', 0), &
209 varattr('q', 'to_add', f104, 'q', aa, 'BL', 0), &
210 varattr('theta+', 'to_add', f104, 'theta+', aa, 'BL', 0), &
211 varattr('q+', 'to_add', f104, 'q+', aa, 'BL', 0), &
212 varattr('Temp_C', 'to_add', f104, 'Temp_C', aa, 'BL', 0), &
213 varattr('rh', 'to_add', f104, 'rh', aa, 'BL', 0), &
214 varattr('QH_use', 'to_add', f104, 'QH_use', aa, 'BL', 0), &
215 varattr('QE_use', 'to_add', f104, 'QE_use', aa, 'BL', 0), &
216 varattr('Press_hPa', 'to_add', f104, 'Press_hPa', aa, 'BL', 0), &
217 varattr('avu1', 'to_add', f104, 'avu1', aa, 'BL', 0), &
218 varattr('UStar', 'to_add', f104, 'UStar', aa, 'BL', 0), &
219 varattr('avdens', 'to_add', f104, 'avdens', aa, 'BL', 0), &
220 varattr('lv_J_kg', 'to_add', f146, 'lv_J_kg', aa, 'BL', 0), &
221 varattr('avcp', 'to_add', f104, 'avcp', aa, 'BL', 0), &
222 varattr('gamt', 'to_add', f104, 'gamt', aa, 'BL', 0), &
223 varattr('gamq', 'to_add', f104, 'gamq', aa, 'BL', 0) &
224 /
225
226 ! Snow:
227 DATA(varlistall(n), &
230 varattr('SWE_Paved', 'mm', f106, 'Snow water equivalent for paved surface', aa, 'snow', 0), &
231 varattr('SWE_Bldgs', 'mm', f106, 'Snow water equivalent for building surface', aa, 'snow', 0), &
232 varattr('SWE_EveTr', 'mm', f106, 'Snow water equivalent for evergreen tree surface', aa, 'snow', 0), &
233 varattr('SWE_DecTr', 'mm', f106, 'Snow water equivalent for deciduous tree surface', aa, 'snow', 0), &
234 varattr('SWE_Grass', 'mm', f106, 'Snow water equivalent for grass surface', aa, 'snow', 0), &
235 varattr('SWE_BSoil', 'mm', f106, 'Snow water equivalent for bare soil surface', aa, 'snow', 0), &
236 varattr('SWE_Water', 'mm', f106, 'Snow water equivalent for water surface', aa, 'snow', 0), &
237 varattr('Mw_Paved', 'mm', f106, 'Meltwater for paved surface', as, 'snow', 0), &
238 varattr('Mw_Bldgs', 'mm', f106, 'Meltwater for building surface', as, 'snow', 0), &
239 varattr('Mw_EveTr', 'mm', f106, 'Meltwater for evergreen tree surface', as, 'snow', 0), &
240 varattr('Mw_DecTr', 'mm', f106, 'Meltwater for deciduous tree surface', as, 'snow', 0), &
241 varattr('Mw_Grass', 'mm', f106, 'Meltwater for grass surface', as, 'snow', 0), &
242 varattr('Mw_BSoil', 'mm', f106, 'Meltwater for bare soil surface', as, 'snow', 0), &
243 varattr('Mw_Water', 'mm', f106, 'Meltwater for water surface', as, 'snow', 0), &
244 varattr('Qm_Paved', 'W m-2', f106, 'Snow-related heat exchange for paved surface', aa, 'snow', 0), &
245 varattr('Qm_Bldgs', 'W m-2', f106, 'Snow-related heat exchange for building surface', aa, 'snow', 0), &
246 varattr('Qm_EveTr', 'W m-2', f106, 'Snow-related heat exchange for evergreen tree surface', aa, 'snow', 0), &
247 varattr('Qm_DecTr', 'W m-2', f106, 'Snow-related heat exchange for deciduous tree surface', aa, 'snow', 0), &
248 varattr('Qm_Grass', 'W m-2', f106, 'Snow-related heat exchange for grass surface', aa, 'snow', 0), &
249 varattr('Qm_BSoil', 'W m-2', f106, 'Snow-related heat exchange for bare soil surface', aa, 'snow', 0), &
250 varattr('Qm_Water', 'W m-2', f106, 'Snow-related heat exchange for water surface', aa, 'snow', 0), &
251 varattr('Qa_Paved', 'W m-2', f106, 'Advective heat for paved surface', aa, 'snow', 0), &
252 varattr('Qa_Bldgs', 'W m-2', f106, 'Advective heat for building surface', aa, 'snow', 0), &
253 varattr('Qa_EveTr', 'W m-2', f106, 'Advective heat for evergreen tree surface', aa, 'snow', 0), &
254 varattr('Qa_DecTr', 'W m-2', f106, 'Advective heat for deciduous tree surface', aa, 'snow', 0), &
255 varattr('Qa_Grass', 'W m-2', f106, 'Advective heat for grass surface', aa, 'snow', 0), &
256 varattr('Qa_BSoil', 'W m-2', f106, 'Advective heat for bare soil surface', aa, 'snow', 0), &
257 varattr('Qa_Water', 'W m-2', f106, 'Advective heat for water surface', aa, 'snow', 0), &
258 varattr('QmFr_Paved', 'W m-2', f146, 'Heat related to freezing for paved surface', aa, 'snow', 0), &
259 varattr('QmFr_Bldgs', 'W m-2', f146, 'Heat related to freezing for building surface', aa, 'snow', 0), &
260 varattr('QmFr_EveTr', 'W m-2', f146, 'Heat related to freezing for evergreen tree surface', aa, 'snow', 0), &
261 varattr('QmFr_DecTr', 'W m-2', f146, 'Heat related to freezing for deciduous tree surface', aa, 'snow', 0), &
262 varattr('QmFr_Grass', 'W m-2', f146, 'Heat related to freezing for grass surface', aa, 'snow', 0), &
263 varattr('QmFr_BSoil', 'W m-2', f146, 'Heat related to freezing for bare soil surface', aa, 'snow', 0), &
264 varattr('QmFr_Water', 'W m-2', f146, 'Heat related to freezing for water surface', aa, 'snow', 0), &
265 varattr('fr_Paved', '1', f106, 'Fraction of snow for paved surface', aa, 'snow', 0), &
266 varattr('fr_Bldgs', '1', f106, 'Fraction of snow for building surface', aa, 'snow', 0), &
267 varattr('fr_EveTr', '1', f106, 'Fraction of snow for evergreen tree surface', aa, 'snow', 0), &
268 varattr('fr_DecTr', '1', f106, 'Fraction of snow for deciduous tree surface', aa, 'snow', 0), &
269 varattr('fr_Grass', '1', f106, 'Fraction of snow for grass surface', aa, 'snow', 0), &
270 varattr('fr_BSoil', '1', f106, 'Fraction of snow for bare soil surface', aa, 'snow', 0), &
271 varattr('RainSn_Paved', 'mm', f146, 'Rain on snow for paved surface', as, 'snow', 0), &
272 varattr('RainSn_Bldgs', 'mm', f146, 'Rain on snow for building surface', as, 'snow', 0), &
273 varattr('RainSn_EveTr', 'mm', f146, 'Rain on snow for evergreen tree surface', as, 'snow', 0), &
274 varattr('RainSn_DecTr', 'mm', f146, 'Rain on snow for deciduous tree surface', as, 'snow', 0), &
275 varattr('RainSn_Grass', 'mm', f146, 'Rain on snow for grass surface', as, 'snow', 0), &
276 varattr('RainSn_BSoil', 'mm', f146, 'Rain on snow for bare soil surface', as, 'snow', 0), &
277 varattr('RainSn_Water', 'mm', f146, 'Rain on snow for water surface', as, 'snow', 0), &
278 varattr('Qn_PavedSnow', 'W m-2', f146, 'Net all-wave radiation for snow paved surface', aa, 'snow', 0), &
279 varattr('Qn_BldgsSnow', 'W m-2', f146, 'Net all-wave radiation for snow building surface', aa, 'snow', 0), &
280 varattr('Qn_EveTrSnow', 'W m-2', f146, 'Net all-wave radiation for snow evergreen tree surface', aa, 'snow', 0), &
281 varattr('Qn_DecTrSnow', 'W m-2', f146, 'Net all-wave radiation for snow deciduous tree surface', aa, 'snow', 0), &
282 varattr('Qn_GrassSnow', 'W m-2', f146, 'Net all-wave radiation for snow grass surface', aa, 'snow', 0), &
283 varattr('Qn_BSoilSnow', 'W m-2', f146, 'Net all-wave radiation for snow bare soil surface', aa, 'snow', 0), &
284 varattr('Qn_WaterSnow', 'W m-2', f146, 'Net all-wave radiation for snow water surface', aa, 'snow', 0), &
285 varattr('kup_PavedSnow', 'W m-2', f146, 'Reflected shortwave radiation for snow paved surface', aa, 'snow', 0), &
286 varattr('kup_BldgsSnow', 'W m-2', f146, 'Reflected shortwave radiation for snow building surface', aa, 'snow', 0), &
287 varattr('kup_EveTrSnow', 'W m-2', f146, 'Reflected shortwave radiation for snow evergreen tree surface', aa, 'snow', 0), &
288 varattr('kup_DecTrSnow', 'W m-2', f146, 'Reflected shortwave radiation for snow deciduous tree surface', aa, 'snow', 0), &
289 varattr('kup_GrassSnow', 'W m-2', f146, 'Reflected shortwave radiation for snow grass surface', aa, 'snow', 0), &
290 varattr('kup_BSoilSnow', 'W m-2', f146, 'Reflected shortwave radiation for snow bare soil surface', aa, 'snow', 0), &
291 varattr('kup_WaterSnow', 'W m-2', f146, 'Reflected shortwave radiation for snow water surface', aa, 'snow', 0), &
292 varattr('frMelt_Paved', 'mm', f146, 'Amount of freezing melt water for paved surface', aa, 'snow', 0), &
293 varattr('frMelt_Bldgs', 'mm', f146, 'Amount of freezing melt water for building surface', aa, 'snow', 0), &
294 varattr('frMelt_EveTr', 'mm', f146, 'Amount of freezing melt water for evergreen tree surface', aa, 'snow', 0), &
295 varattr('frMelt_DecTr', 'mm', f146, 'Amount of freezing melt water for deciduous tree surface', aa, 'snow', 0), &
296 varattr('frMelt_Grass', 'mm', f146, 'Amount of freezing melt water for grass surface', aa, 'snow', 0), &
297 varattr('frMelt_BSoil', 'mm', f146, 'Amount of freezing melt water for bare soil surface', aa, 'snow', 0), &
298 varattr('frMelt_Water', 'mm', f146, 'Amount of freezing melt water for water surface', aa, 'snow', 0), &
299 varattr('MwStore_Paved', 'mm', f146, 'Meltwater store for paved surface', aa, 'snow', 0), &
300 varattr('MwStore_Bldgs', 'mm', f146, 'Meltwater store for building surface', aa, 'snow', 0), &
301 varattr('MwStore_EveTr', 'mm', f146, 'Meltwater store for evergreen tree surface', aa, 'snow', 0), &
302 varattr('MwStore_DecTr', 'mm', f146, 'Meltwater store for deciduous tree surface', aa, 'snow', 0), &
303 varattr('MwStore_Grass', 'mm', f146, 'Meltwater store for grass surface', aa, 'snow', 0), &
304 varattr('MwStore_BSoil', 'mm', f146, 'Meltwater store for bare soil surface', aa, 'snow', 0), &
305 varattr('MwStore_Water', 'mm', f146, 'Meltwater store for water surface', aa, 'snow', 0), &
306 varattr('DensSnow_Paved', 'kg m-3', f146, 'Snow density for paved surface', aa, 'snow', 0), &
307 varattr('DensSnow_Bldgs', 'kg m-3', f146, 'Snow density for building surface', aa, 'snow', 0), &
308 varattr('DensSnow_EveTr', 'kg m-3', f146, 'Snow density for evergreen tree surface', aa, 'snow', 0), &
309 varattr('DensSnow_DecTr', 'kg m-3', f146, 'Snow density for deciduous tree surface', aa, 'snow', 0), &
310 varattr('DensSnow_Grass', 'kg m-3', f146, 'Snow density for grass surface', aa, 'snow', 0), &
311 varattr('DensSnow_BSoil', 'kg m-3', f146, 'Snow density for bare soil surface', aa, 'snow', 0), &
312 varattr('DensSnow_Water', 'kg m-3', f146, 'Snow density for water surface', aa, 'snow', 0), &
313 varattr('Sd_Paved', 'mm', f106, 'Snow depth for paved surface', aa, 'snow', 0), &
314 varattr('Sd_Bldgs', 'mm', f106, 'Snow depth for building surface', aa, 'snow', 0), &
315 varattr('Sd_EveTr', 'mm', f106, 'Snow depth for evergreen tree surface', aa, 'snow', 0), &
316 varattr('Sd_DecTr', 'mm', f106, 'Snow depth for deciduous tree surface', aa, 'snow', 0), &
317 varattr('Sd_Grass', 'mm', f106, 'Snow depth for grass surface', aa, 'snow', 0), &
318 varattr('Sd_BSoil', 'mm', f106, 'Snow depth for bare soil surface', aa, 'snow', 0), &
319 varattr('Sd_Water', 'mm', f106, 'Snow depth for water surface', aa, 'snow', 0), &
320 varattr('Tsnow_Paved', 'degC', f146, 'Snow surface temperature for paved surface', aa, 'snow', 0), &
321 varattr('Tsnow_Bldgs', 'degC', f146, 'Snow surface temperature for building surface', aa, 'snow', 0), &
322 varattr('Tsnow_EveTr', 'degC', f146, 'Snow surface temperature for evergreen tree surface', aa, 'snow', 0), &
323 varattr('Tsnow_DecTr', 'degC', f146, 'Snow surface temperature for deciduous tree surface', aa, 'snow', 0), &
324 varattr('Tsnow_Grass', 'degC', f146, 'Snow surface temperature for grass surface', aa, 'snow', 0), &
325 varattr('Tsnow_BSoil', 'degC', f146, 'Snow surface temperature for bare soil surface', aa, 'snow', 0), &
326 varattr('Tsnow_Water', 'degC', f146, 'Snow surface temperature for water surface', aa, 'snow', 0), &
327 varattr('SnowAlb', '-', f146, 'Surface albedo for snow/ice', aa, 'snow', 0) &
328 /
329
330 ! ESTM:
331 DATA(varlistall(n), &
334 + ncolumnsdataoutestm - 5)/ &
335 varattr('QS', 'W m-2', f104, 'Total Storage', aa, 'ESTM', 0), &
336 varattr('QSAir', 'W m-2', f104, 'Storage air', aa, 'ESTM', 0), &
337 varattr('QSWall', 'W m-2', f104, 'Storage Wall', aa, 'ESTM', 0), &
338 varattr('QSRoof', 'W m-2', f104, 'Storage Roof', aa, 'ESTM', 0), &
339 varattr('QSGround', 'W m-2', f104, 'Storage Ground', aa, 'ESTM', 0), &
340 varattr('QSIBld', 'W m-2', f104, 'Storage Internal building', aa, 'ESTM', 0), &
341 varattr('TWALL1', 'degK', f104, 'Temperature in wall layer 1', aa, 'ESTM', 0), &
342 varattr('TWALL2', 'degK', f104, 'Temperature in wall layer 2', aa, 'ESTM', 0), &
343 varattr('TWALL3', 'degK', f104, 'Temperature in wall layer 3', aa, 'ESTM', 0), &
344 varattr('TWALL4', 'degK', f104, 'Temperature in wall layer 4', aa, 'ESTM', 0), &
345 varattr('TWALL5', 'degK', f104, 'Temperature in wall layer 5', aa, 'ESTM', 0), &
346 varattr('TROOF1', 'degK', f104, 'Temperature in roof layer 1', aa, 'ESTM', 0), &
347 varattr('TROOF2', 'degK', f104, 'Temperature in roof layer 2', aa, 'ESTM', 0), &
348 varattr('TROOF3', 'degK', f104, 'Temperature in roof layer 3', aa, 'ESTM', 0), &
349 varattr('TROOF4', 'degK', f104, 'Temperature in roof layer 4', aa, 'ESTM', 0), &
350 varattr('TROOF5', 'degK', f104, 'Temperature in roof layer 5', aa, 'ESTM', 0), &
351 varattr('TGROUND1', 'degK', f104, 'Temperature in ground layer 1', aa, 'ESTM', 0), &
352 varattr('TGROUND2', 'degK', f104, 'Temperature in ground layer 2', aa, 'ESTM', 0), &
353 varattr('TGROUND3', 'degK', f104, 'Temperature in ground layer 3', aa, 'ESTM', 0), &
354 varattr('TGROUND4', 'degK', f104, 'Temperature in ground layer 4', aa, 'ESTM', 0), &
355 varattr('TGROUND5', 'degK', f104, 'Temperature in ground layer 5', aa, 'ESTM', 0), &
356 varattr('TiBLD1', 'degK', f104, 'Temperature in internal building layer 1', aa, 'ESTM', 0), &
357 varattr('TiBLD2', 'degK', f104, 'Temperature in internal building layer 2', aa, 'ESTM', 0), &
358 varattr('TiBLD3', 'degK', f104, 'Temperature in internal building layer 3', aa, 'ESTM', 0), &
359 varattr('TiBLD4', 'degK', f104, 'Temperature in internal building layer 4', aa, 'ESTM', 0), &
360 varattr('TiBLD5', 'degK', f104, 'Temperature in internal building layer 5', aa, 'ESTM', 0), &
361 varattr('TaBLD', 'degK', f104, 'Indoor air temperature', aa, 'ESTM', 0) &
362 &/
363
364 ! DailyState:
365 DATA(varlistall(n), &
371 varattr('HDD1_h', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
372 varattr('HDD2_c', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
373 varattr('HDD3_Tmean', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
374 varattr('HDD4_T5d', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
375 varattr('P_day', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
376 varattr('DaysSR', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
377 varattr('GDD_EveTr', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
378 varattr('GDD_DecTr', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
379 varattr('GDD_Grass', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
380 varattr('SDD_EveTr', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
381 varattr('SDD_DecTr', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
382 varattr('SDD_Grass', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
383 varattr('Tmin', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
384 varattr('Tmax', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
385 varattr('DLHrs', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
386 varattr('LAI_EveTr', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
387 varattr('LAI_DecTr', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
388 varattr('LAI_Grass', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
389 varattr('DecidCap', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
390 varattr('Porosity', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
391 varattr('AlbEveTr', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
392 varattr('AlbDecTr', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
393 varattr('AlbGrass', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
394 varattr('WU_EveTr1', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
395 varattr('WU_EveTr2', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
396 varattr('WU_EveTr3', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
397 varattr('WU_DecTr1', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
398 varattr('WU_DecTr2', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
399 varattr('WU_DecTr3', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
400 varattr('WU_Grass1', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
401 varattr('WU_Grass2', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
402 varattr('WU_Grass3', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
403 varattr('LAIlumps', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
404 varattr('AlbSnow', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
405 varattr('DensSnow_Paved', 'to be added', f146, 'to be added', al, 'DailyState', 0), &
406 varattr('DensSnow_Bldgs', 'to be added', f146, 'to be added', al, 'DailyState', 0), &
407 varattr('DensSnow_EveTr', 'to be added', f146, 'to be added', al, 'DailyState', 0), &
408 varattr('DensSnow_DecTr', 'to be added', f146, 'to be added', al, 'DailyState', 0), &
409 varattr('DensSnow_Grass', 'to be added', f146, 'to be added', al, 'DailyState', 0), &
410 varattr('DensSnow_BSoil', 'to be added', f146, 'to be added', al, 'DailyState', 0), &
411 varattr('DensSnow_Water', 'to be added', f146, 'to be added', al, 'DailyState', 0), &
412 varattr('a1', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
413 varattr('a2', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
414 varattr('a3', 'to be added', f104, 'to be added', al, 'DailyState', 0) &
415 /
416
417 ! RSL profiles
418 DATA(varlistall(n), &
422 + 1, &
426 + ncolumnsdataoutrsl - 5)/ &
427 varattr('z_1', 'm', f104, '0.1Zh', aa, 'RSL', 0), &
428 varattr('z_2', 'm', f104, '0.2Zh', aa, 'RSL', 0), &
429 varattr('z_3', 'm', f104, '0.3Zh', aa, 'RSL', 0), &
430 varattr('z_4', 'm', f104, '0.4Zh', aa, 'RSL', 0), &
431 varattr('z_5', 'm', f104, '0.5Zh', aa, 'RSL', 0), &
432 varattr('z_6', 'm', f104, '0.6Zh', aa, 'RSL', 0), &
433 varattr('z_7', 'm', f104, '0.7Zh', aa, 'RSL', 0), &
434 varattr('z_8', 'm', f104, '0.8Zh', aa, 'RSL', 0), &
435 varattr('z_9', 'm', f104, '0.9Zh', aa, 'RSL', 0), &
436 varattr('z_10', 'm', f104, 'Zh', aa, 'RSL', 0), &
437 varattr('z_11', 'm', f104, '1.1Zh', aa, 'RSL', 0), &
438 varattr('z_12', 'm', f104, '1.2Zh', aa, 'RSL', 0), &
439 varattr('z_13', 'm', f104, '1.3Zh', aa, 'RSL', 0), &
440 varattr('z_14', 'm', f146, '1.4Zh', aa, 'RSL', 0), &
441 varattr('z_15', 'm', f104, '1.5Zh', aa, 'RSL', 0), &
442 varattr('z_16', 'm', f104, '1.6Zh', aa, 'RSL', 0), &
443 varattr('z_17', 'm', f104, '1.7Zh', aa, 'RSL', 0), &
444 varattr('z_18', 'm', f104, '1.8Zh', aa, 'RSL', 0), &
445 varattr('z_19', 'm', f104, '1.9Zh', aa, 'RSL', 0), &
446 varattr('z_20', 'm', f104, '2.0Zh', aa, 'RSL', 0), &
447 varattr('z_21', 'm', f146, '2.1Zh', aa, 'RSL', 0), &
448 varattr('z_22', 'm', f104, '2.2Zh', aa, 'RSL', 0), &
449 varattr('z_23', 'm', f104, '2.3Zh', aa, 'RSL', 0), &
450 varattr('z_24', 'm', f104, '2.4Zh', aa, 'RSL', 0), &
451 varattr('z_25', 'm', f104, '2.5Zh', aa, 'RSL', 0), &
452 varattr('z_26', 'm', f104, '2.6Zh', aa, 'RSL', 0), &
453 varattr('z_27', 'm', f104, '2.7Zh', aa, 'RSL', 0), &
454 varattr('z_28', 'm', f104, '2.8Zh', aa, 'RSL', 0), &
455 varattr('z_29', 'm', f104, '2.9Zh', aa, 'RSL', 0), &
456 varattr('z_30', 'm', f104, '3.0Zh', aa, 'RSL', 0), &
457 varattr('U_1', 'm s-1', f104, 'U at 0.1Zh', aa, 'RSL', 0), &
458 varattr('U_2', 'm s-1', f104, 'U at 0.2Zh', aa, 'RSL', 0), &
459 varattr('U_3', 'm s-1', f104, 'U at 0.3Zh', aa, 'RSL', 0), &
460 varattr('U_4', 'm s-1', f104, 'U at 0.4Zh', aa, 'RSL', 0), &
461 varattr('U_5', 'm s-1', f104, 'U at 0.5Zh', aa, 'RSL', 0), &
462 varattr('U_6', 'm s-1', f104, 'U at 0.6Zh', aa, 'RSL', 0), &
463 varattr('U_7', 'm s-1', f104, 'U at 0.7Zh', aa, 'RSL', 0), &
464 varattr('U_8', 'm s-1', f104, 'U at 0.8Zh', aa, 'RSL', 0), &
465 varattr('U_9', 'm s-1', f104, 'U at 0.9Zh', aa, 'RSL', 0), &
466 varattr('U_10', 'm s-1', f104, 'U at Zh', aa, 'RSL', 0), &
467 varattr('U_11', 'm s-1', f104, 'U at 1.1Zh', aa, 'RSL', 0), &
468 varattr('U_12', 'm s-1', f104, 'U at 1.2Zh', aa, 'RSL', 0), &
469 varattr('U_13', 'm s-1', f104, 'U at 1.3Zh', aa, 'RSL', 0), &
470 varattr('U_14', 'm s-1', f146, 'U at 1.4Zh', aa, 'RSL', 0), &
471 varattr('U_15', 'm s-1', f104, 'U at 1.5Zh', aa, 'RSL', 0), &
472 varattr('U_16', 'm s-1', f104, 'U at 1.6Zh', aa, 'RSL', 0), &
473 varattr('U_17', 'm s-1', f104, 'U at 1.7Zh', aa, 'RSL', 0), &
474 varattr('U_18', 'm s-1', f104, 'U at 1.8Zh', aa, 'RSL', 0), &
475 varattr('U_19', 'm s-1', f104, 'U at 1.9Zh', aa, 'RSL', 0), &
476 varattr('U_20', 'm s-1', f104, 'U at 2.0Zh', aa, 'RSL', 0), &
477 varattr('U_21', 'm s-1', f146, 'U at 2.1Zh', aa, 'RSL', 0), &
478 varattr('U_22', 'm s-1', f104, 'U at 2.2Zh', aa, 'RSL', 0), &
479 varattr('U_23', 'm s-1', f104, 'U at 2.3Zh', aa, 'RSL', 0), &
480 varattr('U_24', 'm s-1', f104, 'U at 2.4Zh', aa, 'RSL', 0), &
481 varattr('U_25', 'm s-1', f104, 'U at 2.5Zh', aa, 'RSL', 0), &
482 varattr('U_26', 'm s-1', f104, 'U at 2.6Zh', aa, 'RSL', 0), &
483 varattr('U_27', 'm s-1', f104, 'U at 2.7Zh', aa, 'RSL', 0), &
484 varattr('U_28', 'm s-1', f104, 'U at 2.8Zh', aa, 'RSL', 0), &
485 varattr('U_29', 'm s-1', f104, 'U at 2.9Zh', aa, 'RSL', 0), &
486 varattr('U_30', 'm s-1', f104, 'U at 3.0Zh', aa, 'RSL', 0), &
487 varattr('T_1', 'degC', f104, 'T at 0.1Zh', aa, 'RSL', 0), &
488 varattr('T_2', 'degC', f104, 'T at 0.2Zh', aa, 'RSL', 0), &
489 varattr('T_3', 'degC', f104, 'T at 0.3Zh', aa, 'RSL', 0), &
490 varattr('T_4', 'degC', f104, 'T at 0.4Zh', aa, 'RSL', 0), &
491 varattr('T_5', 'degC', f104, 'T at 0.5Zh', aa, 'RSL', 0), &
492 varattr('T_6', 'degC', f104, 'T at 0.6Zh', aa, 'RSL', 0), &
493 varattr('T_7', 'degC', f104, 'T at 0.7Zh', aa, 'RSL', 0), &
494 varattr('T_8', 'degC', f104, 'T at 0.8Zh', aa, 'RSL', 0), &
495 varattr('T_9', 'degC', f104, 'T at 0.9Zh', aa, 'RSL', 0), &
496 varattr('T_10', 'degC', f104, 'T at Zh', aa, 'RSL', 0), &
497 varattr('T_11', 'degC', f104, 'T at 1.1Zh', aa, 'RSL', 0), &
498 varattr('T_12', 'degC', f104, 'T at 1.2Zh', aa, 'RSL', 0), &
499 varattr('T_13', 'degC', f104, 'T at 1.3Zh', aa, 'RSL', 0), &
500 varattr('T_14', 'degC', f146, 'T at 1.4Zh', aa, 'RSL', 0), &
501 varattr('T_15', 'degC', f104, 'T at 1.5Zh', aa, 'RSL', 0), &
502 varattr('T_16', 'degC', f104, 'T at 1.6Zh', aa, 'RSL', 0), &
503 varattr('T_17', 'degC', f104, 'T at 1.7Zh', aa, 'RSL', 0), &
504 varattr('T_18', 'degC', f104, 'T at 1.8Zh', aa, 'RSL', 0), &
505 varattr('T_19', 'degC', f104, 'T at 1.9Zh', aa, 'RSL', 0), &
506 varattr('T_20', 'degC', f104, 'T at 2.0Zh', aa, 'RSL', 0), &
507 varattr('T_21', 'degC', f146, 'T at 2.1Zh', aa, 'RSL', 0), &
508 varattr('T_22', 'degC', f104, 'T at 2.2Zh', aa, 'RSL', 0), &
509 varattr('T_23', 'degC', f104, 'T at 2.3Zh', aa, 'RSL', 0), &
510 varattr('T_24', 'degC', f104, 'T at 2.4Zh', aa, 'RSL', 0), &
511 varattr('T_25', 'degC', f104, 'T at 2.5Zh', aa, 'RSL', 0), &
512 varattr('T_26', 'degC', f104, 'T at 2.6Zh', aa, 'RSL', 0), &
513 varattr('T_27', 'degC', f104, 'T at 2.7Zh', aa, 'RSL', 0), &
514 varattr('T_28', 'degC', f104, 'T at 2.8Zh', aa, 'RSL', 0), &
515 varattr('T_29', 'degC', f104, 'T at 2.9Zh', aa, 'RSL', 0), &
516 varattr('T_30', 'degC', f104, 'T at 3.0Zh', aa, 'RSL', 0), &
517 varattr('q_1', 'g kg-1', f104, 'q at 0.1Zh', aa, 'RSL', 0), &
518 varattr('q_2', 'g kg-1', f104, 'q at 0.2Zh', aa, 'RSL', 0), &
519 varattr('q_3', 'g kg-1', f104, 'q at 0.3Zh', aa, 'RSL', 0), &
520 varattr('q_4', 'g kg-1', f104, 'q at 0.4Zh', aa, 'RSL', 0), &
521 varattr('q_5', 'g kg-1', f104, 'q at 0.5Zh', aa, 'RSL', 0), &
522 varattr('q_6', 'g kg-1', f104, 'q at 0.6Zh', aa, 'RSL', 0), &
523 varattr('q_7', 'g kg-1', f104, 'q at 0.7Zh', aa, 'RSL', 0), &
524 varattr('q_8', 'g kg-1', f104, 'q at 0.8Zh', aa, 'RSL', 0), &
525 varattr('q_9', 'g kg-1', f104, 'q at 0.9Zh', aa, 'RSL', 0), &
526 varattr('q_10', 'g kg-1', f104, 'q at Zh', aa, 'RSL', 0), &
527 varattr('q_11', 'g kg-1', f104, 'q at 1.1Zh', aa, 'RSL', 0), &
528 varattr('q_12', 'g kg-1', f104, 'q at 1.2Zh', aa, 'RSL', 0), &
529 varattr('q_13', 'g kg-1', f104, 'q at 1.3Zh', aa, 'RSL', 0), &
530 varattr('q_14', 'g kg-1', f146, 'q at 1.4Zh', aa, 'RSL', 0), &
531 varattr('q_15', 'g kg-1', f104, 'q at 1.5Zh', aa, 'RSL', 0), &
532 varattr('q_16', 'g kg-1', f104, 'q at 1.6Zh', aa, 'RSL', 0), &
533 varattr('q_17', 'g kg-1', f104, 'q at 1.7Zh', aa, 'RSL', 0), &
534 varattr('q_18', 'g kg-1', f104, 'q at 1.8Zh', aa, 'RSL', 0), &
535 varattr('q_19', 'g kg-1', f104, 'q at 1.9Zh', aa, 'RSL', 0), &
536 varattr('q_20', 'g kg-1', f104, 'q at 2.0Zh', aa, 'RSL', 0), &
537 varattr('q_21', 'g kg-1', f146, 'q at 2.1Zh', aa, 'RSL', 0), &
538 varattr('q_22', 'g kg-1', f104, 'q at 2.2Zh', aa, 'RSL', 0), &
539 varattr('q_23', 'g kg-1', f104, 'q at 2.3Zh', aa, 'RSL', 0), &
540 varattr('q_24', 'g kg-1', f104, 'q at 2.4Zh', aa, 'RSL', 0), &
541 varattr('q_25', 'g kg-1', f104, 'q at 2.5Zh', aa, 'RSL', 0), &
542 varattr('q_26', 'g kg-1', f104, 'q at 2.6Zh', aa, 'RSL', 0), &
543 varattr('q_27', 'g kg-1', f104, 'q at 2.7Zh', aa, 'RSL', 0), &
544 varattr('q_28', 'g kg-1', f104, 'q at 2.8Zh', aa, 'RSL', 0), &
545 varattr('q_29', 'g kg-1', f104, 'q at 2.9Zh', aa, 'RSL', 0), &
546 varattr('q_30', 'g kg-1', f104, 'q at 3.0Zh', aa, 'RSL', 0), &
547 ! debug info
548 ! varAttr('L_stab', 'm', f104, 'threshold of Obukhob length under stable conditions', aA, 'RSL', 0), &
549 ! varAttr('L_unstab', 'm', f104, 'threshold of Obukhob length under unstable conditions', aA, 'RSL', 0), &
550 varattr('L_MOD_RSL', 'm', f104, 'Obukhob length', aa, 'RSL', 0), &
551 varattr('zH_RSL', 'm', f104, 'canyon depth', aa, 'RSL', 0), &
552 ! varAttr('Lc_stab', 'm', f104, 'threshold of canopy drag length scale under stable conditions', aA, 'RSL', 0), &
553 ! varAttr('Lc_unstab', 'm', f104, 'threshold of canopy drag length scale under unstable conditions', aA, 'RSL', 0), &
554 varattr('Lc', 'm', f104, 'canopy drag length scale', aa, 'RSL', 0), &
555 varattr('beta', 'm', f104, 'beta coefficient from Harman 2012', aa, 'RSL', 0), &
556 varattr('zd_RSL', 'm', f104, 'displacement height', aa, 'RSL', 0), &
557 varattr('z0_RSL', 'm', f104, 'roughness length', aa, 'RSL', 0), &
558 varattr('elm', 'm', f104, 'mixing length', aa, 'RSL', 0), &
559 varattr('Scc', '-', f104, 'Schmidt number for temperature and humidity', aa, 'RSL', 0), &
560 varattr('f', 'g kg-1', f104, 'H&F07 and H&F08 constants', aa, 'RSL', 0), &
561 varattr('UStar_RSL', 'm s-1', f104, 'friction velocity used in RSL', aa, 'RSL', 0), &
562 varattr('UStar_heat', 'm s-1', f104, 'friction velocity implied by RA_h', aa, 'RSL', 0), &
563 varattr('TStar_RSL', 'K', f104, 'friction temperature used in RSL', aa, 'RSL', 0), &
564 varattr('FAI', '-', f104, 'frontal area index', aa, 'RSL', 0), &
565 varattr('PAI', '-', f104, 'plan area index', aa, 'RSL', 0), &
566 varattr('flag_RSL', '-', f104, 'flag for RSL', aa, 'RSL', 0) &
567 /
568
569 ! debug info
570 DATA(varlistall(n), &
574 + ncolumnsdataoutrsl - 5 &
575 + 1, &
579 + ncolumnsdataoutrsl - 5 &
581 )/ &
582 varattr('Tsfc_Paved', 'degC', f104, 'surface temperature for paved surface', aa, 'debug', 0), &
583 varattr('Tsfc_Bldgs', 'degC', f104, 'surface temperature for building surface', aa, 'debug', 0), &
584 varattr('Tsfc_EveTr', 'degC', f104, 'surface temperature for evergreen tree surface', aa, 'debug', 0), &
585 varattr('Tsfc_DecTr', 'degC', f104, 'surface temperature for deciduous tree surface', aa, 'debug', 0), &
586 varattr('Tsfc_Grass', 'degC', f104, 'surface temperature for grass surface', aa, 'debug', 0), &
587 varattr('Tsfc_BSoil', 'degC', f104, 'surface temperature for bare soil surface', aa, 'debug', 0), &
588 varattr('Tsfc_Water', 'degC', f104, 'surface temperature for water surface', aa, 'debug', 0), &
589 varattr('QN_Paved', 'W m-2', f104, 'Net all-wave radiation for paved surface', aa, 'debug', 0), &
590 varattr('QN_Bldgs', 'W m-2', f104, 'Net all-wave radiation for building surface', aa, 'debug', 0), &
591 varattr('QN_EveTr', 'W m-2', f104, 'Net all-wave radiation for evergreen tree surface', aa, 'debug', 0), &
592 varattr('QN_DecTr', 'W m-2', f104, 'Net all-wave radiation for deciduous tree surface', aa, 'debug', 0), &
593 varattr('QN_Grass', 'W m-2', f104, 'Net all-wave radiation for grass surface', aa, 'debug', 0), &
594 varattr('QN_BSoil', 'W m-2', f104, 'Net all-wave radiation for bare soil surface', aa, 'debug', 0), &
595 varattr('QN_Water', 'W m-2', f104, 'Net all-wave radiation for water surface', aa, 'debug', 0), &
596 varattr('QS_Paved', 'W m-2', f104, 'Storage heat flux for paved surface', aa, 'debug', 0), &
597 varattr('QS_Bldgs', 'W m-2', f104, 'Storage heat flux for building surface', aa, 'debug', 0), &
598 varattr('QS_EveTr', 'W m-2', f104, 'Storage heat flux for evergreen tree surface', aa, 'debug', 0), &
599 varattr('QS_DecTr', 'W m-2', f104, 'Storage heat flux for deciduous tree surface', aa, 'debug', 0), &
600 varattr('QS_Grass', 'W m-2', f104, 'Storage heat flux for grass surface', aa, 'debug', 0), &
601 varattr('QS_BSoil', 'W m-2', f104, 'Storage heat flux for bare soil surface', aa, 'debug', 0), &
602 varattr('QS_Water', 'W m-2', f104, 'Storage heat flux for water surface', aa, 'debug', 0), &
603 varattr('QE0_Paved', 'W m-2', f104, 'latent heat flux from PM for paved surface', aa, 'debug', 0), &
604 varattr('QE0_Bldgs', 'W m-2', f104, 'latent heat flux from PM for building surface', aa, 'debug', 0), &
605 varattr('QE0_EveTr', 'W m-2', f104, 'latent heat flux from PM for evergreen tree surface', aa, 'debug', 0), &
606 varattr('QE0_DecTr', 'W m-2', f104, 'latent heat flux from PM for deciduous tree surface', aa, 'debug', 0), &
607 varattr('QE0_Grass', 'W m-2', f104, 'latent heat flux from PM for grass surface', aa, 'debug', 0), &
608 varattr('QE0_BSoil', 'W m-2', f104, 'latent heat flux from PM for bare soil surface', aa, 'debug', 0), &
609 varattr('QE0_Water', 'W m-2', f104, 'latent heat flux from PM for water surface', aa, 'debug', 0), &
610 varattr('QE_Paved', 'W m-2', f104, 'latent heat flux for paved surface', aa, 'debug', 0), &
611 varattr('QE_Bldgs', 'W m-2', f104, 'latent heat flux for building surface', aa, 'debug', 0), &
612 varattr('QE_EveTr', 'W m-2', f104, 'latent heat flux for evergreen tree surface', aa, 'debug', 0), &
613 varattr('QE_DecTr', 'W m-2', f104, 'latent heat flux for deciduous tree surface', aa, 'debug', 0), &
614 varattr('QE_Grass', 'W m-2', f104, 'latent heat flux for grass surface', aa, 'debug', 0), &
615 varattr('QE_BSoil', 'W m-2', f104, 'latent heat flux for bare soil surface', aa, 'debug', 0), &
616 varattr('QE_Water', 'W m-2', f104, 'latent heat flux for water surface', aa, 'debug', 0), &
617 varattr('QH_Paved', 'W m-2', f104, 'Sensible heat flux for paved surface', aa, 'debug', 0), &
618 varattr('QH_Bldgs', 'W m-2', f104, 'Sensible heat flux for building surface', aa, 'debug', 0), &
619 varattr('QH_EveTr', 'W m-2', f104, 'Sensible heat flux for evergreen tree surface', aa, 'debug', 0), &
620 varattr('QH_DecTr', 'W m-2', f104, 'Sensible heat flux for deciduous tree surface', aa, 'debug', 0), &
621 varattr('QH_Grass', 'W m-2', f104, 'Sensible heat flux for grass surface', aa, 'debug', 0), &
622 varattr('QH_BSoil', 'W m-2', f104, 'Sensible heat flux for bare soil surface', aa, 'debug', 0), &
623 varattr('QH_Water', 'W m-2', f104, 'Sensible heat flux for water surface', aa, 'debug', 0), &
624 varattr('wu_Paved', 'mm', f104, 'Water use for paved surface', aa, 'debug', 0), &
625 varattr('wu_Bldgs', 'mm', f104, 'Water use for building surface', aa, 'debug', 0), &
626 varattr('wu_EveTr', 'mm', f104, 'Water use for evergreen tree surface', aa, 'debug', 0), &
627 varattr('wu_DecTr', 'mm', f104, 'Water use for deciduous tree surface', aa, 'debug', 0), &
628 varattr('wu_Grass', 'mm', f104, 'Water use for grass surface', aa, 'debug', 0), &
629 varattr('wu_BSoil', 'mm', f104, 'Water use for bare soil surface', aa, 'debug', 0), &
630 varattr('wu_Water', 'mm', f104, 'Water use for water surface', aa, 'debug', 0), &
631 varattr('ev0_Paved', 'mm', f104, 'Evapotranspiration from PM for paved surface', aa, 'debug', 0), &
632 varattr('ev0_Bldgs', 'mm', f104, 'Evapotranspiration from PM for building surface', aa, 'debug', 0), &
633 varattr('ev0_EveTr', 'mm', f104, 'Evapotranspiration from PM for evergreen tree surface', aa, 'debug', 0), &
634 varattr('ev0_DecTr', 'mm', f104, 'Evapotranspiration from PM for deciduous tree surface', aa, 'debug', 0), &
635 varattr('ev0_Grass', 'mm', f104, 'Evapotranspiration from PM for grass surface', aa, 'debug', 0), &
636 varattr('ev0_BSoil', 'mm', f104, 'Evapotranspiration from PM for bare soil surface', aa, 'debug', 0), &
637 varattr('ev0_Water', 'mm', f104, 'Evapotranspiration from PM for water surface', aa, 'debug', 0), &
638 varattr('ev_Paved', 'mm', f104, 'Evapotranspiration from PM for paved surface', aa, 'debug', 0), &
639 varattr('ev_Bldgs', 'mm', f104, 'Evapotranspiration for building surface', aa, 'debug', 0), &
640 varattr('ev_EveTr', 'mm', f104, 'Evapotranspiration for evergreen tree surface', aa, 'debug', 0), &
641 varattr('ev_DecTr', 'mm', f104, 'Evapotranspiration for deciduous tree surface', aa, 'debug', 0), &
642 varattr('ev_Grass', 'mm', f104, 'Evapotranspiration for grass surface', aa, 'debug', 0), &
643 varattr('ev_BSoil', 'mm', f104, 'Evapotranspiration for bare soil surface', aa, 'debug', 0), &
644 varattr('ev_Water', 'mm', f104, 'Evapotranspiration for water surface', aa, 'debug', 0), &
645 varattr('drain_Paved', 'mm', f104, 'Drainage for paved surface', aa, 'debug', 0), &
646 varattr('drain_Bldgs', 'mm', f104, 'Drainage for building surface', aa, 'debug', 0), &
647 varattr('drain_EveTr', 'mm', f104, 'Drainage for evergreen tree surface', aa, 'debug', 0), &
648 varattr('drain_DecTr', 'mm', f104, 'Drainage for deciduous tree surface', aa, 'debug', 0), &
649 varattr('drain_Grass', 'mm', f104, 'Drainage for grass surface', aa, 'debug', 0), &
650 varattr('drain_BSoil', 'mm', f104, 'Drainage for bare soil surface', aa, 'debug', 0), &
651 varattr('drain_Water', 'mm', f104, 'Drainage for water surface', aa, 'debug', 0), &
652 varattr('st_Paved_prev', 'mm', f104, 'surface wetness (prev) for paved surface', aa, 'debug', 0), &
653 varattr('st_Bldgs_prev', 'mm', f104, 'surface wetness (prev) for building surface', aa, 'debug', 0), &
654 varattr('st_EveTr_prev', 'mm', f104, 'surface wetness (prev) for evergreen tree surface', aa, 'debug', 0), &
655 varattr('st_DecTr_prev', 'mm', f104, 'surface wetness (prev) for deciduous tree surface', aa, 'debug', 0), &
656 varattr('st_Grass_prev', 'mm', f104, 'surface wetness (prev) for grass surface', aa, 'debug', 0), &
657 varattr('st_BSoil_prev', 'mm', f104, 'surface wetness (prev) for bare soil surface', aa, 'debug', 0), &
658 varattr('st_Water_prev', 'mm', f104, 'surface wetness (prev) for water surface', aa, 'debug', 0), &
659 varattr('st_Paved_next', 'mm', f104, 'surface wetness (next) for paved surface', aa, 'debug', 0), &
660 varattr('st_Bldgs_next', 'mm', f104, 'surface wetness (next) for building surface', aa, 'debug', 0), &
661 varattr('st_EveTr_next', 'mm', f104, 'surface wetness (next) for evergreen tree surface', aa, 'debug', 0), &
662 varattr('st_DecTr_next', 'mm', f104, 'surface wetness (next) for deciduous tree surface', aa, 'debug', 0), &
663 varattr('st_Grass_next', 'mm', f104, 'surface wetness (next) for grass surface', aa, 'debug', 0), &
664 varattr('st_BSoil_next', 'mm', f104, 'surface wetness (next) for bare soil surface', aa, 'debug', 0), &
665 varattr('st_Water_next', 'mm', f104, 'surface wetness (next) for water surface', aa, 'debug', 0), &
666 varattr('ss_Paved_prev', 'mm', f104, 'soil store (prev) for paved surface', aa, 'debug', 0), &
667 varattr('ss_Bldgs_prev', 'mm', f104, 'soil store (prev) for building surface', aa, 'debug', 0), &
668 varattr('ss_EveTr_prev', 'mm', f104, 'soil store (prev) for evergreen tree surface', aa, 'debug', 0), &
669 varattr('ss_DecTr_prev', 'mm', f104, 'soil store (prev) for deciduous tree surface', aa, 'debug', 0), &
670 varattr('ss_Grass_prev', 'mm', f104, 'soil store (prev) for grass surface', aa, 'debug', 0), &
671 varattr('ss_BSoil_prev', 'mm', f104, 'soil store (prev) for bare soil surface', aa, 'debug', 0), &
672 varattr('ss_Water_prev', 'mm', f104, 'soil store (prev) for water surface', aa, 'debug', 0), &
673 varattr('ss_Paved_next', 'mm', f104, 'soil store (next) for paved surface', aa, 'debug', 0), &
674 varattr('ss_Bldgs_next', 'mm', f104, 'soil store (next) for building surface', aa, 'debug', 0), &
675 varattr('ss_EveTr_next', 'mm', f104, 'soil store (next) for evergreen tree surface', aa, 'debug', 0), &
676 varattr('ss_DecTr_next', 'mm', f104, 'soil store (next) for deciduous tree surface', aa, 'debug', 0), &
677 varattr('ss_Grass_next', 'mm', f104, 'soil store (next) for grass surface', aa, 'debug', 0), &
678 varattr('ss_BSoil_next', 'mm', f104, 'soil store (next) for bare soil surface', aa, 'debug', 0), &
679 varattr('ss_Water_next', 'mm', f104, 'soil store (next) for water surface', aa, 'debug', 0), &
680 varattr('RS', 's m-1', f104, 'RS', aa, 'debug', 0), &
681 varattr('RA', 's m-1', f104, 'RA', aa, 'debug', 0), &
682 varattr('RB', 's m-1', f104, 'RB', aa, 'debug', 0), &
683 varattr('RAsnow', 's m-1', f104, 'RA for snow', aa, 'debug', 0), &
684 varattr('RSS_Paved', 's m-1', f104, 'Wetness-corrected surface conductance for paved surface', aa, 'debug', 0), &
685 varattr('RSS_Bldgs', 's m-1', f104, 'Wetness-corrected surface conductance for building surface', aa, 'debug', 0), &
686 varattr('RSS_EveTr', 's m-1', f104, 'Wetness-corrected surface conductance for evergreen tree surface', aa, 'debug', 0), &
687 varattr('RSS_DecTr', 's m-1', f104, 'Wetness-corrected surface conductance for deciduous tree surface', aa, 'debug', 0), &
688 varattr('RSS_Grass', 's m-1', f104, 'Wetness-corrected surface conductance for grass surface', aa, 'debug', 0), &
689 varattr('RSS_BSoil', 's m-1', f104, 'Wetness-corrected surface conductance for bare soil surface', aa, 'debug', 0), &
690 varattr('RSS_Water', 's m-1', f104, 'Wetness-corrected surface conductance for water surface', aa, 'debug', 0), &
691 varattr('vsmd', 'mm', f104, 'vsmd', aa, 'debug', 0), &
692 varattr('dsp', 'mm', f104, 'dsp', aa, 'debug', 0), &
693 varattr('G_sm', 'mm-1', f104, 'G_sm', aa, 'debug', 0), &
694 varattr('x_exp', '-', f104, 'x_exp', aa, 'debug', 0), &
695 varattr('g_kdown', 'mm s-1', f104, 'gs component: kdown', aa, 'debug', 0), &
696 varattr('g_dq', 'mm s-1', f104, 'gs component: vpd', aa, 'debug', 0), &
697 varattr('g_ta', 'mm s-1', f104, 'gs component: ta', aa, 'debug', 0), &
698 varattr('g_smd', 'mm s-1', f104, 'gs component: smd', aa, 'debug', 0), &
699 varattr('g_lai', 'mm s-1', f104, 'gs component: lai', aa, 'debug', 0), &
700 varattr('vpd_hPa', 'hPa', f104, 'vapour pressure deficit', aa, 'debug', 0), &
701 varattr('lv_J_kg', 'J kg-1', f104, 'latent heat of vaporisation', aa, 'debug', 0), &
702 varattr('avdens', 'kg m-3', f104, 'air density', aa, 'debug', 0), &
703 varattr('avcp', 'm', f104, 'air heat capacity at constant pressure', aa, 'debug', 0), &
704 varattr('s_hPa', 'm', f104, 'Vapour pressure versus temperature slope in PM', aa, 'debug', 0), &
705 varattr('psyc_hPa', 'm', f104, 'Psychometric constant', aa, 'debug', 0), &
706 ! varAttr('qn_av', 'm', f104, 'qn_av', aA, 'debug', 0), &
707 varattr('iter', '-', f104, 'qn_av', as, 'debug', 0), &
708 varattr('FAIBldg_use', '-', f104, 'FAIBldg_use', aa, 'debug', 0), &
709 varattr('FAIEveTree_use', '-', f104, 'FAIEveTree_use', aa, 'debug', 0), &
710 varattr('FAIDecTree_use', '-', f104, 'FAIDecTree_use', aa, 'debug', 0), &
711 varattr('FAI', '-', f104, 'FAI', aa, 'debug', 0), &
712 varattr('dqndt', 'm', f104, 'dqndt', aa, 'debug', 0) &
713 /
714
715 ! SPARTACUS info
716 DATA(varlistall(n), &
720 + ncolumnsdataoutrsl - 5 &
722 + 1, &
726 + ncolumnsdataoutrsl - 5 &
729 )/ &
730 varattr('alb', '-', f104, 'bulk albedo from spartacus', aa, 'SPARTACUS', 0), &
731 varattr('emis', '-', f104, 'bulk emissivity from spartacus', aa, 'SPARTACUS', 0), &
732 varattr('KTopDnDir', 'W m-2', f104, 'sw downwelling direct radiation at top-of-canopy', aa, 'SPARTACUS', 0), &
733 varattr('Kup', 'W m-2', f104, 'bulk albedo from spartacus', aa, 'SPARTACUS', 0), &
734 varattr('LTopDn', 'W m-2', f104, 'lw downwelling radiation at top-of-canopy', aa, 'SPARTACUS', 0), &
735 varattr('Lup', 'W m-2', f104, 'lw upward flux from spartacus', aa, 'SPARTACUS', 0), &
736 varattr('Qn', 'W m-2', f104, 'net all-wave radiation from spartacus', aa, 'SPARTACUS', 0), &
737 varattr('KTopNet', 'W m-2', f104, 'sw net radiation at top-of-canopy', aa, 'SPARTACUS', 0), &
738 varattr('LTopNet', 'W m-2', f104, 'lw net radiation at top-of-canopy', aa, 'SPARTACUS', 0), &
739 varattr('Lemission', 'W m-2', f104, 'lw emission from spartacus', aa, 'SPARTACUS', 0), &
740 varattr('KDnDir_Grnd', 'W m-2', f104, 'sw downwelling direct radiation at ground', aa, 'SPARTACUS', 0), &
741 varattr('KVtlDif_Grnd', 'W m-2', f104, 'sw diffuse flux at ground into a vertical surface', aa, 'SPARTACUS', 0), &
742 varattr('KNet_Grnd', 'W m-2', f104, 'sw net radiation at ground', aa, 'SPARTACUS', 0), &
743 varattr('LNet_Grnd', 'W m-2', f104, 'lw net radiation at ground', aa, 'SPARTACUS', 0), &
744 varattr('KIn_Roof_1', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 1', aa, 'SPARTACUS', 0), &
745 varattr('KIn_Roof_2', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 2', aa, 'SPARTACUS', 0), &
746 varattr('KIn_Roof_3', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 3', aa, 'SPARTACUS', 0), &
747 varattr('KIn_Roof_4', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 4', aa, 'SPARTACUS', 0), &
748 varattr('KIn_Roof_5', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 5', aa, 'SPARTACUS', 0), &
749 varattr('KIn_Roof_6', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 6', aa, 'SPARTACUS', 0), &
750 varattr('KIn_Roof_7', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 7', aa, 'SPARTACUS', 0), &
751 varattr('KIn_Roof_8', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 8', aa, 'SPARTACUS', 0), &
752 varattr('KIn_Roof_9', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 9', aa, 'SPARTACUS', 0), &
753 varattr('KIn_Roof_10', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 10', aa, 'SPARTACUS', 0), &
754 varattr('KIn_Roof_11', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 11', aa, 'SPARTACUS', 0), &
755 varattr('KIn_Roof_12', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 12', aa, 'SPARTACUS', 0), &
756 varattr('KIn_Roof_13', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 13', aa, 'SPARTACUS', 0), &
757 varattr('KIn_Roof_14', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 14', aa, 'SPARTACUS', 0), &
758 varattr('KIn_Roof_15', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 15', aa, 'SPARTACUS', 0), &
759 varattr('KNet_Roof_1', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 1', aa, 'SPARTACUS', 0), &
760 varattr('KNet_Roof_2', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 2', aa, 'SPARTACUS', 0), &
761 varattr('KNet_Roof_3', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 3', aa, 'SPARTACUS', 0), &
762 varattr('KNet_Roof_4', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 4', aa, 'SPARTACUS', 0), &
763 varattr('KNet_Roof_5', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 5', aa, 'SPARTACUS', 0), &
764 varattr('KNet_Roof_6', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 6', aa, 'SPARTACUS', 0), &
765 varattr('KNet_Roof_7', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 7', aa, 'SPARTACUS', 0), &
766 varattr('KNet_Roof_8', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 8', aa, 'SPARTACUS', 0), &
767 varattr('KNet_Roof_9', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 9', aa, 'SPARTACUS', 0), &
768 varattr('KNet_Roof_10', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 10', aa, 'SPARTACUS', 0), &
769 varattr('KNet_Roof_11', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 11', aa, 'SPARTACUS', 0), &
770 varattr('KNet_Roof_12', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 12', aa, 'SPARTACUS', 0), &
771 varattr('KNet_Roof_13', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 13', aa, 'SPARTACUS', 0), &
772 varattr('KNet_Roof_14', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 14', aa, 'SPARTACUS', 0), &
773 varattr('KNet_Roof_15', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 15', aa, 'SPARTACUS', 0), &
774 varattr('KIn_Wall_1', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 1', aa, 'SPARTACUS', 0), &
775 varattr('KIn_Wall_2', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 2', aa, 'SPARTACUS', 0), &
776 varattr('KIn_Wall_3', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 3', aa, 'SPARTACUS', 0), &
777 varattr('KIn_Wall_4', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 4', aa, 'SPARTACUS', 0), &
778 varattr('KIn_Wall_5', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 5', aa, 'SPARTACUS', 0), &
779 varattr('KIn_Wall_6', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 6', aa, 'SPARTACUS', 0), &
780 varattr('KIn_Wall_7', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 7', aa, 'SPARTACUS', 0), &
781 varattr('KIn_Wall_8', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 8', aa, 'SPARTACUS', 0), &
782 varattr('KIn_Wall_9', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 9', aa, 'SPARTACUS', 0), &
783 varattr('KIn_Wall_10', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 10', aa, 'SPARTACUS', 0), &
784 varattr('KIn_Wall_11', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 11', aa, 'SPARTACUS', 0), &
785 varattr('KIn_Wall_12', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 12', aa, 'SPARTACUS', 0), &
786 varattr('KIn_Wall_13', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 13', aa, 'SPARTACUS', 0), &
787 varattr('KIn_Wall_14', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 14', aa, 'SPARTACUS', 0), &
788 varattr('KIn_Wall_15', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 15', aa, 'SPARTACUS', 0), &
789 varattr('KNet_Wall_1', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 1', aa, 'SPARTACUS', 0), &
790 varattr('KNet_Wall_2', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 2', aa, 'SPARTACUS', 0), &
791 varattr('KNet_Wall_3', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 3', aa, 'SPARTACUS', 0), &
792 varattr('KNet_Wall_4', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 4', aa, 'SPARTACUS', 0), &
793 varattr('KNet_Wall_5', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 5', aa, 'SPARTACUS', 0), &
794 varattr('KNet_Wall_6', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 6', aa, 'SPARTACUS', 0), &
795 varattr('KNet_Wall_7', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 7', aa, 'SPARTACUS', 0), &
796 varattr('KNet_Wall_8', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 8', aa, 'SPARTACUS', 0), &
797 varattr('KNet_Wall_9', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 9', aa, 'SPARTACUS', 0), &
798 varattr('KNet_Wall_10', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 10', aa, 'SPARTACUS', 0), &
799 varattr('KNet_Wall_11', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 11', aa, 'SPARTACUS', 0), &
800 varattr('KNet_Wall_12', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 12', aa, 'SPARTACUS', 0), &
801 varattr('KNet_Wall_13', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 13', aa, 'SPARTACUS', 0), &
802 varattr('KNet_Wall_14', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 14', aa, 'SPARTACUS', 0), &
803 varattr('KNet_Wall_15', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 15', aa, 'SPARTACUS', 0), &
804 varattr('KCAAbs_1', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 1', aa, 'SPARTACUS', 0), &
805 varattr('KCAAbs_2', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 2', aa, 'SPARTACUS', 0), &
806 varattr('KCAAbs_3', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 3', aa, 'SPARTACUS', 0), &
807 varattr('KCAAbs_4', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 4', aa, 'SPARTACUS', 0), &
808 varattr('KCAAbs_5', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 5', aa, 'SPARTACUS', 0), &
809 varattr('KCAAbs_6', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 6', aa, 'SPARTACUS', 0), &
810 varattr('KCAAbs_7', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 7', aa, 'SPARTACUS', 0), &
811 varattr('KCAAbs_8', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 8', aa, 'SPARTACUS', 0), &
812 varattr('KCAAbs_9', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 9', aa, 'SPARTACUS', 0), &
813 varattr('KCAAbs_10', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 10', aa, 'SPARTACUS', 0), &
814 varattr('KCAAbs_11', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 11', aa, 'SPARTACUS', 0), &
815 varattr('KCAAbs_12', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 12', aa, 'SPARTACUS', 0), &
816 varattr('KCAAbs_13', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 13', aa, 'SPARTACUS', 0), &
817 varattr('KCAAbs_14', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 14', aa, 'SPARTACUS', 0), &
818 varattr('KCAAbs_15', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 15', aa, 'SPARTACUS', 0), &
819 varattr('LIn_Roof_1', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 1', aa, 'SPARTACUS', 0), &
820 varattr('LIn_Roof_2', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 2', aa, 'SPARTACUS', 0), &
821 varattr('LIn_Roof_3', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 3', aa, 'SPARTACUS', 0), &
822 varattr('LIn_Roof_4', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 4', aa, 'SPARTACUS', 0), &
823 varattr('LIn_Roof_5', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 5', aa, 'SPARTACUS', 0), &
824 varattr('LIn_Roof_6', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 6', aa, 'SPARTACUS', 0), &
825 varattr('LIn_Roof_7', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 7', aa, 'SPARTACUS', 0), &
826 varattr('LIn_Roof_8', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 8', aa, 'SPARTACUS', 0), &
827 varattr('LIn_Roof_9', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 9', aa, 'SPARTACUS', 0), &
828 varattr('LIn_Roof_10', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 10', aa, 'SPARTACUS', 0), &
829 varattr('LIn_Roof_11', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 11', aa, 'SPARTACUS', 0), &
830 varattr('LIn_Roof_12', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 12', aa, 'SPARTACUS', 0), &
831 varattr('LIn_Roof_13', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 13', aa, 'SPARTACUS', 0), &
832 varattr('LIn_Roof_14', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 14', aa, 'SPARTACUS', 0), &
833 varattr('LIn_Roof_15', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 15', aa, 'SPARTACUS', 0), &
834 varattr('LNet_Roof_1', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 1', aa, 'SPARTACUS', 0), &
835 varattr('LNet_Roof_2', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 2', aa, 'SPARTACUS', 0), &
836 varattr('LNet_Roof_3', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 3', aa, 'SPARTACUS', 0), &
837 varattr('LNet_Roof_4', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 4', aa, 'SPARTACUS', 0), &
838 varattr('LNet_Roof_5', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 5', aa, 'SPARTACUS', 0), &
839 varattr('LNet_Roof_6', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 6', aa, 'SPARTACUS', 0), &
840 varattr('LNet_Roof_7', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 7', aa, 'SPARTACUS', 0), &
841 varattr('LNet_Roof_8', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 8', aa, 'SPARTACUS', 0), &
842 varattr('LNet_Roof_9', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 9', aa, 'SPARTACUS', 0), &
843 varattr('LNet_Roof_10', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 10', aa, 'SPARTACUS', 0), &
844 varattr('LNet_Roof_11', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 11', aa, 'SPARTACUS', 0), &
845 varattr('LNet_Roof_12', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 12', aa, 'SPARTACUS', 0), &
846 varattr('LNet_Roof_13', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 13', aa, 'SPARTACUS', 0), &
847 varattr('LNet_Roof_14', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 14', aa, 'SPARTACUS', 0), &
848 varattr('LNet_Roof_15', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 15', aa, 'SPARTACUS', 0), &
849 varattr('LIn_Wall_1', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 1', aa, 'SPARTACUS', 0), &
850 varattr('LIn_Wall_2', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 2', aa, 'SPARTACUS', 0), &
851 varattr('LIn_Wall_3', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 3', aa, 'SPARTACUS', 0), &
852 varattr('LIn_Wall_4', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 4', aa, 'SPARTACUS', 0), &
853 varattr('LIn_Wall_5', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 5', aa, 'SPARTACUS', 0), &
854 varattr('LIn_Wall_6', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 6', aa, 'SPARTACUS', 0), &
855 varattr('LIn_Wall_7', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 7', aa, 'SPARTACUS', 0), &
856 varattr('LIn_Wall_8', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 8', aa, 'SPARTACUS', 0), &
857 varattr('LIn_Wall_9', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 9', aa, 'SPARTACUS', 0), &
858 varattr('LIn_Wall_10', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 10', aa, 'SPARTACUS', 0), &
859 varattr('LIn_Wall_11', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 11', aa, 'SPARTACUS', 0), &
860 varattr('LIn_Wall_12', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 12', aa, 'SPARTACUS', 0), &
861 varattr('LIn_Wall_13', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 13', aa, 'SPARTACUS', 0), &
862 varattr('LIn_Wall_14', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 14', aa, 'SPARTACUS', 0), &
863 varattr('LIn_Wall_15', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 15', aa, 'SPARTACUS', 0), &
864 varattr('LNet_Wall_1', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 1', aa, 'SPARTACUS', 0), &
865 varattr('LNet_Wall_2', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 2', aa, 'SPARTACUS', 0), &
866 varattr('LNet_Wall_3', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 3', aa, 'SPARTACUS', 0), &
867 varattr('LNet_Wall_4', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 4', aa, 'SPARTACUS', 0), &
868 varattr('LNet_Wall_5', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 5', aa, 'SPARTACUS', 0), &
869 varattr('LNet_Wall_6', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 6', aa, 'SPARTACUS', 0), &
870 varattr('LNet_Wall_7', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 7', aa, 'SPARTACUS', 0), &
871 varattr('LNet_Wall_8', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 8', aa, 'SPARTACUS', 0), &
872 varattr('LNet_Wall_9', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 9', aa, 'SPARTACUS', 0), &
873 varattr('LNet_Wall_10', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 10', aa, 'SPARTACUS', 0), &
874 varattr('LNet_Wall_11', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 11', aa, 'SPARTACUS', 0), &
875 varattr('LNet_Wall_12', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 12', aa, 'SPARTACUS', 0), &
876 varattr('LNet_Wall_13', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 13', aa, 'SPARTACUS', 0), &
877 varattr('LNet_Wall_14', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 14', aa, 'SPARTACUS', 0), &
878 varattr('LNet_Wall_15', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 15', aa, 'SPARTACUS', 0), &
879 varattr('sfr_Roof_1', '-', f104, 'surface coverage of roof - SPARTACUS level 1', aa, 'SPARTACUS', 0), &
880 varattr('sfr_Roof_2', '-', f104, 'surface coverage of roof - SPARTACUS level 2', aa, 'SPARTACUS', 0), &
881 varattr('sfr_Roof_3', '-', f104, 'surface coverage of roof - SPARTACUS level 3', aa, 'SPARTACUS', 0), &
882 varattr('sfr_Roof_4', '-', f104, 'surface coverage of roof - SPARTACUS level 4', aa, 'SPARTACUS', 0), &
883 varattr('sfr_Roof_5', '-', f104, 'surface coverage of roof - SPARTACUS level 5', aa, 'SPARTACUS', 0), &
884 varattr('sfr_Roof_6', '-', f104, 'surface coverage of roof - SPARTACUS level 6', aa, 'SPARTACUS', 0), &
885 varattr('sfr_Roof_7', '-', f104, 'surface coverage of roof - SPARTACUS level 7', aa, 'SPARTACUS', 0), &
886 varattr('sfr_Roof_8', '-', f104, 'surface coverage of roof - SPARTACUS level 8', aa, 'SPARTACUS', 0), &
887 varattr('sfr_Roof_9', '-', f104, 'surface coverage of roof - SPARTACUS level 9', aa, 'SPARTACUS', 0), &
888 varattr('sfr_Roof_10', '-', f104, 'surface coverage of roof - SPARTACUS level 10', aa, 'SPARTACUS', 0), &
889 varattr('sfr_Roof_11', '-', f104, 'surface coverage of roof - SPARTACUS level 11', aa, 'SPARTACUS', 0), &
890 varattr('sfr_Roof_12', '-', f104, 'surface coverage of roof - SPARTACUS level 12', aa, 'SPARTACUS', 0), &
891 varattr('sfr_Roof_13', '-', f104, 'surface coverage of roof - SPARTACUS level 13', aa, 'SPARTACUS', 0), &
892 varattr('sfr_Roof_14', '-', f104, 'surface coverage of roof - SPARTACUS level 14', aa, 'SPARTACUS', 0), &
893 varattr('sfr_Roof_15', '-', f104, 'surface coverage of roof - SPARTACUS level 15', aa, 'SPARTACUS', 0), &
894 varattr('sfr_Wall_1', '-', f104, 'surface coverage of wall - SPARTACUS level 1', aa, 'SPARTACUS', 0), &
895 varattr('sfr_Wall_2', '-', f104, 'surface coverage of wall - SPARTACUS level 2', aa, 'SPARTACUS', 0), &
896 varattr('sfr_Wall_3', '-', f104, 'surface coverage of wall - SPARTACUS level 3', aa, 'SPARTACUS', 0), &
897 varattr('sfr_Wall_4', '-', f104, 'surface coverage of wall - SPARTACUS level 4', aa, 'SPARTACUS', 0), &
898 varattr('sfr_Wall_5', '-', f104, 'surface coverage of wall - SPARTACUS level 5', aa, 'SPARTACUS', 0), &
899 varattr('sfr_Wall_6', '-', f104, 'surface coverage of wall - SPARTACUS level 6', aa, 'SPARTACUS', 0), &
900 varattr('sfr_Wall_7', '-', f104, 'surface coverage of wall - SPARTACUS level 7', aa, 'SPARTACUS', 0), &
901 varattr('sfr_Wall_8', '-', f104, 'surface coverage of wall - SPARTACUS level 8', aa, 'SPARTACUS', 0), &
902 varattr('sfr_Wall_9', '-', f104, 'surface coverage of wall - SPARTACUS level 9', aa, 'SPARTACUS', 0), &
903 varattr('sfr_Wall_10', '-', f104, 'surface coverage of wall - SPARTACUS level 10', aa, 'SPARTACUS', 0), &
904 varattr('sfr_Wall_11', '-', f104, 'surface coverage of wall - SPARTACUS level 11', aa, 'SPARTACUS', 0), &
905 varattr('sfr_Wall_12', '-', f104, 'surface coverage of wall - SPARTACUS level 12', aa, 'SPARTACUS', 0), &
906 varattr('sfr_Wall_13', '-', f104, 'surface coverage of wall - SPARTACUS level 13', aa, 'SPARTACUS', 0), &
907 varattr('sfr_Wall_14', '-', f104, 'surface coverage of wall - SPARTACUS level 14', aa, 'SPARTACUS', 0), &
908 varattr('sfr_Wall_15', '-', f104, 'surface coverage of wall - SPARTACUS level 15', aa, 'SPARTACUS', 0), &
909 varattr('LCAAbs_1', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 1', aa, 'SPARTACUS', 0), &
910 varattr('LCAAbs_2', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 2', aa, 'SPARTACUS', 0), &
911 varattr('LCAAbs_3', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 3', aa, 'SPARTACUS', 0), &
912 varattr('LCAAbs_4', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 4', aa, 'SPARTACUS', 0), &
913 varattr('LCAAbs_5', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 5', aa, 'SPARTACUS', 0), &
914 varattr('LCAAbs_6', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 6', aa, 'SPARTACUS', 0), &
915 varattr('LCAAbs_7', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 7', aa, 'SPARTACUS', 0), &
916 varattr('LCAAbs_8', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 8', aa, 'SPARTACUS', 0), &
917 varattr('LCAAbs_9', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 9', aa, 'SPARTACUS', 0), &
918 varattr('LCAAbs_10', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 10', aa, 'SPARTACUS', 0), &
919 varattr('LCAAbs_11', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 11', aa, 'SPARTACUS', 0), &
920 varattr('LCAAbs_12', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 12', aa, 'SPARTACUS', 0), &
921 varattr('LCAAbs_13', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 13', aa, 'SPARTACUS', 0), &
922 varattr('LCAAbs_14', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 14', aa, 'SPARTACUS', 0), &
923 varattr('LCAAbs_15', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 15', aa, 'SPARTACUS', 0) &
924 /
925 ! ESTM_ext info
926 DATA(varlistall(n), &
928 + ncolumnsdataoutbl - 5 &
929 + ncolumnsdataoutsnow - 5 &
930 + ncolumnsdataoutestm - 5 &
932 + ncolumnsdataoutrsl - 5 &
935 + 1, &
939 + ncolumnsdataoutrsl - 5 &
942 + ncolumnsdataoutehc - 5 &
943 )/ &
944 varattr('Ts_Paved', 'degC', f104, 'surface temperature of paved surface', aa, 'EHC', 0), &
945 varattr('Ts_Bldgs', 'degC', f104, 'surface temperature of building surface', aa, 'EHC', 0), &
946 varattr('Ts_EveTr', 'degC', f104, 'surface temperature of evergreen tree surface', aa, 'EHC', 0), &
947 varattr('Ts_DecTr', 'degC', f104, 'surface temperature of deciduous tree surface', aa, 'EHC', 0), &
948 varattr('Ts_Grass', 'degC', f104, 'surface temperature of grass surface', aa, 'EHC', 0), &
949 varattr('Ts_BSoil', 'degC', f104, 'surface temperature of bare soil surface', aa, 'EHC', 0), &
950 varattr('Ts_Water', 'degC', f104, 'surface temperature of water surface', aa, 'EHC', 0), &
951 varattr('QS_Paved', 'W m-2', f104, 'storage heat flux of paved surface', aa, 'EHC', 0), &
952 varattr('QS_Bldgs', 'W m-2', f104, 'storage heat flux of building surface', aa, 'EHC', 0), &
953 varattr('QS_EveTr', 'W m-2', f104, 'storage heat flux of evergreen tree surface', aa, 'EHC', 0), &
954 varattr('QS_DecTr', 'W m-2', f104, 'storage heat flux of deciduous tree surface', aa, 'EHC', 0), &
955 varattr('QS_Grass', 'W m-2', f104, 'storage heat flux of grass surface', aa, 'EHC', 0), &
956 varattr('QS_BSoil', 'W m-2', f104, 'storage heat flux of bare soil surface', aa, 'EHC', 0), &
957 varattr('QS_Water', 'W m-2', f104, 'storage heat flux of water surface', aa, 'EHC', 0), &
958 varattr('Ts_Roof_1', 'degC', f104, 'surface temperature of roof level 1', aa, 'EHC', 0), &
959 varattr('Ts_Roof_2', 'degC', f104, 'surface temperature of roof level 2', aa, 'EHC', 0), &
960 varattr('Ts_Roof_3', 'degC', f104, 'surface temperature of roof level 3', aa, 'EHC', 0), &
961 varattr('Ts_Roof_4', 'degC', f104, 'surface temperature of roof level 4', aa, 'EHC', 0), &
962 varattr('Ts_Roof_5', 'degC', f104, 'surface temperature of roof level 5', aa, 'EHC', 0), &
963 varattr('Ts_Roof_6', 'degC', f104, 'surface temperature of roof level 6', aa, 'EHC', 0), &
964 varattr('Ts_Roof_7', 'degC', f104, 'surface temperature of roof level 7', aa, 'EHC', 0), &
965 varattr('Ts_Roof_8', 'degC', f104, 'surface temperature of roof level 8', aa, 'EHC', 0), &
966 varattr('Ts_Roof_9', 'degC', f104, 'surface temperature of roof level 9', aa, 'EHC', 0), &
967 varattr('Ts_Roof_10', 'degC', f104, 'surface temperature of roof level 10', aa, 'EHC', 0), &
968 varattr('Ts_Roof_11', 'degC', f104, 'surface temperature of roof level 11', aa, 'EHC', 0), &
969 varattr('Ts_Roof_12', 'degC', f104, 'surface temperature of roof level 12', aa, 'EHC', 0), &
970 varattr('Ts_Roof_13', 'degC', f104, 'surface temperature of roof level 13', aa, 'EHC', 0), &
971 varattr('Ts_Roof_14', 'degC', f104, 'surface temperature of roof level 14', aa, 'EHC', 0), &
972 varattr('Ts_Roof_15', 'degC', f104, 'surface temperature of roof level 15', aa, 'EHC', 0), &
973 varattr('Qn_Roof_1', 'degC', f104, 'net all-wave radiation of roof level 1', aa, 'EHC', 0), &
974 varattr('Qn_Roof_2', 'degC', f104, 'net all-wave radiation of roof level 2', aa, 'EHC', 0), &
975 varattr('Qn_Roof_3', 'degC', f104, 'net all-wave radiation of roof level 3', aa, 'EHC', 0), &
976 varattr('Qn_Roof_4', 'degC', f104, 'net all-wave radiation of roof level 4', aa, 'EHC', 0), &
977 varattr('Qn_Roof_5', 'degC', f104, 'net all-wave radiation of roof level 5', aa, 'EHC', 0), &
978 varattr('Qn_Roof_6', 'degC', f104, 'net all-wave radiation of roof level 6', aa, 'EHC', 0), &
979 varattr('Qn_Roof_7', 'degC', f104, 'net all-wave radiation of roof level 7', aa, 'EHC', 0), &
980 varattr('Qn_Roof_8', 'degC', f104, 'net all-wave radiation of roof level 8', aa, 'EHC', 0), &
981 varattr('Qn_Roof_9', 'degC', f104, 'net all-wave radiation of roof level 9', aa, 'EHC', 0), &
982 varattr('Qn_Roof_10', 'degC', f104, 'net all-wave radiation of roof level 10', aa, 'EHC', 0), &
983 varattr('Qn_Roof_11', 'degC', f104, 'net all-wave radiation of roof level 11', aa, 'EHC', 0), &
984 varattr('Qn_Roof_12', 'degC', f104, 'net all-wave radiation of roof level 12', aa, 'EHC', 0), &
985 varattr('Qn_Roof_13', 'degC', f104, 'net all-wave radiation of roof level 13', aa, 'EHC', 0), &
986 varattr('Qn_Roof_14', 'degC', f104, 'net all-wave radiation of roof level 14', aa, 'EHC', 0), &
987 varattr('Qn_Roof_15', 'degC', f104, 'net all-wave radiation of roof level 15', aa, 'EHC', 0), &
988 varattr('QS_Roof_1', 'degC', f104, 'storage heat flux of roof level 1', aa, 'EHC', 0), &
989 varattr('QS_Roof_2', 'degC', f104, 'storage heat flux of roof level 2', aa, 'EHC', 0), &
990 varattr('QS_Roof_3', 'degC', f104, 'storage heat flux of roof level 3', aa, 'EHC', 0), &
991 varattr('QS_Roof_4', 'degC', f104, 'storage heat flux of roof level 4', aa, 'EHC', 0), &
992 varattr('QS_Roof_5', 'degC', f104, 'storage heat flux of roof level 5', aa, 'EHC', 0), &
993 varattr('QS_Roof_6', 'degC', f104, 'storage heat flux of roof level 6', aa, 'EHC', 0), &
994 varattr('QS_Roof_7', 'degC', f104, 'storage heat flux of roof level 7', aa, 'EHC', 0), &
995 varattr('QS_Roof_8', 'degC', f104, 'storage heat flux of roof level 8', aa, 'EHC', 0), &
996 varattr('QS_Roof_9', 'degC', f104, 'storage heat flux of roof level 9', aa, 'EHC', 0), &
997 varattr('QS_Roof_10', 'degC', f104, 'storage heat flux of roof level 10', aa, 'EHC', 0), &
998 varattr('QS_Roof_11', 'degC', f104, 'storage heat flux of roof level 11', aa, 'EHC', 0), &
999 varattr('QS_Roof_12', 'degC', f104, 'storage heat flux of roof level 12', aa, 'EHC', 0), &
1000 varattr('QS_Roof_13', 'degC', f104, 'storage heat flux of roof level 13', aa, 'EHC', 0), &
1001 varattr('QS_Roof_14', 'degC', f104, 'storage heat flux of roof level 14', aa, 'EHC', 0), &
1002 varattr('QS_Roof_15', 'degC', f104, 'storage heat flux of roof level 15', aa, 'EHC', 0), &
1003 varattr('QE_Roof_1', 'degC', f104, 'latent heat flux of roof level 1', aa, 'EHC', 0), &
1004 varattr('QE_Roof_2', 'degC', f104, 'latent heat flux of roof level 2', aa, 'EHC', 0), &
1005 varattr('QE_Roof_3', 'degC', f104, 'latent heat flux of roof level 3', aa, 'EHC', 0), &
1006 varattr('QE_Roof_4', 'degC', f104, 'latent heat flux of roof level 4', aa, 'EHC', 0), &
1007 varattr('QE_Roof_5', 'degC', f104, 'latent heat flux of roof level 5', aa, 'EHC', 0), &
1008 varattr('QE_Roof_6', 'degC', f104, 'latent heat flux of roof level 6', aa, 'EHC', 0), &
1009 varattr('QE_Roof_7', 'degC', f104, 'latent heat flux of roof level 7', aa, 'EHC', 0), &
1010 varattr('QE_Roof_8', 'degC', f104, 'latent heat flux of roof level 8', aa, 'EHC', 0), &
1011 varattr('QE_Roof_9', 'degC', f104, 'latent heat flux of roof level 9', aa, 'EHC', 0), &
1012 varattr('QE_Roof_10', 'degC', f104, 'latent heat flux of roof level 10', aa, 'EHC', 0), &
1013 varattr('QE_Roof_11', 'degC', f104, 'latent heat flux of roof level 11', aa, 'EHC', 0), &
1014 varattr('QE_Roof_12', 'degC', f104, 'latent heat flux of roof level 12', aa, 'EHC', 0), &
1015 varattr('QE_Roof_13', 'degC', f104, 'latent heat flux of roof level 13', aa, 'EHC', 0), &
1016 varattr('QE_Roof_14', 'degC', f104, 'latent heat flux of roof level 14', aa, 'EHC', 0), &
1017 varattr('QE_Roof_15', 'degC', f104, 'latent heat flux of roof level 15', aa, 'EHC', 0), &
1018 varattr('QH_Roof_1', 'degC', f104, 'sensible heat flux of roof level 1', aa, 'EHC', 0), &
1019 varattr('QH_Roof_2', 'degC', f104, 'sensible heat flux of roof level 2', aa, 'EHC', 0), &
1020 varattr('QH_Roof_3', 'degC', f104, 'sensible heat flux of roof level 3', aa, 'EHC', 0), &
1021 varattr('QH_Roof_4', 'degC', f104, 'sensible heat flux of roof level 4', aa, 'EHC', 0), &
1022 varattr('QH_Roof_5', 'degC', f104, 'sensible heat flux of roof level 5', aa, 'EHC', 0), &
1023 varattr('QH_Roof_6', 'degC', f104, 'sensible heat flux of roof level 6', aa, 'EHC', 0), &
1024 varattr('QH_Roof_7', 'degC', f104, 'sensible heat flux of roof level 7', aa, 'EHC', 0), &
1025 varattr('QH_Roof_8', 'degC', f104, 'sensible heat flux of roof level 8', aa, 'EHC', 0), &
1026 varattr('QH_Roof_9', 'degC', f104, 'sensible heat flux of roof level 9', aa, 'EHC', 0), &
1027 varattr('QH_Roof_10', 'degC', f104, 'sensible heat flux of roof level 10', aa, 'EHC', 0), &
1028 varattr('QH_Roof_11', 'degC', f104, 'sensible heat flux of roof level 11', aa, 'EHC', 0), &
1029 varattr('QH_Roof_12', 'degC', f104, 'sensible heat flux of roof level 12', aa, 'EHC', 0), &
1030 varattr('QH_Roof_13', 'degC', f104, 'sensible heat flux of roof level 13', aa, 'EHC', 0), &
1031 varattr('QH_Roof_14', 'degC', f104, 'sensible heat flux of roof level 14', aa, 'EHC', 0), &
1032 varattr('QH_Roof_15', 'degC', f104, 'sensible heat flux of roof level 15', aa, 'EHC', 0), &
1033 varattr('St_Roof_1', 'mm', f104, 'surface state of roof level 1', aa, 'EHC', 0), &
1034 varattr('St_Roof_2', 'mm', f104, 'surface state of roof level 2', aa, 'EHC', 0), &
1035 varattr('St_Roof_3', 'mm', f104, 'surface state of roof level 3', aa, 'EHC', 0), &
1036 varattr('St_Roof_4', 'mm', f104, 'surface state of roof level 4', aa, 'EHC', 0), &
1037 varattr('St_Roof_5', 'mm', f104, 'surface state of roof level 5', aa, 'EHC', 0), &
1038 varattr('St_Roof_6', 'mm', f104, 'surface state of roof level 6', aa, 'EHC', 0), &
1039 varattr('St_Roof_7', 'mm', f104, 'surface state of roof level 7', aa, 'EHC', 0), &
1040 varattr('St_Roof_8', 'mm', f104, 'surface state of roof level 8', aa, 'EHC', 0), &
1041 varattr('St_Roof_9', 'mm', f104, 'surface state of roof level 9', aa, 'EHC', 0), &
1042 varattr('St_Roof_10', 'mm', f104, 'surface state of roof level 10', aa, 'EHC', 0), &
1043 varattr('St_Roof_11', 'mm', f104, 'surface state of roof level 11', aa, 'EHC', 0), &
1044 varattr('St_Roof_12', 'mm', f104, 'surface state of roof level 12', aa, 'EHC', 0), &
1045 varattr('St_Roof_13', 'mm', f104, 'surface state of roof level 13', aa, 'EHC', 0), &
1046 varattr('St_Roof_14', 'mm', f104, 'surface state of roof level 14', aa, 'EHC', 0), &
1047 varattr('St_Roof_15', 'mm', f104, 'surface state of roof level 15', aa, 'EHC', 0), &
1048 varattr('SS_Roof_1', 'mm', f104, 'soil store of roof level 1', aa, 'EHC', 0), &
1049 varattr('SS_Roof_2', 'mm', f104, 'soil store of roof level 2', aa, 'EHC', 0), &
1050 varattr('SS_Roof_3', 'mm', f104, 'soil store of roof level 3', aa, 'EHC', 0), &
1051 varattr('SS_Roof_4', 'mm', f104, 'soil store of roof level 4', aa, 'EHC', 0), &
1052 varattr('SS_Roof_5', 'mm', f104, 'soil store of roof level 5', aa, 'EHC', 0), &
1053 varattr('SS_Roof_6', 'mm', f104, 'soil store of roof level 6', aa, 'EHC', 0), &
1054 varattr('SS_Roof_7', 'mm', f104, 'soil store of roof level 7', aa, 'EHC', 0), &
1055 varattr('SS_Roof_8', 'mm', f104, 'soil store of roof level 8', aa, 'EHC', 0), &
1056 varattr('SS_Roof_9', 'mm', f104, 'soil store of roof level 9', aa, 'EHC', 0), &
1057 varattr('SS_Roof_10', 'mm', f104, 'soil store of roof level 10', aa, 'EHC', 0), &
1058 varattr('SS_Roof_11', 'mm', f104, 'soil store of roof level 11', aa, 'EHC', 0), &
1059 varattr('SS_Roof_12', 'mm', f104, 'soil store of roof level 12', aa, 'EHC', 0), &
1060 varattr('SS_Roof_13', 'mm', f104, 'soil store of roof level 13', aa, 'EHC', 0), &
1061 varattr('SS_Roof_14', 'mm', f104, 'soil store of roof level 14', aa, 'EHC', 0), &
1062 varattr('SS_Roof_15', 'mm', f104, 'soil store of roof level 15', aa, 'EHC', 0), &
1063 varattr('Ts_Wall_1', 'degC', f104, 'surface temperature of wall level 1', aa, 'EHC', 0), &
1064 varattr('Ts_Wall_2', 'degC', f104, 'surface temperature of wall level 2', aa, 'EHC', 0), &
1065 varattr('Ts_Wall_3', 'degC', f104, 'surface temperature of wall level 3', aa, 'EHC', 0), &
1066 varattr('Ts_Wall_4', 'degC', f104, 'surface temperature of wall level 4', aa, 'EHC', 0), &
1067 varattr('Ts_Wall_5', 'degC', f104, 'surface temperature of wall level 5', aa, 'EHC', 0), &
1068 varattr('Ts_Wall_6', 'degC', f104, 'surface temperature of wall level 6', aa, 'EHC', 0), &
1069 varattr('Ts_Wall_7', 'degC', f104, 'surface temperature of wall level 7', aa, 'EHC', 0), &
1070 varattr('Ts_Wall_8', 'degC', f104, 'surface temperature of wall level 8', aa, 'EHC', 0), &
1071 varattr('Ts_Wall_9', 'degC', f104, 'surface temperature of wall level 9', aa, 'EHC', 0), &
1072 varattr('Ts_Wall_10', 'degC', f104, 'surface temperature of wall level 10', aa, 'EHC', 0), &
1073 varattr('Ts_Wall_11', 'degC', f104, 'surface temperature of wall level 11', aa, 'EHC', 0), &
1074 varattr('Ts_Wall_12', 'degC', f104, 'surface temperature of wall level 12', aa, 'EHC', 0), &
1075 varattr('Ts_Wall_13', 'degC', f104, 'surface temperature of wall level 13', aa, 'EHC', 0), &
1076 varattr('Ts_Wall_14', 'degC', f104, 'surface temperature of wall level 14', aa, 'EHC', 0), &
1077 varattr('Ts_Wall_15', 'degC', f104, 'surface temperature of wall level 15', aa, 'EHC', 0), &
1078 varattr('Qn_Wall_1', 'degC', f104, 'net all-wave radiation of wall level 1', aa, 'EHC', 0), &
1079 varattr('Qn_Wall_2', 'degC', f104, 'net all-wave radiation of wall level 2', aa, 'EHC', 0), &
1080 varattr('Qn_Wall_3', 'degC', f104, 'net all-wave radiation of wall level 3', aa, 'EHC', 0), &
1081 varattr('Qn_Wall_4', 'degC', f104, 'net all-wave radiation of wall level 4', aa, 'EHC', 0), &
1082 varattr('Qn_Wall_5', 'degC', f104, 'net all-wave radiation of wall level 5', aa, 'EHC', 0), &
1083 varattr('Qn_Wall_6', 'degC', f104, 'net all-wave radiation of wall level 6', aa, 'EHC', 0), &
1084 varattr('Qn_Wall_7', 'degC', f104, 'net all-wave radiation of wall level 7', aa, 'EHC', 0), &
1085 varattr('Qn_Wall_8', 'degC', f104, 'net all-wave radiation of wall level 8', aa, 'EHC', 0), &
1086 varattr('Qn_Wall_9', 'degC', f104, 'net all-wave radiation of wall level 9', aa, 'EHC', 0), &
1087 varattr('Qn_Wall_10', 'degC', f104, 'net all-wave radiation of wall level 10', aa, 'EHC', 0), &
1088 varattr('Qn_Wall_11', 'degC', f104, 'net all-wave radiation of wall level 11', aa, 'EHC', 0), &
1089 varattr('Qn_Wall_12', 'degC', f104, 'net all-wave radiation of wall level 12', aa, 'EHC', 0), &
1090 varattr('Qn_Wall_13', 'degC', f104, 'net all-wave radiation of wall level 13', aa, 'EHC', 0), &
1091 varattr('Qn_Wall_14', 'degC', f104, 'net all-wave radiation of wall level 14', aa, 'EHC', 0), &
1092 varattr('Qn_Wall_15', 'degC', f104, 'net all-wave radiation of wall level 15', aa, 'EHC', 0), &
1093 varattr('QS_Wall_1', 'degC', f104, 'storage heat flux of wall level 1', aa, 'EHC', 0), &
1094 varattr('QS_Wall_2', 'degC', f104, 'storage heat flux of wall level 2', aa, 'EHC', 0), &
1095 varattr('QS_Wall_3', 'degC', f104, 'storage heat flux of wall level 3', aa, 'EHC', 0), &
1096 varattr('QS_Wall_4', 'degC', f104, 'storage heat flux of wall level 4', aa, 'EHC', 0), &
1097 varattr('QS_Wall_5', 'degC', f104, 'storage heat flux of wall level 5', aa, 'EHC', 0), &
1098 varattr('QS_Wall_6', 'degC', f104, 'storage heat flux of wall level 6', aa, 'EHC', 0), &
1099 varattr('QS_Wall_7', 'degC', f104, 'storage heat flux of wall level 7', aa, 'EHC', 0), &
1100 varattr('QS_Wall_8', 'degC', f104, 'storage heat flux of wall level 8', aa, 'EHC', 0), &
1101 varattr('QS_Wall_9', 'degC', f104, 'storage heat flux of wall level 9', aa, 'EHC', 0), &
1102 varattr('QS_Wall_10', 'degC', f104, 'storage heat flux of wall level 10', aa, 'EHC', 0), &
1103 varattr('QS_Wall_11', 'degC', f104, 'storage heat flux of wall level 11', aa, 'EHC', 0), &
1104 varattr('QS_Wall_12', 'degC', f104, 'storage heat flux of wall level 12', aa, 'EHC', 0), &
1105 varattr('QS_Wall_13', 'degC', f104, 'storage heat flux of wall level 13', aa, 'EHC', 0), &
1106 varattr('QS_Wall_14', 'degC', f104, 'storage heat flux of wall level 14', aa, 'EHC', 0), &
1107 varattr('QS_Wall_15', 'degC', f104, 'storage heat flux of wall level 15', aa, 'EHC', 0), &
1108 varattr('QE_Wall_1', 'degC', f104, 'latent heat flux of wall level 1', aa, 'EHC', 0), &
1109 varattr('QE_Wall_2', 'degC', f104, 'latent heat flux of wall level 2', aa, 'EHC', 0), &
1110 varattr('QE_Wall_3', 'degC', f104, 'latent heat flux of wall level 3', aa, 'EHC', 0), &
1111 varattr('QE_Wall_4', 'degC', f104, 'latent heat flux of wall level 4', aa, 'EHC', 0), &
1112 varattr('QE_Wall_5', 'degC', f104, 'latent heat flux of wall level 5', aa, 'EHC', 0), &
1113 varattr('QE_Wall_6', 'degC', f104, 'latent heat flux of wall level 6', aa, 'EHC', 0), &
1114 varattr('QE_Wall_7', 'degC', f104, 'latent heat flux of wall level 7', aa, 'EHC', 0), &
1115 varattr('QE_Wall_8', 'degC', f104, 'latent heat flux of wall level 8', aa, 'EHC', 0), &
1116 varattr('QE_Wall_9', 'degC', f104, 'latent heat flux of wall level 9', aa, 'EHC', 0), &
1117 varattr('QE_Wall_10', 'degC', f104, 'latent heat flux of wall level 10', aa, 'EHC', 0), &
1118 varattr('QE_Wall_11', 'degC', f104, 'latent heat flux of wall level 11', aa, 'EHC', 0), &
1119 varattr('QE_Wall_12', 'degC', f104, 'latent heat flux of wall level 12', aa, 'EHC', 0), &
1120 varattr('QE_Wall_13', 'degC', f104, 'latent heat flux of wall level 13', aa, 'EHC', 0), &
1121 varattr('QE_Wall_14', 'degC', f104, 'latent heat flux of wall level 14', aa, 'EHC', 0), &
1122 varattr('QE_Wall_15', 'degC', f104, 'latent heat flux of wall level 15', aa, 'EHC', 0), &
1123 varattr('QH_Wall_1', 'degC', f104, 'sensible heat flux of wall level 1', aa, 'EHC', 0), &
1124 varattr('QH_Wall_2', 'degC', f104, 'sensible heat flux of wall level 2', aa, 'EHC', 0), &
1125 varattr('QH_Wall_3', 'degC', f104, 'sensible heat flux of wall level 3', aa, 'EHC', 0), &
1126 varattr('QH_Wall_4', 'degC', f104, 'sensible heat flux of wall level 4', aa, 'EHC', 0), &
1127 varattr('QH_Wall_5', 'degC', f104, 'sensible heat flux of wall level 5', aa, 'EHC', 0), &
1128 varattr('QH_Wall_6', 'degC', f104, 'sensible heat flux of wall level 6', aa, 'EHC', 0), &
1129 varattr('QH_Wall_7', 'degC', f104, 'sensible heat flux of wall level 7', aa, 'EHC', 0), &
1130 varattr('QH_Wall_8', 'degC', f104, 'sensible heat flux of wall level 8', aa, 'EHC', 0), &
1131 varattr('QH_Wall_9', 'degC', f104, 'sensible heat flux of wall level 9', aa, 'EHC', 0), &
1132 varattr('QH_Wall_10', 'degC', f104, 'sensible heat flux of wall level 10', aa, 'EHC', 0), &
1133 varattr('QH_Wall_11', 'degC', f104, 'sensible heat flux of wall level 11', aa, 'EHC', 0), &
1134 varattr('QH_Wall_12', 'degC', f104, 'sensible heat flux of wall level 12', aa, 'EHC', 0), &
1135 varattr('QH_Wall_13', 'degC', f104, 'sensible heat flux of wall level 13', aa, 'EHC', 0), &
1136 varattr('QH_Wall_14', 'degC', f104, 'sensible heat flux of wall level 14', aa, 'EHC', 0), &
1137 varattr('QH_Wall_15', 'degC', f104, 'sensible heat flux of wall level 15', aa, 'EHC', 0), &
1138 varattr('St_Wall_1', 'mm', f104, 'surface state of wall level 1', aa, 'EHC', 0), &
1139 varattr('St_Wall_2', 'mm', f104, 'surface state of wall level 2', aa, 'EHC', 0), &
1140 varattr('St_Wall_3', 'mm', f104, 'surface state of wall level 3', aa, 'EHC', 0), &
1141 varattr('St_Wall_4', 'mm', f104, 'surface state of wall level 4', aa, 'EHC', 0), &
1142 varattr('St_Wall_5', 'mm', f104, 'surface state of wall level 5', aa, 'EHC', 0), &
1143 varattr('St_Wall_6', 'mm', f104, 'surface state of wall level 6', aa, 'EHC', 0), &
1144 varattr('St_Wall_7', 'mm', f104, 'surface state of wall level 7', aa, 'EHC', 0), &
1145 varattr('St_Wall_8', 'mm', f104, 'surface state of wall level 8', aa, 'EHC', 0), &
1146 varattr('St_Wall_9', 'mm', f104, 'surface state of wall level 9', aa, 'EHC', 0), &
1147 varattr('St_Wall_10', 'mm', f104, 'surface state of wall level 10', aa, 'EHC', 0), &
1148 varattr('St_Wall_11', 'mm', f104, 'surface state of wall level 11', aa, 'EHC', 0), &
1149 varattr('St_Wall_12', 'mm', f104, 'surface state of wall level 12', aa, 'EHC', 0), &
1150 varattr('St_Wall_13', 'mm', f104, 'surface state of wall level 13', aa, 'EHC', 0), &
1151 varattr('St_Wall_14', 'mm', f104, 'surface state of wall level 14', aa, 'EHC', 0), &
1152 varattr('St_Wall_15', 'mm', f104, 'surface state of wall level 15', aa, 'EHC', 0), &
1153 varattr('SS_Wall_1', 'mm', f104, 'soil store of wall level 1', aa, 'EHC', 0), &
1154 varattr('SS_Wall_2', 'mm', f104, 'soil store of wall level 2', aa, 'EHC', 0), &
1155 varattr('SS_Wall_3', 'mm', f104, 'soil store of wall level 3', aa, 'EHC', 0), &
1156 varattr('SS_Wall_4', 'mm', f104, 'soil store of wall level 4', aa, 'EHC', 0), &
1157 varattr('SS_Wall_5', 'mm', f104, 'soil store of wall level 5', aa, 'EHC', 0), &
1158 varattr('SS_Wall_6', 'mm', f104, 'soil store of wall level 6', aa, 'EHC', 0), &
1159 varattr('SS_Wall_7', 'mm', f104, 'soil store of wall level 7', aa, 'EHC', 0), &
1160 varattr('SS_Wall_8', 'mm', f104, 'soil store of wall level 8', aa, 'EHC', 0), &
1161 varattr('SS_Wall_9', 'mm', f104, 'soil store of wall level 9', aa, 'EHC', 0), &
1162 varattr('SS_Wall_10', 'mm', f104, 'soil store of wall level 10', aa, 'EHC', 0), &
1163 varattr('SS_Wall_11', 'mm', f104, 'soil store of wall level 11', aa, 'EHC', 0), &
1164 varattr('SS_Wall_12', 'mm', f104, 'soil store of wall level 12', aa, 'EHC', 0), &
1165 varattr('SS_Wall_13', 'mm', f104, 'soil store of wall level 13', aa, 'EHC', 0), &
1166 varattr('SS_Wall_14', 'mm', f104, 'soil store of wall level 14', aa, 'EHC', 0), &
1167 varattr('SS_Wall_15', 'mm', f104, 'soil store of wall level 15', aa, 'EHC', 0) &
1168 /
1169
1170CONTAINS
1171 ! main wrapper that handles both txt and nc files
1172 SUBROUTINE suews_output(irMax, iv, Gridiv, iyr)
1173 IMPLICIT NONE
1174 INTEGER, INTENT(in) :: irMax
1175! #ifdef nc
1176! INTEGER, INTENT(in), OPTIONAL ::iv, Gridiv, iyr
1177! #else
1178 INTEGER, INTENT(in) :: iv, Gridiv, iyr
1179! #endif
1180
1181 INTEGER :: n_group_use, err, outLevel, i
1182 TYPE(varattr), DIMENSION(:), ALLOCATABLE :: varListX
1183 CHARACTER(len=10) :: groupList0(10)
1184 CHARACTER(len=10), DIMENSION(:), ALLOCATABLE :: grpList
1185 LOGICAL :: groupCond(10)
1186
1187 ! determine outLevel
1188 SELECT CASE (writeoutoption)
1189 CASE (0) !all (not snow-related)
1190 outlevel = 1
1191 CASE (1) !all plus snow-related
1192 outlevel = 2
1193 CASE (2) !minimal output
1194 outlevel = 0
1195 END SELECT
1196
1197 ! determine groups to output
1198 ! TODO: needs to be smarter, automate this filtering
1199 grouplist0(1) = 'SUEWS'
1200 grouplist0(2) = 'BEERS'
1201 grouplist0(3) = 'BL'
1202 grouplist0(4) = 'snow'
1203 grouplist0(5) = 'ESTM'
1204 grouplist0(6) = 'DailyState'
1205 grouplist0(7) = 'RSL'
1206 grouplist0(8) = 'debug'
1207 grouplist0(9) = 'SPARTACUS'
1208 grouplist0(10) = 'EHC'
1209 groupcond = [ &
1210 .true., &
1211 .true., &
1212 cbluse >= 1, &
1213 snowuse >= 1, &
1214 storageheatmethod == 4 .OR. storageheatmethod == 14, &
1215 .true., &
1216 .true., &
1217 .true., &
1218 .true., &
1219 storageheatmethod == 5 &
1220 ]
1221 n_group_use = count(groupcond)
1222
1223 ! PRINT*, grpList0,xx
1224
1225 ALLOCATE (grplist(n_group_use), stat=err)
1226 IF (err /= 0) print *, "grpList: Allocation request denied"
1227
1228 grplist = pack(grouplist0, mask=groupcond)
1229
1230 ! PRINT*, grpList,SIZE(grpList, dim=1)
1231
1232 ! loop over all groups
1233 DO i = 1, SIZE(grplist), 1
1234 !PRINT*, 'i',i
1235 n_group_use = count(varlistall%group == trim(grplist(i)), dim=1)
1236 ! PRINT*, 'number of variables:',xx, 'in group: ',grpList(i)
1237 ! print*, 'all group names: ',varList%group
1238 ALLOCATE (varlistx(5 + n_group_use), stat=err)
1239 IF (err /= 0) print *, "varListX: Allocation request denied"
1240 ! datetime
1241 varlistx(1:5) = varlistall(1:5)
1242 ! variable
1243 varlistx(6:5 + n_group_use) = pack(varlistall, mask=(varlistall%group == trim(grplist(i))))
1244
1245 IF (trim(varlistx(SIZE(varlistx))%group) /= 'DailyState') THEN
1246 ! all output arrays but DailyState
1247 ! all output frequency option:
1248 ! as forcing:
1249 IF (resolutionfilesout == tstep .OR. keeptstepfilesout == 1) THEN
1250 CALL suews_output_txt_grp(iv, irmax, iyr, varlistx, gridiv, outlevel, tstep)
1251 END IF
1252 ! as specified ResolutionFilesOut:
1253 IF (resolutionfilesout /= tstep) THEN
1254 CALL suews_output_txt_grp(iv, irmax, iyr, varlistx, gridiv, outlevel, resolutionfilesout)
1255 END IF
1256 ELSE
1257 ! DailyState array, which does not need aggregation
1258 CALL suews_output_txt_grp(iv, irmax, iyr, varlistx, gridiv, outlevel, tstep)
1259
1260 END IF
1261
1262 IF (ALLOCATED(varlistx)) DEALLOCATE (varlistx, stat=err)
1263 IF (err /= 0) print *, "varListX: Deallocation request denied"
1264 ! PRINT*, 'i',i,'end'
1265
1266 END DO
1267 END SUBROUTINE suews_output
1268
1269 ! output wrapper function for one group
1270 SUBROUTINE suews_output_txt_grp(iv, irMax, iyr, varListX, Gridiv, outLevel, outFreq_s)
1271 IMPLICIT NONE
1272
1273 TYPE(varattr), DIMENSION(:), INTENT(in) :: varListX
1274 INTEGER, INTENT(in) :: iv, irMax, iyr, Gridiv, outLevel, outFreq_s
1275
1276 INTEGER :: err
1277 INTEGER :: n_var
1278
1279 INTEGER, DIMENSION(:), ALLOCATABLE :: id_seq ! id sequence as in the dataOutX/dataOutX_agg
1280 REAL(KIND(1D0)), DIMENSION(:, :), ALLOCATABLE :: dataOutX
1281 REAL(KIND(1D0)), DIMENSION(:, :), ALLOCATABLE :: dataOutX_agg
1282
1283 ! number of varialbes for output
1284 n_var = SIZE(varlistx)
1285
1286 IF (.NOT. ALLOCATED(dataoutx)) THEN
1287 ALLOCATE (dataoutx(irmax, n_var), stat=err)
1288 IF (err /= 0) print *, "dataOutX: Allocation request denied"
1289 END IF
1290
1291 ! determine dataOutX array according to variable group
1292 SELECT CASE (trim(varlistx(n_var)%group))
1293 CASE ('SUEWS') !default
1294 dataoutx = dataoutsuews(1:irmax, 1:n_var, gridiv)
1295
1296 CASE ('BEERS') !SOLWEIG
1297 dataoutx = dataoutbeers(1:irmax, 1:n_var, gridiv)
1298 ! dataOutX = dataOutSOLWEIG(1:irMax, 1:n_var, Gridiv)
1299
1300 CASE ('BL') !BL
1301 dataoutx = dataoutbl(1:irmax, 1:n_var, gridiv)
1302
1303 CASE ('snow') !snow
1304 dataoutx = dataoutsnow(1:irmax, 1:n_var, gridiv)
1305
1306 CASE ('ESTM') !ESTM
1307 dataoutx = dataoutestm(1:irmax, 1:n_var, gridiv)
1308
1309 CASE ('RSL') !RSL
1310 dataoutx = dataoutrsl(1:irmax, 1:n_var, gridiv)
1311
1312 CASE ('debug') !debug
1313 dataoutx = dataoutdebug(1:irmax, 1:n_var, gridiv)
1314
1315 CASE ('SPARTACUS') !SPARTACUS
1316 dataoutx = dataoutspartacus(1:irmax, 1:n_var, gridiv)
1317
1318 CASE ('EHC') !EHC
1319 dataoutx = dataoutehc(1:irmax, 1:n_var, gridiv)
1320
1321 CASE ('DailyState') !DailyState
1322 ! get correct day index
1323 CALL unique(int(pack(dataoutsuews(1:irmax, 2, gridiv), &
1324 mask=(dataoutsuews(1:irmax, 3, gridiv) == 23 &
1325 .AND. dataoutsuews(1:irmax, 4, gridiv) == (nsh - 1.)/nsh*60))), &
1326 id_seq)
1327
1328 IF (ALLOCATED(dataoutx)) THEN
1329 DEALLOCATE (dataoutx)
1330 IF (err /= 0) print *, "dataOutX: Deallocation request denied"
1331 END IF
1332
1333 IF (.NOT. ALLOCATED(dataoutx)) THEN
1334 ALLOCATE (dataoutx(SIZE(id_seq), n_var), stat=err)
1335 IF (err /= 0) print *, "dataOutX: Allocation request denied"
1336 END IF
1337
1338 dataoutx = dataoutdailystate(id_seq, 1:n_var, gridiv)
1339 ! print*, id_seq
1340 ! print*, dataOutDailyState(id_seq,1:SIZE(varListX),Gridiv)
1341 ! print*, 1/(nsh-nsh)
1342 END SELECT
1343
1344 ! aggregation:
1345 ! aggregation is done for every group but 'DailyState'
1346 IF (trim(varlistx(SIZE(varlistx))%group) /= 'DailyState') THEN
1347
1348 CALL suews_output_agg(dataoutx_agg, dataoutx, varlistx, irmax, outfreq_s)
1349 ELSE
1350 IF (.NOT. ALLOCATED(dataoutx_agg)) THEN
1351 ALLOCATE (dataoutx_agg(SIZE(dataoutx, dim=1), SIZE(varlistx)), stat=err)
1352 IF (err /= 0) print *, ": Allocation request denied"
1353 END IF
1354 dataoutx_agg = dataoutx
1355 END IF
1356
1357 ! output:
1358 ! initialise file when processing first metblock
1359 IF (iv == 1) CALL suews_output_init(dataoutx_agg, varlistx, iyr, gridiv, outlevel)
1360
1361 ! append the aggregated data to the specific txt file
1362 CALL suews_write_txt(dataoutx_agg, varlistx, iyr, gridiv, outlevel)
1363
1364 END SUBROUTINE suews_output_txt_grp
1365
1366 ! initialise an output file with file name and headers
1367 SUBROUTINE suews_output_init(dataOutX, varList, iyr, Gridiv, outLevel)
1368 IMPLICIT NONE
1369 REAL(KIND(1D0)), DIMENSION(:, :), INTENT(in) :: dataOutX
1370 TYPE(varattr), DIMENSION(:), INTENT(in) :: varList
1371 INTEGER, INTENT(in) :: iyr, Gridiv, outLevel
1372
1373 TYPE(varattr), DIMENSION(:), ALLOCATABLE :: varListSel
1374 INTEGER :: xx, err, fn, i, nargs
1375 CHARACTER(len=365) :: FileOutX
1376 CHARACTER(len=3) :: itextX
1377 CHARACTER(len=6) :: args(5)
1378 CHARACTER(len=16*SIZE(varList)) :: FormatOut
1379 CHARACTER(len=16) :: formatX
1380 CHARACTER(len=16), DIMENSION(:), ALLOCATABLE :: headerOut
1381
1382 ! select variables to output
1383 xx = count((varlist%level <= outlevel), dim=1)
1384 WRITE (itextx, '(i3)') xx
1385 ALLOCATE (varlistsel(xx), stat=err)
1386 IF (err /= 0) print *, "varListSel: Allocation request denied"
1387 varlistsel = pack(varlist, mask=(varlist%level <= outlevel))
1388
1389 ! generate file name
1390 CALL filename_gen(dataoutx, varlist, iyr, gridiv, fileoutx)
1391
1392 ! store right-aligned headers
1393 ALLOCATE (headerout(xx), stat=err)
1394 IF (err /= 0) print *, "headerOut: Allocation request denied"
1395
1396 ! create format string:
1397 DO i = 1, SIZE(varlistsel)
1398 CALL parse(varlistsel(i)%fmt, 'if.,', args, nargs)
1399 formatx = adjustl('(a'//trim(args(2))//',1x)')
1400 ! adjust headers to right-aligned
1401 WRITE (headerout(i), formatx) adjustr(trim(adjustl(varlistsel(i)%header)))
1402 IF (i == 1) THEN
1403 formatout = adjustl(trim(formatx))
1404 ELSE
1405 formatout = trim(formatout)//' '//adjustl(trim(formatx))
1406 END IF
1407 END DO
1408 formatout = '('//trim(adjustl(formatout))//')'
1409
1410 ! create file
1411 fn = 9
1412 OPEN (fn, file=trim(adjustl(fileoutx)), status='unknown')
1413 ! PRINT*, 'FileOutX in SUEWS_Output_Init: ',FileOutX
1414
1415 ! write out headers
1416 WRITE (fn, formatout) headerout
1417 CLOSE (fn)
1418
1419 ! write out format file
1420 CALL formatfile_gen(dataoutx, varlist, iyr, gridiv, outlevel)
1421
1422 ! clean up
1423 IF (ALLOCATED(varlistsel)) DEALLOCATE (varlistsel, stat=err)
1424 IF (err /= 0) print *, "varListSel: Deallocation request denied"
1425 IF (ALLOCATED(headerout)) DEALLOCATE (headerout, stat=err)
1426 IF (err /= 0) print *, "headerOut: Deallocation request denied"
1427
1428 END SUBROUTINE suews_output_init
1429
1430 ! generate output format file
1431 SUBROUTINE formatfile_gen(dataOutX, varList, iyr, Gridiv, outLevel)
1432 IMPLICIT NONE
1433 REAL(KIND(1D0)), DIMENSION(:, :), INTENT(in) :: dataOutX
1434 TYPE(varattr), DIMENSION(:), INTENT(in) :: varList
1435 INTEGER, INTENT(in) :: iyr, Gridiv, outLevel
1436
1437 TYPE(varattr), DIMENSION(:), ALLOCATABLE :: varListSel
1438 INTEGER :: xx, err, fn, i
1439 CHARACTER(len=365) :: FileOutX
1440 CHARACTER(len=100*300) :: str_cat
1441 CHARACTER(len=100) :: str_x = ''
1442 CHARACTER(len=3) :: itextX
1443
1444 ! get filename
1445 CALL filename_gen(dataoutx, varlist, iyr, gridiv, fileoutx, 1)
1446
1447 !select variables to output
1448 xx = count((varlist%level <= outlevel), dim=1)
1449 ALLOCATE (varlistsel(xx), stat=err)
1450 IF (err /= 0) print *, "varListSel: Allocation request denied"
1451 varlistsel = pack(varlist, mask=(varlist%level <= outlevel))
1452
1453 ! create file
1454 fn = 9
1455 OPEN (fn, file=trim(adjustl(fileoutx)), status='unknown')
1456
1457 ! write out format strings
1458 ! column number:
1459 str_cat = ''
1460 DO i = 1, SIZE(varlistsel)
1461 WRITE (itextx, '(i3)') i
1462 IF (i == 1) THEN
1463 str_cat = trim(adjustl(itextx))
1464 ELSE
1465 str_cat = trim(str_cat)//';'//adjustl(itextx)
1466 END IF
1467 END DO
1468 WRITE (fn, '(a)') trim(str_cat)
1469
1470 ! header:
1471 str_cat = ''
1472 DO i = 1, SIZE(varlistsel)
1473 str_x = varlistsel(i)%header
1474 IF (i == 1) THEN
1475 str_cat = trim(adjustl(str_x))
1476 ELSE
1477 str_cat = trim(str_cat)//';'//adjustl(str_x)
1478 END IF
1479 END DO
1480 WRITE (fn, '(a)') trim(str_cat)
1481
1482 ! long name:
1483 str_cat = ''
1484 DO i = 1, SIZE(varlistsel)
1485 str_x = varlistsel(i)%longNm
1486 IF (i == 1) THEN
1487 str_cat = trim(adjustl(str_x))
1488 ELSE
1489 str_cat = trim(str_cat)//';'//adjustl(str_x)
1490 END IF
1491 END DO
1492 WRITE (fn, '(a)') trim(str_cat)
1493
1494 ! unit:
1495 str_cat = ''
1496 DO i = 1, SIZE(varlistsel)
1497 str_x = varlistsel(i)%unit
1498 IF (i == 1) THEN
1499 str_cat = trim(adjustl(str_x))
1500 ELSE
1501 str_cat = trim(str_cat)//';'//adjustl(str_x)
1502 END IF
1503 END DO
1504 WRITE (fn, '(a)') trim(str_cat)
1505
1506 ! format:
1507 str_cat = ''
1508 DO i = 1, SIZE(varlistsel)
1509 str_x = varlistsel(i)%fmt
1510 IF (i == 1) THEN
1511 str_cat = trim(adjustl(str_x))
1512 ELSE
1513 str_cat = trim(str_cat)//';'//adjustl(str_x)
1514 END IF
1515 END DO
1516 WRITE (fn, '(a)') trim(str_cat)
1517
1518 ! aggregation method:
1519 str_cat = ''
1520 DO i = 1, SIZE(varlistsel)
1521 str_x = varlistsel(i)%aggreg
1522 IF (i == 1) THEN
1523 str_cat = trim(adjustl(str_x))
1524 ELSE
1525 str_cat = trim(str_cat)//';'//adjustl(str_x)
1526 END IF
1527 END DO
1528 WRITE (fn, '(a)') trim(str_cat)
1529
1530 ! close file
1531 CLOSE (fn)
1532
1533 ! clean up
1534 IF (ALLOCATED(varlistsel)) DEALLOCATE (varlistsel, stat=err)
1535 IF (err /= 0) print *, "varListSel: Deallocation request denied"
1536
1537 END SUBROUTINE formatfile_gen
1538
1539 ! aggregate data to specified resolution
1540 SUBROUTINE suews_output_agg(dataOut_agg, dataOutX, varList, irMax, outFreq_s)
1541 IMPLICIT NONE
1542 REAL(KIND(1D0)), DIMENSION(:, :), INTENT(in) :: dataOutX
1543 TYPE(varattr), DIMENSION(:), INTENT(in) :: varList
1544 INTEGER, INTENT(in) :: irMax, outFreq_s
1545 REAL(KIND(1D0)), DIMENSION(:, :), ALLOCATABLE, INTENT(out) :: dataOut_agg
1546
1547 INTEGER :: nlinesOut, i, j, x
1548 REAL(KIND(1D0)) :: dataOut_aggX(1:SIZE(varList))
1549 REAL(KIND(1D0)), DIMENSION(:, :), ALLOCATABLE :: dataOut_agg0
1550 nlinesout = int(nsh/(60.*60/outfreq_s))
1551 ! nGrid=SIZE(dataOutX, dim=3)
1552
1553 ALLOCATE (dataout_agg(int(irmax/nlinesout), SIZE(varlist)))
1554 ALLOCATE (dataout_agg0(nlinesout, SIZE(varlist)))
1555
1556 DO i = nlinesout, irmax, nlinesout
1557 x = i/nlinesout
1558 dataout_agg0 = dataoutx(i - nlinesout + 1:i, :)
1559 DO j = 1, SIZE(varlist), 1
1560 IF (diagnose == 1) THEN
1561 print *, "aggregating variable ", j, " of ", varlist(j)%header, 'in group ', varlist(j)%group
1562 END IF
1563 ! aggregating different variables
1564 SELECT CASE (varlist(j)%aggreg)
1565 CASE (at) !time columns, aT
1566 dataout_aggx(j) = dataout_agg0(nlinesout, j)
1567 CASE (aa) !average, aA
1568 dataout_aggx(j) = sum(dataout_agg0(:, j))/nlinesout
1569 CASE (as) !sum, aS
1570 dataout_aggx(j) = sum(dataout_agg0(:, j))
1571 CASE (al) !last value, aL
1572 dataout_aggx(j) = dataout_agg0(nlinesout, j)
1573 END SELECT
1574
1575 IF (diagnose == 1 .AND. i == irmax) THEN
1576 ! IF ( i==irMax ) THEN
1577 print *, 'raw data of ', j, ':'
1578 print *, dataout_agg0(:, j)
1579 print *, 'aggregated with method: ', varlist(j)%aggreg
1580 print *, dataout_aggx(j)
1581 print *, ''
1582 END IF
1583 END DO
1584 dataout_agg(x, :) = dataout_aggx
1585 END DO
1586
1587 END SUBROUTINE suews_output_agg
1588
1589 ! append output data to the specific file at the specified outLevel
1590 SUBROUTINE suews_write_txt(dataOutX, varList, iyr, Gridiv, outLevel)
1591 IMPLICIT NONE
1592 REAL(KIND(1D0)), DIMENSION(:, :), INTENT(in) :: dataOutX
1593 TYPE(varattr), DIMENSION(:), INTENT(in) :: varList
1594 INTEGER, INTENT(in) :: iyr, Gridiv, outLevel
1595
1596 REAL(KIND(1D0)), DIMENSION(:, :), ALLOCATABLE :: dataOutSel
1597 TYPE(varattr), DIMENSION(:), ALLOCATABLE :: varListSel
1598 CHARACTER(len=365) :: FileOutX
1599 INTEGER :: fn, i, xx, err
1600 INTEGER :: sizeVarListSel, sizedataOutX
1601 CHARACTER(len=12*SIZE(varList)) :: FormatOut
1602 ! LOGICAL :: initQ_file
1603 formatout = ''
1604
1605 IF (diagnose == 1) WRITE (*, *) 'Writting data of group: ', varlist(SIZE(varlist))%group
1606
1607 !select variables to output
1608 sizevarlistsel = count((varlist%level <= outlevel), dim=1)
1609 ALLOCATE (varlistsel(sizevarlistsel), stat=err)
1610 IF (err /= 0) print *, "varListSel: Allocation request denied"
1611 varlistsel = pack(varlist, mask=(varlist%level <= outlevel))
1612
1613 ! copy data accordingly
1614 sizedataoutx = SIZE(dataoutx, dim=1)
1615 ALLOCATE (dataoutsel(sizedataoutx, sizevarlistsel), stat=err)
1616 IF (err /= 0) print *, "dataOutSel: Allocation request denied"
1617 ! print*, SIZE(varList%level),PACK((/(i,i=1,SIZE(varList%level))/), varList%level <= outLevel)
1618 ! print*, irMax,shape(dataOutX)
1619 dataoutsel = dataoutx(:, pack((/(i, i=1, SIZE(varlist%level))/), varlist%level <= outlevel))
1620 ! do i = 1, 5
1621 ! print*, 'first several lines of dataOutX:', i, dataOutX(i,:)
1622
1623 ! end do
1624
1625 ! create format string:
1626 DO i = 1, sizevarlistsel
1627 ! PRINT*,''
1628 ! PRINT*,i
1629 ! PRINT*, LEN_TRIM(FormatOut),TRIM(FormatOut)
1630 ! PRINT*, LEN_TRIM(TRIM(FormatOut)//','),TRIM(FormatOut)//','
1631 IF (i == 1) THEN
1632 ! FormatOut=ADJUSTL(varListSel(i)%fmt)
1633 formatout = varlistsel(i)%fmt
1634 ELSE
1635
1636 ! FormatOut=TRIM(FormatOut)//','//ADJUSTL(varListSel(i)%fmt)
1637 formatout = trim(formatout)//','//trim(varlistsel(i)%fmt)
1638 END IF
1639 ! PRINT*,''
1640 ! PRINT*,i
1641 ! PRINT*, 'FormatOut',FormatOut
1642 END DO
1643 formatout = '('//trim(adjustl(formatout))//')'
1644
1645 ! get filename
1646 CALL filename_gen(dataoutsel, varlistsel, iyr, gridiv, fileoutx)
1647 ! PRINT*, 'FileOutX in SUEWS_Write_txt: ',FileOutX
1648
1649 ! test if FileOutX has been initialised
1650 ! IF ( .NOT. initQ_file(FileOutX) ) THEN
1651 ! CALL SUEWS_Output_Init(dataOutSel,varListSel,Gridiv,outLevel)
1652 ! END IF
1653
1654 ! write out data
1655 fn = 50
1656 OPEN (fn, file=trim(fileoutx), position='append') !,err=112)
1657 DO i = 1, sizedataoutx
1658 ! PRINT*, 'Writting line',i
1659 ! PRINT*, 'FormatOut in writing',FormatOut
1660 ! PRINT*, dataOutSel(i,1:sizeVarListSel)
1661 WRITE (fn, formatout) &
1662 (int(dataoutsel(i, xx)), xx=1, 4), &
1663 (dataoutsel(i, xx), xx=5, sizevarlistsel)
1664 END DO
1665 CLOSE (fn)
1666
1667 IF (ALLOCATED(varlistsel)) DEALLOCATE (varlistsel, stat=err)
1668 IF (err /= 0) print *, "varListSel: Deallocation request denied"
1669
1670 IF (ALLOCATED(dataoutsel)) DEALLOCATE (dataoutsel, stat=err)
1671 IF (err /= 0) print *, "dataOutSel: Deallocation request denied"
1672
1673 END SUBROUTINE suews_write_txt
1674
1675 SUBROUTINE filename_gen(dataOutX, varList, iyr, Gridiv, FileOutX, opt_fmt)
1676 USE datetime_module
1677
1678 IMPLICIT NONE
1679 REAL(KIND(1D0)), DIMENSION(:, :), INTENT(in) :: dataOutX ! to determine year & output frequency
1680 TYPE(varattr), DIMENSION(:), INTENT(in) :: varList ! to determine output group
1681 INTEGER, INTENT(in) :: iyr ! to determine year
1682 INTEGER, INTENT(in) :: Gridiv ! to determine grid name as in SiteSelect
1683 INTEGER, INTENT(in), OPTIONAL :: opt_fmt ! to determine if a format file
1684 CHARACTER(len=365), INTENT(out) :: FileOutX ! the output file name
1685
1686 CHARACTER(len=20) :: str_out_min, str_grid, &
1687 str_date, str_year, str_DOY, str_grp, str_sfx
1688 INTEGER :: year_int, DOY_int, val_fmt, delta_t_min
1689 TYPE(datetime) :: dt1, dt2
1690 TYPE(timedelta) :: dt_x
1691
1692 ! initialise with a default value
1693 val_fmt = -999
1694
1695 IF (PRESENT(opt_fmt)) val_fmt = opt_fmt
1696
1697 ! PRINT*, varList(:)%header
1698 ! PRINT*, 'dataOutX(1)',dataOutX(1,:)
1699
1700 ! date:
1701 doy_int = int(dataoutx(1, 2))
1702 WRITE (str_doy, '(i3.3)') doy_int
1703
1704! #ifdef nc
1705! ! year for nc use that in dataOutX
1706! year_int = INT(dataOutX(1, 1))
1707! WRITE (str_year, '(i4)') year_int
1708! str_date = '_'//TRIM(ADJUSTL(str_year))
1709! ! add DOY as a specifier
1710! IF (ncMode == 1) str_date = TRIM(ADJUSTL(str_date))//TRIM(ADJUSTL(str_DOY))
1711! #endif
1712
1713 ! year for txt use specified value to avoid conflicts when crossing years
1714 year_int = iyr
1715 WRITE (str_year, '(i4)') year_int
1716 str_date = '_'//trim(adjustl(str_year))
1717
1718 ! output frequency in minute:
1719 IF (varlist(6)%group == 'DailyState') THEN
1720 str_out_min = '' ! ignore this for DailyState
1721 ELSE
1722 ! derive output frequency from output arrays
1723 ! dt_x=
1724 dt1 = datetime(int(dataoutx(1, 1)), 1, 1) + &
1725 timedelta(days=int(dataoutx(1, 2) - 1), &
1726 hours=int(dataoutx(1, 3)), &
1727 minutes=int(dataoutx(1, 4)))
1728
1729 dt2 = datetime(int(dataoutx(2, 1)), 1, 1) + &
1730 timedelta(days=int(dataoutx(2, 2) - 1), &
1731 hours=int(dataoutx(2, 3)), &
1732 minutes=int(dataoutx(2, 4)))
1733
1734 dt_x = dt2 - dt1
1735 delta_t_min = int(dt_x%total_seconds()/60)
1736 WRITE (str_out_min, '(i4)') delta_t_min
1737 str_out_min = '_'//trim(adjustl(str_out_min))
1738 END IF
1739
1740 ! group: output type
1741 str_grp = varlist(6)%group
1742 IF (len(trim(str_grp)) > 0) str_grp = '_'//trim(adjustl(str_grp))
1743
1744 ! grid name:
1745 WRITE (str_grid, '(i10)') grididmatrix(gridiv)
1746! #ifdef nc
1747! IF (ncMode == 1) str_grid = '' ! grid name not needed by nc files
1748! #endif
1749
1750 ! suffix:
1751 str_sfx = '.txt'
1752! #ifdef nc
1753! IF (ncMode == 1) str_sfx = '.nc'
1754! #endif
1755
1756 ! filename: FileOutX
1757 fileoutx = trim(fileoutputpath)// &
1758 trim(filecode)// &
1759 trim(adjustl(str_grid))// &
1760 trim(adjustl(str_date))// &
1761 trim(adjustl(str_grp))// &
1762 trim(adjustl(str_out_min))// &
1763 trim(adjustl(str_sfx))
1764
1765 ! filename: format
1766 IF (val_fmt == 1) THEN
1767 fileoutx = trim(fileoutputpath)// &
1768 trim(filecode)// &
1769 trim(adjustl(str_grp))// &
1770 '_OutputFormat.txt'
1771 END IF
1772
1773 END SUBROUTINE filename_gen
1774
1775 SUBROUTINE unique(vec, vec_unique)
1776 ! Return only the unique values from vec.
1777
1778 IMPLICIT NONE
1779
1780 INTEGER, DIMENSION(:), INTENT(in) :: vec
1781 INTEGER, DIMENSION(:), ALLOCATABLE, INTENT(out) :: vec_unique
1782
1783 INTEGER :: i, num
1784 LOGICAL, DIMENSION(SIZE(vec)) :: mask
1785
1786 mask = .false.
1787
1788 DO i = 1, SIZE(vec)
1789
1790 !count the number of occurrences of this element:
1791 num = count(vec(i) == vec)
1792
1793 IF (num == 1) THEN
1794 !there is only one, flag it:
1795 mask(i) = .true.
1796 ELSE
1797 !flag this value only if it hasn't already been flagged:
1798 IF (.NOT. any(vec(i) == vec .AND. mask)) mask(i) = .true.
1799 END IF
1800
1801 END DO
1802
1803 !return only flagged elements:
1804 ALLOCATE (vec_unique(count(mask)))
1805 vec_unique = pack(vec, mask)
1806
1807 !if you also need it sorted, then do so.
1808 ! For example, with slatec routine:
1809 !call ISORT (vec_unique, [0], size(vec_unique), 1)
1810
1811 END SUBROUTINE unique
1812
1813 ! test if a txt file has been initialised
1814 LOGICAL FUNCTION initq_file(FileName)
1815 IMPLICIT NONE
1816 CHARACTER(len=365), INTENT(in) :: filename ! the output file name
1817 LOGICAL :: existq
1818 CHARACTER(len=1000) :: longstring
1819
1820 INQUIRE (file=trim(filename), exist=existq)
1821 IF (existq) THEN
1822 OPEN (10, file=trim(filename))
1823 READ (10, '(a)') longstring
1824 ! print*, 'longstring: ',longstring
1825 IF (verify(longstring, 'Year') == 0) initq_file = .false.
1826 CLOSE (unit=10)
1827 ELSE
1828 initq_file = .false.
1829 END IF
1830
1831 END FUNCTION initq_file
1832
1833 !========================================================================================
1834 FUNCTION count_lines(filename) RESULT(nlines)
1835 ! count the number of valid lines in a file
1836 ! invalid line starting with -9
1837
1838 !========================================================================================
1839 IMPLICIT NONE
1840 CHARACTER(len=*) :: filename
1841 INTEGER :: nlines
1842 INTEGER :: io, iv
1843
1844 OPEN (10, file=filename, iostat=io, status='old')
1845
1846 ! if io error found, report iostat and exit
1847 IF (io /= 0) THEN
1848 print *, 'io', io, 'for', filename
1849 stop 'Cannot open file! '
1850 END IF
1851
1852 nlines = 0
1853 DO
1854 READ (10, *, iostat=io) iv
1855 IF (io < 0 .OR. iv == -9) EXIT
1856
1857 nlines = nlines + 1
1858 END DO
1859 CLOSE (10)
1860 nlines = nlines - 1 ! skip header
1861 END FUNCTION count_lines
1862
1863 !===========================================================================!
1864 ! write the output of final SUEWS results in netCDF
1865 ! with spatial layout of QGIS convention
1866 ! the spatial matrix arranges successive rows down the page (i.e., north to south)
1867 ! and succesive columns across (i.e., west to east)
1868 ! the output file frequency is the same as metblocks in the main SUEWS loop
1869 !===========================================================================!
1870
1871! #ifdef nc
1872
1873! SUBROUTINE SUEWS_Output_nc_grp(irMax, varList, outLevel, outFreq_s)
1874! IMPLICIT NONE
1875
1876! TYPE(varAttr), DIMENSION(:), INTENT(in)::varList
1877! INTEGER, INTENT(in) :: irMax, outLevel, outFreq_s
1878
1879! REAL(KIND(1d0)), ALLOCATABLE::dataOutX(:, :, :)
1880! REAL(KIND(1d0)), ALLOCATABLE::dataOutX_agg(:, :, :), dataOutX_agg0(:, :)
1881! INTEGER :: iGrid, err, idMin, idMax
1882! INTEGER, DIMENSION(:), ALLOCATABLE ::id_seq
1883
1884! IF (.NOT. ALLOCATED(dataOutX)) THEN
1885! ALLOCATE (dataOutX(irMax, SIZE(varList), NumberOfGrids), stat=err)
1886! IF (err /= 0) PRINT *, "dataOutX: Allocation request denied"
1887! ENDIF
1888
1889! ! determine dataOutX array according to variable group
1890! SELECT CASE (TRIM(varList(SIZE(varList))%group))
1891! CASE ('SUEWS') !default
1892! dataOutX = dataOutSUEWS(1:irMax, 1:SIZE(varList), :)
1893
1894! CASE ('BEERS') !SOLWEIG
1895! ! todo: inconsistent data structure
1896! dataOutX = dataOutSOLWEIG(1:irMax, 1:SIZE(varList), :)
1897
1898! CASE ('BL') !BL
1899! dataOutX = dataOutBL(1:irMax, 1:SIZE(varList), :)
1900
1901! CASE ('snow') !snow
1902! dataOutX = dataOutSnow(1:irMax, 1:SIZE(varList), :)
1903
1904! CASE ('ESTM') !ESTM
1905! dataOutX = dataOutESTM(1:irMax, 1:SIZE(varList), :)
1906
1907! CASE ('DailyState') !DailyState
1908! ! get correct day index
1909! CALL unique(INT(PACK(dataOutSUEWS(1:irMax, 2, 1), &
1910! mask=(dataOutSUEWS(1:irMax, 3, Gridiv) == 23 &
1911! .AND. dataOutSUEWS(1:irMax, 4, Gridiv) == (nsh - 1)/nsh*60))), &
1912! id_seq)
1913! IF (ALLOCATED(dataOutX)) THEN
1914! DEALLOCATE (dataOutX)
1915! IF (err /= 0) PRINT *, "dataOutX: Deallocation request denied"
1916! ENDIF
1917
1918! IF (.NOT. ALLOCATED(dataOutX)) THEN
1919! ALLOCATE (dataOutX(SIZE(id_seq), SIZE(varList), NumberOfGrids), stat=err)
1920! IF (err /= 0) PRINT *, "dataOutX: Allocation request denied"
1921! ENDIF
1922
1923! dataOutX = dataOutDailyState(id_seq, 1:SIZE(varList), :)
1924! ! print*, 'idMin line',dataOutX(idMin,1:4,1)
1925! ! print*, 'idMax line',dataOutX(idMax,1:4,1)
1926
1927! END SELECT
1928
1929! ! aggregation:
1930! IF (TRIM(varList(SIZE(varList))%group) /= 'DailyState') THEN
1931! DO iGrid = 1, NumberOfGrids
1932! CALL SUEWS_Output_Agg(dataOutX_agg0, dataOutX(:, :, iGrid), varList, irMax, outFreq_s)
1933! IF (.NOT. ALLOCATED(dataOutX_agg)) THEN
1934! ALLOCATE (dataOutX_agg(SIZE(dataOutX_agg0, dim=1), SIZE(varList), NumberOfGrids), stat=err)
1935! IF (err /= 0) PRINT *, ": Allocation request denied"
1936! ENDIF
1937! dataOutX_agg(:, :, iGrid) = dataOutX_agg0
1938! END DO
1939! ELSE
1940! IF (.NOT. ALLOCATED(dataOutX_agg)) THEN
1941! ALLOCATE (dataOutX_agg(SIZE(dataOutX, dim=1), SIZE(varList), NumberOfGrids), stat=err)
1942! IF (err /= 0) PRINT *, ": Allocation request denied"
1943! ENDIF
1944! dataOutX_agg = dataOutX
1945! ENDIF
1946
1947! ! write out data
1948! CALL SUEWS_Write_nc(dataOutX_agg, varList, outLevel)
1949! IF (ALLOCATED(dataOutX_agg)) THEN
1950! DEALLOCATE (dataOutX_agg)
1951! IF (err /= 0) PRINT *, "dataOutX_agg: Deallocation request denied"
1952! ENDIF
1953! END SUBROUTINE SUEWS_Output_nc_grp
1954
1955! ! SUBROUTINE SUEWS_Write_nc(dataOutX, varList, outLevel)
1956! ! ! generic subroutine to write out data in netCDF format
1957! ! USE netCDF
1958
1959! ! IMPLICIT NONE
1960! ! REAL(KIND(1d0)), DIMENSION(:, :, :), INTENT(in)::dataOutX
1961! ! TYPE(varAttr), DIMENSION(:), INTENT(in)::varList
1962! ! INTEGER, INTENT(in) :: outLevel
1963
1964! ! CHARACTER(len=365):: fileOut
1965! ! REAL(KIND(1d0)), DIMENSION(:, :, :), ALLOCATABLE::dataOutSel
1966! ! TYPE(varAttr), DIMENSION(:), ALLOCATABLE::varListSel
1967
1968! ! ! We are writing 3D data, {time, y, x}
1969! ! INTEGER, PARAMETER :: NDIMS = 3, iVarStart = 6
1970! ! INTEGER :: NX, NY, nTime, nVar, err
1971
1972! ! ! When we create netCDF files, variables and dimensions, we get back
1973! ! ! an ID for each one.
1974! ! INTEGER :: ncID, varID, dimids(NDIMS), varIDGrid
1975! ! INTEGER :: x_dimid, y_dimid, time_dimid, iVar, varIDx, varIDy, varIDt, varIDCRS
1976! ! REAL(KIND(1d0)), ALLOCATABLE :: varOut(:, :, :), &
1977! ! varX(:, :), varY(:, :), &
1978! ! lat(:, :), lon(:, :), &
1979! ! varSeq0(:), varSeq(:), &
1980! ! xTime(:), xGridID(:, :)
1981
1982! ! INTEGER :: idVar(iVarStart:SIZE(varList))
1983! ! CHARACTER(len=50):: header_str, longNm_str, unit_str
1984! ! CHARACTER(len=4) :: yrStr2
1985! ! CHARACTER(len=40) :: startStr2
1986! ! REAL(KIND(1d0)) :: minLat, maxLat, dLat, minLon, maxLon, dLon
1987! ! REAL(KIND(1d0)), DIMENSION(1:6) :: geoTrans
1988! ! CHARACTER(len=80) :: strGeoTrans
1989
1990! ! ! determine number of times
1991! ! nTime = SIZE(dataOutX, dim=1)
1992
1993! ! !select variables to output
1994! ! nVar = COUNT((varList%level <= outLevel), dim=1)
1995! ! ALLOCATE (varListSel(nVar), stat=err)
1996! ! IF (err /= 0) PRINT *, "varListSel: Allocation request denied"
1997! ! varListSel = PACK(varList, mask=(varList%level <= outLevel))
1998
1999! ! ! copy data accordingly
2000! ! ALLOCATE (dataOutSel(nTime, nVar, NumberOfGrids), stat=err)
2001! ! IF (err /= 0) PRINT *, "dataOutSel: Allocation request denied"
2002! ! dataOutSel = dataOutX(:, PACK((/(i, i=1, SIZE(varList))/), varList%level <= outLevel), :)
2003
2004! ! ! determine filename
2005! ! CALL filename_gen(dataOutSel(:, :, 1), varListSel, 1, FileOut)
2006! ! ! PRINT*, 'writing file:',TRIM(fileOut)
2007
2008! ! ! set year string
2009! ! WRITE (yrStr2, '(i4)') INT(dataOutX(1, 1, 1))
2010! ! ! get start for later time unit creation
2011! ! startStr2 = TRIM(yrStr2)//'-01-01 00:00:00'
2012
2013! ! ! define the dimension of spatial array/frame in the output
2014! ! nX = nCol
2015! ! nY = nRow
2016
2017! ! ALLOCATE (varSeq0(nX*nY))
2018! ! ALLOCATE (varSeq(nX*nY))
2019! ! ALLOCATE (xGridID(nX, nY))
2020! ! ALLOCATE (lon(nX, nY))
2021! ! ALLOCATE (lat(nX, nY))
2022! ! ALLOCATE (varY(nX, nY))
2023! ! ALLOCATE (varX(nX, nY))
2024! ! ALLOCATE (xTime(nTime))
2025
2026! ! ! GridID:
2027! ! varSeq = SurfaceChar(1:nX*nY, 1)
2028! ! ! CALL sortSeqReal(varSeq0,varSeq,nY,nX)
2029! ! xGridID = RESHAPE(varSeq, (/nX, nY/), order=(/1, 2/))
2030! ! ! PRINT*, 'before flipping:',lat(1:2,1)
2031! ! xGridID = xGridID(:, nY:1:-1)
2032
2033! ! ! latitude:
2034! ! varSeq = SurfaceChar(1:nX*nY, 5)
2035! ! ! CALL sortSeqReal(varSeq0,varSeq,nY,nX)
2036! ! lat = RESHAPE(varSeq, (/nX, nY/), order=(/1, 2/))
2037! ! ! PRINT*, 'before flipping:',lat(1:2,1)
2038! ! lat = lat(:, nY:1:-1)
2039! ! ! PRINT*, 'after flipping:',lat(1:2,1)
2040
2041! ! ! longitude:
2042! ! varSeq = SurfaceChar(1:nX*nY, 6)
2043! ! ! CALL sortSeqReal(varSeq0,varSeq,nY,nX)
2044! ! lon = RESHAPE(varSeq, (/nX, nY/), order=(/1, 2/))
2045! ! lon = lon(:, nY:1:-1)
2046
2047! ! ! pass values to coordinate variables
2048! ! varY = lat
2049! ! varX = lon
2050
2051! ! ! calculate GeoTransform array as needed by GDAL
2052! ! ! ref: http://www.perrygeo.com/python-affine-transforms.html
2053! ! ! the values below are different from the above ref,
2054! ! ! as the layout of SUEWS output is different from the schematic shown there
2055! ! ! SUEWS output is arranged northward down the page
2056! ! ! if data are formatted as a normal matrix
2057! ! minLat = lat(1, 1) ! the lower-left pixel
2058! ! maxLat = lat(1, NY) ! the upper-left pixel
2059! ! IF (nY > 1) THEN
2060! ! dLat = (maxLat - minLat)/(nY - 1) ! height of a pixel
2061! ! ELSE
2062! ! dLat = 1
2063! ! END IF
2064
2065! ! ! PRINT*, 'lat:',minLat,maxLat,dLat
2066! ! minLon = lon(1, 1) ! the lower-left pixel
2067! ! maxLon = lon(NX, 1) ! the lower-right pixel
2068! ! IF (nY > 1) THEN
2069! ! dLon = (maxLon - minLon)/(nX - 1) ! width of a pixel
2070! ! ELSE
2071! ! dLon = 1
2072! ! END IF
2073
2074! ! ! PRINT*, 'lon:',minLon,maxLon,dLon
2075! ! geoTrans(1) = minLon - dLon/2 ! x-coordinate of the lower-left corner of the lower-left pixel
2076! ! geoTrans(2) = dLon ! width of a pixel
2077! ! geoTrans(3) = 0. ! row rotation (typically zero)
2078! ! geoTrans(4) = minLat - dLat/2 ! y-coordinate of the of the lower-left corner of the lower-left pixel
2079! ! geoTrans(5) = 0. ! column rotation (typically zero)
2080! ! geoTrans(6) = dLat ! height of a pixel (typically negative, but here positive)
2081! ! ! write GeoTransform to strGeoTrans
2082! ! WRITE (strGeoTrans, '(6(f12.8,1x))') geoTrans
2083
2084! ! ! Create the netCDF file. The nf90_clobber parameter tells netCDF to
2085! ! ! overwrite this file, if it already exists.
2086! ! CALL check(nf90_create(TRIM(fileOut), NF90_CLOBBER, ncID))
2087
2088! ! ! put global attributes
2089! ! CALL check(nf90_put_att(ncID, NF90_GLOBAL, 'Conventions', 'CF1.6'))
2090! ! CALL check(nf90_put_att(ncID, NF90_GLOBAL, 'title', 'SUEWS output'))
2091! ! CALL check(nf90_put_att(ncID, NF90_GLOBAL, 'source', 'Micromet Group, University of Reading'))
2092! ! CALL check(nf90_put_att(ncID, NF90_GLOBAL, 'references', 'http://urban-climate.net/umep/SUEWS'))
2093
2094! ! ! Define the dimensions. NetCDF will hand back an ID for each.
2095! ! ! nY = ncolumnsDataOutSUEWS-4
2096! ! ! nx = NumberOfGrids
2097! ! CALL check(nf90_def_dim(ncID, "time", NF90_UNLIMITED, time_dimid))
2098! ! CALL check(nf90_def_dim(ncID, "west_east", NX, x_dimid))
2099! ! CALL check(nf90_def_dim(ncID, "south_north", NY, y_dimid))
2100! ! ! PRINT*, 'good define dim'
2101
2102! ! ! The dimids array is used to pass the IDs of the dimensions of
2103! ! ! the variables. Note that in fortran arrays are stored in
2104! ! ! column-major format.
2105! ! dimids = (/x_dimid, y_dimid, time_dimid/)
2106
2107! ! ! write out each variable
2108! ! ALLOCATE (varOut(nX, nY, nTime))
2109
2110! ! ! define all variables
2111! ! ! define time variable:
2112! ! CALL check(nf90_def_var(ncID, 'time', NF90_REAL, time_dimid, varIDt))
2113! ! CALL check(nf90_put_att(ncID, varIDt, 'units', 'minutes since '//startStr2))
2114! ! CALL check(nf90_put_att(ncID, varIDt, 'long_name', 'time'))
2115! ! CALL check(nf90_put_att(ncID, varIDt, 'standard_name', 'time'))
2116! ! CALL check(nf90_put_att(ncID, varIDt, 'calendar', 'gregorian'))
2117! ! CALL check(nf90_put_att(ncID, varIDt, 'axis', 'T'))
2118
2119! ! ! define coordinate variables:
2120! ! CALL check(nf90_def_var(ncID, 'lon', NF90_REAL, (/x_dimid, y_dimid/), varIDx))
2121! ! CALL check(nf90_put_att(ncID, varIDx, 'units', 'degree_east'))
2122! ! CALL check(nf90_put_att(ncID, varIDx, 'long_name', 'longitude'))
2123! ! CALL check(nf90_put_att(ncID, varIDx, 'standard_name', 'longitude'))
2124! ! CALL check(nf90_put_att(ncID, varIDx, 'axis', 'X'))
2125
2126! ! CALL check(nf90_def_var(ncID, 'lat', NF90_REAL, (/x_dimid, y_dimid/), varIDy))
2127! ! CALL check(nf90_put_att(ncID, varIDy, 'units', 'degree_north'))
2128! ! CALL check(nf90_put_att(ncID, varIDy, 'long_name', 'latitude'))
2129! ! CALL check(nf90_put_att(ncID, varIDy, 'standard_name', 'latitude'))
2130! ! CALL check(nf90_put_att(ncID, varIDy, 'axis', 'Y'))
2131
2132! ! ! define coordinate referencing system:
2133! ! CALL check(nf90_def_var(ncID, 'crsWGS84', NF90_INT, varIDCRS))
2134! ! CALL check(nf90_put_att(ncID, varIDCRS, 'grid_mapping_name', 'latitude_longitude'))
2135! ! CALL check(nf90_put_att(ncID, varIDCRS, 'long_name', 'CRS definition'))
2136! ! CALL check(nf90_put_att(ncID, varIDCRS, 'longitude_of_prime_meridian', '0.0'))
2137! ! CALL check(nf90_put_att(ncID, varIDCRS, 'semi_major_axis', '6378137.0'))
2138! ! CALL check(nf90_put_att(ncID, varIDCRS, 'inverse_flattening', '298.257223563'))
2139! ! CALL check(nf90_put_att(ncID, varIDCRS, 'epsg_code', 'EPSG:4326'))
2140! ! CALL check(nf90_put_att(ncID, varIDCRS, 'GeoTransform', TRIM(strGeoTrans)))
2141! ! CALL check(nf90_put_att(ncID, varIDCRS, 'spatial_ref',&
2142! ! &'GEOGCS["WGS 84",&
2143! ! & DATUM["WGS_1984",&
2144! ! & SPHEROID["WGS 84",6378137,298.257223563,&
2145! ! & AUTHORITY["EPSG","7030"]],&
2146! ! & AUTHORITY["EPSG","6326"]],&
2147! ! & PRIMEM["Greenwich",0],&
2148! ! & UNIT["degree",0.0174532925199433],&
2149! ! & AUTHORITY["EPSG","4326"]]' &
2150! ! ))
2151
2152! ! ! define grid_ID:
2153! ! CALL check(nf90_def_var(ncID, 'grid_ID', NF90_INT, (/x_dimid, y_dimid/), varIDGrid))
2154! ! CALL check(nf90_put_att(ncID, varIDGrid, 'coordinates', 'lon lat'))
2155! ! CALL check(nf90_put_att(ncID, varIDGrid, 'long_name', 'Grid ID as in SiteSelect'))
2156! ! CALL check(nf90_put_att(ncID, varIDGrid, 'grid_mapping', 'crsWGS84'))
2157! ! ! varIDGrid=varID
2158
2159! ! ! define other 3D variables:
2160! ! DO iVar = iVarStart, nVar
2161! ! ! define variable name
2162! ! header_str = varListSel(iVar)%header
2163! ! unit_str = varListSel(iVar)%unit
2164! ! longNm_str = varListSel(iVar)%longNm
2165
2166! ! ! Define the variable. The type of the variable in this case is
2167! ! ! NF90_REAL.
2168
2169! ! CALL check(nf90_def_var(ncID, TRIM(ADJUSTL(header_str)), NF90_REAL, dimids, varID))
2170
2171! ! CALL check(nf90_put_att(ncID, varID, 'coordinates', 'lon lat'))
2172
2173! ! CALL check(nf90_put_att(ncID, varID, 'units', TRIM(ADJUSTL(unit_str))))
2174
2175! ! CALL check(nf90_put_att(ncID, varID, 'long_name', TRIM(ADJUSTL(longNm_str))))
2176
2177! ! CALL check(nf90_put_att(ncID, varID, 'grid_mapping', 'crsWGS84'))
2178
2179! ! idVar(iVar) = varID
2180! ! END DO
2181! ! CALL check(nf90_enddef(ncID))
2182! ! ! End define mode. This tells netCDF we are done defining metadata.
2183
2184! ! ! put all variable values into netCDF datasets
2185! ! ! put time variable in minute:
2186! ! xTime = (dataOutSel(1:nTime, 2, 1) - 1)*24*60 + dataOutSel(1:nTime, 3, 1)*60 + dataOutSel(1:nTime, 4, 1)
2187! ! CALL check(nf90_put_var(ncID, varIDt, xTime))
2188
2189! ! ! put coordinate variables:
2190! ! CALL check(nf90_put_var(ncID, varIDx, varX))
2191! ! CALL check(nf90_put_var(ncID, varIDy, varY))
2192
2193! ! ! put CRS variable:
2194! ! CALL check(nf90_put_var(ncID, varIDCRS, 9999))
2195
2196! ! CALL check(NF90_SYNC(ncID))
2197! ! ! PRINT*, 'good put var'
2198
2199! ! ! put grid_ID:
2200! ! CALL check(nf90_put_var(ncID, varIDGrid, xGridID))
2201! ! ! PRINT*, 'good put varIDGrid',varIDGrid
2202
2203! ! CALL check(NF90_SYNC(ncID))
2204
2205! ! ! then other 3D variables
2206! ! DO iVar = iVarStart, nVar
2207! ! ! reshape dataOutX to be aligned in checker board form
2208! ! varOut = RESHAPE(dataOutSel(1:nTime, iVar, :), (/nX, nY, nTime/), order=(/3, 1, 2/))
2209! ! varOut = varOut(:, nY:1:-1, :)
2210! ! ! get the variable id
2211! ! varID = idVar(iVar)
2212
2213! ! CALL check(nf90_put_var(ncID, varID, varOut))
2214
2215! ! CALL check(NF90_SYNC(ncID))
2216! ! END DO
2217
2218! ! IF (ALLOCATED(varOut)) DEALLOCATE (varOut)
2219! ! IF (ALLOCATED(varSeq0)) DEALLOCATE (varSeq0)
2220! ! IF (ALLOCATED(varSeq)) DEALLOCATE (varSeq)
2221! ! IF (ALLOCATED(xGridID)) DEALLOCATE (xGridID)
2222! ! IF (ALLOCATED(lon)) DEALLOCATE (lon)
2223! ! IF (ALLOCATED(lat)) DEALLOCATE (lat)
2224! ! IF (ALLOCATED(varY)) DEALLOCATE (varY)
2225! ! IF (ALLOCATED(varX)) DEALLOCATE (varX)
2226! ! IF (ALLOCATED(xTime)) DEALLOCATE (xTime)
2227
2228! ! ! Close the file. This frees up any internal netCDF resources
2229! ! ! associated with the file, and flushes any buffers.
2230! ! CALL check(nf90_close(ncID))
2231
2232! ! ! PRINT*, "*** SUCCESS writing netCDF file:"
2233! ! ! PRINT*, FileOut
2234! ! END SUBROUTINE SUEWS_Write_nc
2235
2236! !===========================================================================!
2237! ! convert a vector of grids to a matrix
2238! ! the grid IDs in seqGrid2Sort follow the QGIS convention
2239! ! the spatial matrix arranges successive rows down the page (i.e., north to south)
2240! ! and succesive columns across (i.e., west to east)
2241! ! seqGridSorted stores the grid IDs as aligned in matGrid but squeezed into a vector
2242! !===========================================================================!
2243! SUBROUTINE grid2mat(seqGrid2Sort, seqGridSorted, matGrid, nRow, nCol)
2244
2245! IMPLICIT NONE
2246
2247! INTEGER, DIMENSION(nRow*nCol) :: seqGrid2Sort, seqGridSorted
2248! INTEGER, DIMENSION(nRow, nCol) :: matGrid
2249! INTEGER :: nRow, nCol, i, j, loc
2250
2251! CALL sortGrid(seqGrid2Sort, seqGridSorted, nRow, nCol)
2252! PRINT *, 'old:'
2253! PRINT *, seqGrid2Sort(1:5)
2254! PRINT *, 'sorted:'
2255! PRINT *, seqGridSorted(1:5)
2256! PRINT *, ''
2257! DO i = 1, nRow
2258! DO j = 1, nCol
2259! loc = (i - 1)*nCol + j
2260! matGrid(i, j) = seqGridSorted(loc)
2261! END DO
2262! END DO
2263! END SUBROUTINE grid2mat
2264
2265! !===========================================================================!
2266! ! convert sequence of REAL values to a matrix
2267! ! the grid IDs in seqGrid2Sort follow the QGIS convention
2268! ! the spatial matrix arranges successive rows down the page (i.e., north to south)
2269! ! and succesive columns across (i.e., west to east)
2270! ! seqGridSorted stores the grid IDs as aligned in matGrid but squeezed into a vector
2271! !===========================================================================!
2272! SUBROUTINE seq2mat(seq2Sort, seqSorted, matGrid, nRow, nCol)
2273
2274! IMPLICIT NONE
2275
2276! REAL(KIND(1d0)), DIMENSION(nRow*nCol) :: seq2Sort, seqSorted
2277! REAL(KIND(1d0)), DIMENSION(nRow, nCol) :: matGrid
2278! INTEGER :: nRow, nCol, i, j, loc
2279
2280! CALL sortSeqReal(seq2Sort, seqSorted, nRow, nCol)
2281! PRINT *, 'old:'
2282! PRINT *, seq2Sort(1:5)
2283! PRINT *, 'sorted:'
2284! PRINT *, seqSorted(1:5)
2285! PRINT *, ''
2286! DO i = 1, nRow
2287! DO j = 1, nCol
2288! loc = (i - 1)*nCol + j
2289! matGrid(i, j) = seqSorted(loc)
2290! END DO
2291! END DO
2292! END SUBROUTINE seq2mat
2293
2294! !===========================================================================!
2295! ! sort a sequence of LONG values into the specially aligned sequence per QGIS
2296! !===========================================================================!
2297! SUBROUTINE sortGrid(seqGrid2Sort0, seqGridSorted, nRow, nCol)
2298! USE qsort_c_module
2299! ! convert a vector of grids to a matrix
2300! ! the grid IDs in seqGrid2Sort follow the QGIS convention
2301! ! the spatial matrix arranges successive rows down the page (i.e., north to south)
2302! ! and succesive columns across (i.e., west to east)
2303! ! seqGridSorted stores the grid IDs as aligned in matGrid but squeezed into a vector
2304
2305! IMPLICIT NONE
2306! INTEGER :: nRow, nCol, i = 1, j = 1, xInd, len
2307
2308! INTEGER, DIMENSION(nRow*nCol), INTENT(in) :: seqGrid2Sort0
2309! INTEGER, DIMENSION(nRow*nCol), INTENT(out) :: seqGridSorted
2310! INTEGER, DIMENSION(nRow*nCol) :: seqGrid2Sort, locSorted
2311! INTEGER :: loc
2312! REAL:: ind(nRow*nCol, 2)
2313! REAL, DIMENSION(nRow*nCol) :: seqGrid2SortReal, seqGridSortedReal
2314! REAL :: val
2315
2316! ! number of grids
2317! len = nRow*nCol
2318
2319! !sort the input array to make sure the grid order is in QGIS convention
2320! ! i.e., diagonally ascending
2321! seqGrid2SortReal = seqGrid2Sort0*1.
2322! CALL QsortC(seqGrid2SortReal)
2323! seqGrid2Sort = INT(seqGrid2SortReal)
2324
2325! ! fill in an nRow*nCol array with values to determine sequence
2326! xInd = 1
2327! DO i = 1, nRow
2328! DO j = 1, nCol
2329! ! {row, col, value for sorting, index in new sequence}
2330! ind(xInd, :) = (/i + j + i/(nRow + 1.), xInd*1./)
2331! xInd = xInd + 1
2332! END DO
2333! END DO
2334
2335! ! then sorted ind(:,3) will have the same order as seqGrid2Sort
2336! ! sort ind(:,3)
2337! seqGridSortedReal = ind(:, 1)*1.
2338! CALL QsortC(seqGridSortedReal)
2339! ! print*, 'sorted real:'
2340! ! print*, seqGridSortedReal
2341
2342! ! get index of each element of old sequence in the sorted sequence
2343! DO i = 1, len
2344! ! value in old sequence
2345! ! val=ind(i,3)*1.
2346! val = seqGridSortedReal(i)
2347! DO j = 1, len
2348! IF (val == ind(j, 1)*1.) THEN
2349! ! location in sorted sequence
2350! locSorted(i) = j
2351! END IF
2352! END DO
2353! END DO
2354
2355! ! put elements of old sequence in the sorted order
2356! DO i = 1, len
2357! loc = locSorted(i)
2358! seqGridSorted(loc) = seqGrid2Sort(i)
2359! END DO
2360! seqGridSorted = seqGridSorted(len:1:-1)
2361
2362! END SUBROUTINE sortGrid
2363
2364! !===========================================================================!
2365! ! sort a sequence of REAL values into the specially aligned sequence per QGIS
2366! !===========================================================================!
2367! SUBROUTINE sortSeqReal(seqReal2Sort, seqRealSorted, nRow, nCol)
2368! USE qsort_c_module
2369! ! convert a vector of grids to a matrix
2370! ! the grid IDs in seqReal2Sort follow the QGIS convention
2371! ! the spatial matrix arranges successive rows down the page (i.e., north to south)
2372! ! and succesive columns across (i.e., west to east)
2373! ! seqRealSorted stores the grid IDs as aligned in matGrid but squeezed into a vector
2374
2375! IMPLICIT NONE
2376! INTEGER :: nRow, nCol, i = 1, j = 1, xInd, len
2377
2378! REAL(KIND(1d0)), DIMENSION(nRow*nCol), INTENT(in) :: seqReal2Sort
2379! REAL(KIND(1d0)), DIMENSION(nRow*nCol), INTENT(out) :: seqRealSorted
2380! INTEGER(KIND(1d0)), DIMENSION(nRow*nCol) :: locSorted
2381! INTEGER(KIND(1d0)) :: loc
2382! REAL:: ind(nRow*nCol, 2)
2383! REAL :: seqRealSortedReal(nRow*nCol), val
2384
2385! ! number of grids
2386! len = nRow*nCol
2387
2388! ! fill in an nRow*nCol array with values to determine sequence
2389! xInd = 1
2390! DO i = 1, nRow
2391! DO j = 1, nCol
2392! ! {row, col, value for sorting, index in new sequence}
2393! ind(xInd, :) = (/i + j + i/(nRow + 1.), xInd*1./)
2394! xInd = xInd + 1
2395! END DO
2396! END DO
2397
2398! ! then sorted ind(:,3) will have the same order as seqReal2Sort
2399! ! sort ind(:,3)
2400! seqRealSortedReal = ind(:, 1)*1.
2401! CALL QsortC(seqRealSortedReal)
2402! ! print*, 'sorted real:'
2403! ! print*, seqRealSortedReal
2404
2405! ! get index of each element of old sequence in the sorted sequence
2406! DO i = 1, len
2407! ! value in old sequence
2408! ! val=ind(i,3)*1.
2409! val = seqRealSortedReal(i)
2410! DO j = 1, len
2411! IF (val == ind(j, 1)*1.) THEN
2412! ! location in sorted sequence
2413! locSorted(i) = j
2414! END IF
2415! END DO
2416! END DO
2417
2418! ! put elements of old sequence in the sorted order
2419! DO i = 1, len
2420! loc = locSorted(i)
2421! seqRealSorted(loc) = seqReal2Sort(i)
2422! END DO
2423! seqRealSorted = seqRealSorted(len:1:-1)
2424
2425! END SUBROUTINE sortSeqReal
2426
2427! !===========================================================================!
2428! ! a wrapper for checking netCDF status
2429! !===========================================================================!
2430
2431! SUBROUTINE check(status)
2432! USE netcdf
2433! IMPLICIT NONE
2434
2435! INTEGER, INTENT(in) :: status
2436
2437! IF (status /= nf90_noerr) THEN
2438! PRINT *, TRIM(nf90_strerror(status))
2439! STOP "Stopped"
2440! END IF
2441! END SUBROUTINE check
2442! #endif
2443
2444END MODULE ctrl_output
real(kind(1d0)), dimension(:, :, :), allocatable dataoutehc
real(kind(1d0)), dimension(:, :, :), allocatable dataoutspartacus
integer, parameter ncolumnsdataoutbl
real(kind(1d0)), dimension(:, :, :), allocatable dataoutsnow
integer, parameter ncolumnsdataoutsuews
integer, parameter ncolumnsdataoutestm
real(kind(1d0)), dimension(:, :, :), allocatable dataoutdebug
integer, parameter ncolumnsdataoutbeers
integer, parameter ncolumnsdataoutspartacus
integer, parameter ncolumnsdataoutrsl
integer, dimension(:), allocatable grididmatrix
integer, parameter ncolumnsdataoutsnow
real(kind(1d0)), dimension(:, :, :), allocatable dataoutrsl
real(kind(1d0)), dimension(:, :, :), allocatable dataoutsuews
integer, parameter ncolumnsdataoutdailystate
integer, parameter ncolumnsdataoutehc
real(kind(1d0)), dimension(:, :, :), allocatable dataoutbl
real(kind(1d0)), dimension(:, :, :), allocatable dataoutdailystate
real(kind(1d0)), dimension(:, :, :), allocatable dataoutestm
real(kind(1d0)), dimension(:, :, :), allocatable dataoutbeers
integer, parameter ncolumnsdataoutdebug
type(varattr), dimension(1200) varlistall
character(len=10), parameter f94
character(len=10), parameter f106
character(len=10), parameter fy
character(len=10), parameter ft
subroutine suews_output(irmax, iv, gridiv, iyr)
subroutine suews_write_txt(dataoutx, varlist, iyr, gridiv, outlevel)
subroutine unique(vec, vec_unique)
character(len=10), parameter f146
character(len=1), parameter as
character(len=1), parameter at
subroutine suews_output_init(dataoutx, varlist, iyr, gridiv, outlevel)
character(len=3) itext
character(len=10), parameter f104
logical function initq_file(filename)
subroutine suews_output_agg(dataout_agg, dataoutx, varlist, irmax, outfreq_s)
character(len=10), parameter fd
character(len=1), parameter aa
subroutine suews_output_txt_grp(iv, irmax, iyr, varlistx, gridiv, outlevel, outfreq_s)
subroutine filename_gen(dataoutx, varlist, iyr, gridiv, fileoutx, opt_fmt)
integer function count_lines(filename)
character(len=1), parameter al
subroutine formatfile_gen(dataoutx, varlist, iyr, gridiv, outlevel)
character(len=20) filecode
character(len=150) fileoutputpath
integer resolutionfilesout
integer writeoutoption
integer keeptstepfilesout
integer storageheatmethod
subroutine parse(str, delims, args, nargs)