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('deltaLAI', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
404 varattr('LAIlumps', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
405 varattr('AlbSnow', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
406 varattr('DensSnow_Paved', 'to be added', f146, 'to be added', al, 'DailyState', 0), &
407 varattr('DensSnow_Bldgs', 'to be added', f146, 'to be added', al, 'DailyState', 0), &
408 varattr('DensSnow_EveTr', 'to be added', f146, 'to be added', al, 'DailyState', 0), &
409 varattr('DensSnow_DecTr', 'to be added', f146, 'to be added', al, 'DailyState', 0), &
410 varattr('DensSnow_Grass', 'to be added', f146, 'to be added', al, 'DailyState', 0), &
411 varattr('DensSnow_BSoil', 'to be added', f146, 'to be added', al, 'DailyState', 0), &
412 varattr('DensSnow_Water', 'to be added', f146, 'to be added', al, 'DailyState', 0), &
413 varattr('a1', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
414 varattr('a2', 'to be added', f104, 'to be added', al, 'DailyState', 0), &
415 varattr('a3', 'to be added', f104, 'to be added', al, 'DailyState', 0) &
416 /
417
418 ! RSL profiles
419 DATA(varlistall(n), &
423 + 1, &
427 + ncolumnsdataoutrsl - 5)/ &
428 varattr('z_1', 'm', f104, '0.1Zh', aa, 'RSL', 0), &
429 varattr('z_2', 'm', f104, '0.2Zh', aa, 'RSL', 0), &
430 varattr('z_3', 'm', f104, '0.3Zh', aa, 'RSL', 0), &
431 varattr('z_4', 'm', f104, '0.4Zh', aa, 'RSL', 0), &
432 varattr('z_5', 'm', f104, '0.5Zh', aa, 'RSL', 0), &
433 varattr('z_6', 'm', f104, '0.6Zh', aa, 'RSL', 0), &
434 varattr('z_7', 'm', f104, '0.7Zh', aa, 'RSL', 0), &
435 varattr('z_8', 'm', f104, '0.8Zh', aa, 'RSL', 0), &
436 varattr('z_9', 'm', f104, '0.9Zh', aa, 'RSL', 0), &
437 varattr('z_10', 'm', f104, 'Zh', aa, 'RSL', 0), &
438 varattr('z_11', 'm', f104, '1.1Zh', aa, 'RSL', 0), &
439 varattr('z_12', 'm', f104, '1.2Zh', aa, 'RSL', 0), &
440 varattr('z_13', 'm', f104, '1.3Zh', aa, 'RSL', 0), &
441 varattr('z_14', 'm', f146, '1.4Zh', aa, 'RSL', 0), &
442 varattr('z_15', 'm', f104, '1.5Zh', aa, 'RSL', 0), &
443 varattr('z_16', 'm', f104, '1.6Zh', aa, 'RSL', 0), &
444 varattr('z_17', 'm', f104, '1.7Zh', aa, 'RSL', 0), &
445 varattr('z_18', 'm', f104, '1.8Zh', aa, 'RSL', 0), &
446 varattr('z_19', 'm', f104, '1.9Zh', aa, 'RSL', 0), &
447 varattr('z_20', 'm', f104, '2.0Zh', aa, 'RSL', 0), &
448 varattr('z_21', 'm', f146, '2.1Zh', aa, 'RSL', 0), &
449 varattr('z_22', 'm', f104, '2.2Zh', aa, 'RSL', 0), &
450 varattr('z_23', 'm', f104, '2.3Zh', aa, 'RSL', 0), &
451 varattr('z_24', 'm', f104, '2.4Zh', aa, 'RSL', 0), &
452 varattr('z_25', 'm', f104, '2.5Zh', aa, 'RSL', 0), &
453 varattr('z_26', 'm', f104, '2.6Zh', aa, 'RSL', 0), &
454 varattr('z_27', 'm', f104, '2.7Zh', aa, 'RSL', 0), &
455 varattr('z_28', 'm', f104, '2.8Zh', aa, 'RSL', 0), &
456 varattr('z_29', 'm', f104, '2.9Zh', aa, 'RSL', 0), &
457 varattr('z_30', 'm', f104, '3.0Zh', aa, 'RSL', 0), &
458 varattr('U_1', 'm s-1', f104, 'U at 0.1Zh', aa, 'RSL', 0), &
459 varattr('U_2', 'm s-1', f104, 'U at 0.2Zh', aa, 'RSL', 0), &
460 varattr('U_3', 'm s-1', f104, 'U at 0.3Zh', aa, 'RSL', 0), &
461 varattr('U_4', 'm s-1', f104, 'U at 0.4Zh', aa, 'RSL', 0), &
462 varattr('U_5', 'm s-1', f104, 'U at 0.5Zh', aa, 'RSL', 0), &
463 varattr('U_6', 'm s-1', f104, 'U at 0.6Zh', aa, 'RSL', 0), &
464 varattr('U_7', 'm s-1', f104, 'U at 0.7Zh', aa, 'RSL', 0), &
465 varattr('U_8', 'm s-1', f104, 'U at 0.8Zh', aa, 'RSL', 0), &
466 varattr('U_9', 'm s-1', f104, 'U at 0.9Zh', aa, 'RSL', 0), &
467 varattr('U_10', 'm s-1', f104, 'U at Zh', aa, 'RSL', 0), &
468 varattr('U_11', 'm s-1', f104, 'U at 1.1Zh', aa, 'RSL', 0), &
469 varattr('U_12', 'm s-1', f104, 'U at 1.2Zh', aa, 'RSL', 0), &
470 varattr('U_13', 'm s-1', f104, 'U at 1.3Zh', aa, 'RSL', 0), &
471 varattr('U_14', 'm s-1', f146, 'U at 1.4Zh', aa, 'RSL', 0), &
472 varattr('U_15', 'm s-1', f104, 'U at 1.5Zh', aa, 'RSL', 0), &
473 varattr('U_16', 'm s-1', f104, 'U at 1.6Zh', aa, 'RSL', 0), &
474 varattr('U_17', 'm s-1', f104, 'U at 1.7Zh', aa, 'RSL', 0), &
475 varattr('U_18', 'm s-1', f104, 'U at 1.8Zh', aa, 'RSL', 0), &
476 varattr('U_19', 'm s-1', f104, 'U at 1.9Zh', aa, 'RSL', 0), &
477 varattr('U_20', 'm s-1', f104, 'U at 2.0Zh', aa, 'RSL', 0), &
478 varattr('U_21', 'm s-1', f146, 'U at 2.1Zh', aa, 'RSL', 0), &
479 varattr('U_22', 'm s-1', f104, 'U at 2.2Zh', aa, 'RSL', 0), &
480 varattr('U_23', 'm s-1', f104, 'U at 2.3Zh', aa, 'RSL', 0), &
481 varattr('U_24', 'm s-1', f104, 'U at 2.4Zh', aa, 'RSL', 0), &
482 varattr('U_25', 'm s-1', f104, 'U at 2.5Zh', aa, 'RSL', 0), &
483 varattr('U_26', 'm s-1', f104, 'U at 2.6Zh', aa, 'RSL', 0), &
484 varattr('U_27', 'm s-1', f104, 'U at 2.7Zh', aa, 'RSL', 0), &
485 varattr('U_28', 'm s-1', f104, 'U at 2.8Zh', aa, 'RSL', 0), &
486 varattr('U_29', 'm s-1', f104, 'U at 2.9Zh', aa, 'RSL', 0), &
487 varattr('U_30', 'm s-1', f104, 'U at 3.0Zh', aa, 'RSL', 0), &
488 varattr('T_1', 'degC', f104, 'T at 0.1Zh', aa, 'RSL', 0), &
489 varattr('T_2', 'degC', f104, 'T at 0.2Zh', aa, 'RSL', 0), &
490 varattr('T_3', 'degC', f104, 'T at 0.3Zh', aa, 'RSL', 0), &
491 varattr('T_4', 'degC', f104, 'T at 0.4Zh', aa, 'RSL', 0), &
492 varattr('T_5', 'degC', f104, 'T at 0.5Zh', aa, 'RSL', 0), &
493 varattr('T_6', 'degC', f104, 'T at 0.6Zh', aa, 'RSL', 0), &
494 varattr('T_7', 'degC', f104, 'T at 0.7Zh', aa, 'RSL', 0), &
495 varattr('T_8', 'degC', f104, 'T at 0.8Zh', aa, 'RSL', 0), &
496 varattr('T_9', 'degC', f104, 'T at 0.9Zh', aa, 'RSL', 0), &
497 varattr('T_10', 'degC', f104, 'T at Zh', aa, 'RSL', 0), &
498 varattr('T_11', 'degC', f104, 'T at 1.1Zh', aa, 'RSL', 0), &
499 varattr('T_12', 'degC', f104, 'T at 1.2Zh', aa, 'RSL', 0), &
500 varattr('T_13', 'degC', f104, 'T at 1.3Zh', aa, 'RSL', 0), &
501 varattr('T_14', 'degC', f146, 'T at 1.4Zh', aa, 'RSL', 0), &
502 varattr('T_15', 'degC', f104, 'T at 1.5Zh', aa, 'RSL', 0), &
503 varattr('T_16', 'degC', f104, 'T at 1.6Zh', aa, 'RSL', 0), &
504 varattr('T_17', 'degC', f104, 'T at 1.7Zh', aa, 'RSL', 0), &
505 varattr('T_18', 'degC', f104, 'T at 1.8Zh', aa, 'RSL', 0), &
506 varattr('T_19', 'degC', f104, 'T at 1.9Zh', aa, 'RSL', 0), &
507 varattr('T_20', 'degC', f104, 'T at 2.0Zh', aa, 'RSL', 0), &
508 varattr('T_21', 'degC', f146, 'T at 2.1Zh', aa, 'RSL', 0), &
509 varattr('T_22', 'degC', f104, 'T at 2.2Zh', aa, 'RSL', 0), &
510 varattr('T_23', 'degC', f104, 'T at 2.3Zh', aa, 'RSL', 0), &
511 varattr('T_24', 'degC', f104, 'T at 2.4Zh', aa, 'RSL', 0), &
512 varattr('T_25', 'degC', f104, 'T at 2.5Zh', aa, 'RSL', 0), &
513 varattr('T_26', 'degC', f104, 'T at 2.6Zh', aa, 'RSL', 0), &
514 varattr('T_27', 'degC', f104, 'T at 2.7Zh', aa, 'RSL', 0), &
515 varattr('T_28', 'degC', f104, 'T at 2.8Zh', aa, 'RSL', 0), &
516 varattr('T_29', 'degC', f104, 'T at 2.9Zh', aa, 'RSL', 0), &
517 varattr('T_30', 'degC', f104, 'T at 3.0Zh', aa, 'RSL', 0), &
518 varattr('q_1', 'g kg-1', f104, 'q at 0.1Zh', aa, 'RSL', 0), &
519 varattr('q_2', 'g kg-1', f104, 'q at 0.2Zh', aa, 'RSL', 0), &
520 varattr('q_3', 'g kg-1', f104, 'q at 0.3Zh', aa, 'RSL', 0), &
521 varattr('q_4', 'g kg-1', f104, 'q at 0.4Zh', aa, 'RSL', 0), &
522 varattr('q_5', 'g kg-1', f104, 'q at 0.5Zh', aa, 'RSL', 0), &
523 varattr('q_6', 'g kg-1', f104, 'q at 0.6Zh', aa, 'RSL', 0), &
524 varattr('q_7', 'g kg-1', f104, 'q at 0.7Zh', aa, 'RSL', 0), &
525 varattr('q_8', 'g kg-1', f104, 'q at 0.8Zh', aa, 'RSL', 0), &
526 varattr('q_9', 'g kg-1', f104, 'q at 0.9Zh', aa, 'RSL', 0), &
527 varattr('q_10', 'g kg-1', f104, 'q at Zh', aa, 'RSL', 0), &
528 varattr('q_11', 'g kg-1', f104, 'q at 1.1Zh', aa, 'RSL', 0), &
529 varattr('q_12', 'g kg-1', f104, 'q at 1.2Zh', aa, 'RSL', 0), &
530 varattr('q_13', 'g kg-1', f104, 'q at 1.3Zh', aa, 'RSL', 0), &
531 varattr('q_14', 'g kg-1', f146, 'q at 1.4Zh', aa, 'RSL', 0), &
532 varattr('q_15', 'g kg-1', f104, 'q at 1.5Zh', aa, 'RSL', 0), &
533 varattr('q_16', 'g kg-1', f104, 'q at 1.6Zh', aa, 'RSL', 0), &
534 varattr('q_17', 'g kg-1', f104, 'q at 1.7Zh', aa, 'RSL', 0), &
535 varattr('q_18', 'g kg-1', f104, 'q at 1.8Zh', aa, 'RSL', 0), &
536 varattr('q_19', 'g kg-1', f104, 'q at 1.9Zh', aa, 'RSL', 0), &
537 varattr('q_20', 'g kg-1', f104, 'q at 2.0Zh', aa, 'RSL', 0), &
538 varattr('q_21', 'g kg-1', f146, 'q at 2.1Zh', aa, 'RSL', 0), &
539 varattr('q_22', 'g kg-1', f104, 'q at 2.2Zh', aa, 'RSL', 0), &
540 varattr('q_23', 'g kg-1', f104, 'q at 2.3Zh', aa, 'RSL', 0), &
541 varattr('q_24', 'g kg-1', f104, 'q at 2.4Zh', aa, 'RSL', 0), &
542 varattr('q_25', 'g kg-1', f104, 'q at 2.5Zh', aa, 'RSL', 0), &
543 varattr('q_26', 'g kg-1', f104, 'q at 2.6Zh', aa, 'RSL', 0), &
544 varattr('q_27', 'g kg-1', f104, 'q at 2.7Zh', aa, 'RSL', 0), &
545 varattr('q_28', 'g kg-1', f104, 'q at 2.8Zh', aa, 'RSL', 0), &
546 varattr('q_29', 'g kg-1', f104, 'q at 2.9Zh', aa, 'RSL', 0), &
547 varattr('q_30', 'g kg-1', f104, 'q at 3.0Zh', aa, 'RSL', 0), &
548 ! debug info
549 ! varAttr('L_stab', 'm', f104, 'threshold of Obukhob length under stable conditions', aA, 'RSL', 0), &
550 ! varAttr('L_unstab', 'm', f104, 'threshold of Obukhob length under unstable conditions', aA, 'RSL', 0), &
551 varattr('L_MOD_RSL', 'm', f104, 'Obukhob length', aa, 'RSL', 0), &
552 varattr('zH_RSL', 'm', f104, 'canyon depth', aa, 'RSL', 0), &
553 ! varAttr('Lc_stab', 'm', f104, 'threshold of canopy drag length scale under stable conditions', aA, 'RSL', 0), &
554 ! varAttr('Lc_unstab', 'm', f104, 'threshold of canopy drag length scale under unstable conditions', aA, 'RSL', 0), &
555 varattr('Lc', 'm', f104, 'canopy drag length scale', aa, 'RSL', 0), &
556 varattr('beta', 'm', f104, 'beta coefficient from Harman 2012', aa, 'RSL', 0), &
557 varattr('zd_RSL', 'm', f104, 'displacement height', aa, 'RSL', 0), &
558 varattr('z0_RSL', 'm', f104, 'roughness length', aa, 'RSL', 0), &
559 varattr('elm', 'm', f104, 'mixing length', aa, 'RSL', 0), &
560 varattr('Scc', '-', f104, 'Schmidt number for temperature and humidity', aa, 'RSL', 0), &
561 varattr('f', 'g kg-1', f104, 'H&F07 and H&F08 constants', aa, 'RSL', 0), &
562 varattr('UStar_RSL', 'm s-1', f104, 'friction velocity used in RSL', aa, 'RSL', 0), &
563 varattr('UStar_heat', 'm s-1', f104, 'friction velocity implied by RA_h', aa, 'RSL', 0), &
564 varattr('TStar_RSL', 'K', f104, 'friction temperature used in RSL', aa, 'RSL', 0), &
565 varattr('FAI', '-', f104, 'frontal area index', aa, 'RSL', 0), &
566 varattr('PAI', '-', f104, 'plan area index', aa, 'RSL', 0), &
567 varattr('flag_RSL', '-', f104, 'flag for RSL', aa, 'RSL', 0) &
568 /
569
570 ! debug info
571 DATA(varlistall(n), &
575 + ncolumnsdataoutrsl - 5 &
576 + 1, &
580 + ncolumnsdataoutrsl - 5 &
582 )/ &
583 varattr('Tsfc_Paved', 'degC', f104, 'surface temperature for paved surface', aa, 'debug', 0), &
584 varattr('Tsfc_Bldgs', 'degC', f104, 'surface temperature for building surface', aa, 'debug', 0), &
585 varattr('Tsfc_EveTr', 'degC', f104, 'surface temperature for evergreen tree surface', aa, 'debug', 0), &
586 varattr('Tsfc_DecTr', 'degC', f104, 'surface temperature for deciduous tree surface', aa, 'debug', 0), &
587 varattr('Tsfc_Grass', 'degC', f104, 'surface temperature for grass surface', aa, 'debug', 0), &
588 varattr('Tsfc_BSoil', 'degC', f104, 'surface temperature for bare soil surface', aa, 'debug', 0), &
589 varattr('Tsfc_Water', 'degC', f104, 'surface temperature for water surface', aa, 'debug', 0), &
590 varattr('QN_Paved', 'W m-2', f104, 'Net all-wave radiation for paved surface', aa, 'debug', 0), &
591 varattr('QN_Bldgs', 'W m-2', f104, 'Net all-wave radiation for building surface', aa, 'debug', 0), &
592 varattr('QN_EveTr', 'W m-2', f104, 'Net all-wave radiation for evergreen tree surface', aa, 'debug', 0), &
593 varattr('QN_DecTr', 'W m-2', f104, 'Net all-wave radiation for deciduous tree surface', aa, 'debug', 0), &
594 varattr('QN_Grass', 'W m-2', f104, 'Net all-wave radiation for grass surface', aa, 'debug', 0), &
595 varattr('QN_BSoil', 'W m-2', f104, 'Net all-wave radiation for bare soil surface', aa, 'debug', 0), &
596 varattr('QN_Water', 'W m-2', f104, 'Net all-wave radiation for water surface', aa, 'debug', 0), &
597 varattr('QS_Paved', 'W m-2', f104, 'Storage heat flux for paved surface', aa, 'debug', 0), &
598 varattr('QS_Bldgs', 'W m-2', f104, 'Storage heat flux for building surface', aa, 'debug', 0), &
599 varattr('QS_EveTr', 'W m-2', f104, 'Storage heat flux for evergreen tree surface', aa, 'debug', 0), &
600 varattr('QS_DecTr', 'W m-2', f104, 'Storage heat flux for deciduous tree surface', aa, 'debug', 0), &
601 varattr('QS_Grass', 'W m-2', f104, 'Storage heat flux for grass surface', aa, 'debug', 0), &
602 varattr('QS_BSoil', 'W m-2', f104, 'Storage heat flux for bare soil surface', aa, 'debug', 0), &
603 varattr('QS_Water', 'W m-2', f104, 'Storage heat flux for water surface', aa, 'debug', 0), &
604 varattr('QE0_Paved', 'W m-2', f104, 'latent heat flux from PM for paved surface', aa, 'debug', 0), &
605 varattr('QE0_Bldgs', 'W m-2', f104, 'latent heat flux from PM for building surface', aa, 'debug', 0), &
606 varattr('QE0_EveTr', 'W m-2', f104, 'latent heat flux from PM for evergreen tree surface', aa, 'debug', 0), &
607 varattr('QE0_DecTr', 'W m-2', f104, 'latent heat flux from PM for deciduous tree surface', aa, 'debug', 0), &
608 varattr('QE0_Grass', 'W m-2', f104, 'latent heat flux from PM for grass surface', aa, 'debug', 0), &
609 varattr('QE0_BSoil', 'W m-2', f104, 'latent heat flux from PM for bare soil surface', aa, 'debug', 0), &
610 varattr('QE0_Water', 'W m-2', f104, 'latent heat flux from PM for water surface', aa, 'debug', 0), &
611 varattr('QE_Paved', 'W m-2', f104, 'latent heat flux for paved surface', aa, 'debug', 0), &
612 varattr('QE_Bldgs', 'W m-2', f104, 'latent heat flux for building surface', aa, 'debug', 0), &
613 varattr('QE_EveTr', 'W m-2', f104, 'latent heat flux for evergreen tree surface', aa, 'debug', 0), &
614 varattr('QE_DecTr', 'W m-2', f104, 'latent heat flux for deciduous tree surface', aa, 'debug', 0), &
615 varattr('QE_Grass', 'W m-2', f104, 'latent heat flux for grass surface', aa, 'debug', 0), &
616 varattr('QE_BSoil', 'W m-2', f104, 'latent heat flux for bare soil surface', aa, 'debug', 0), &
617 varattr('QE_Water', 'W m-2', f104, 'latent heat flux for water surface', aa, 'debug', 0), &
618 varattr('QH_Paved', 'W m-2', f104, 'Sensible heat flux for paved surface', aa, 'debug', 0), &
619 varattr('QH_Bldgs', 'W m-2', f104, 'Sensible heat flux for building surface', aa, 'debug', 0), &
620 varattr('QH_EveTr', 'W m-2', f104, 'Sensible heat flux for evergreen tree surface', aa, 'debug', 0), &
621 varattr('QH_DecTr', 'W m-2', f104, 'Sensible heat flux for deciduous tree surface', aa, 'debug', 0), &
622 varattr('QH_Grass', 'W m-2', f104, 'Sensible heat flux for grass surface', aa, 'debug', 0), &
623 varattr('QH_BSoil', 'W m-2', f104, 'Sensible heat flux for bare soil surface', aa, 'debug', 0), &
624 varattr('QH_Water', 'W m-2', f104, 'Sensible heat flux for water surface', aa, 'debug', 0), &
625 varattr('wu_Paved', 'mm', f104, 'Water use for paved surface', aa, 'debug', 0), &
626 varattr('wu_Bldgs', 'mm', f104, 'Water use for building surface', aa, 'debug', 0), &
627 varattr('wu_EveTr', 'mm', f104, 'Water use for evergreen tree surface', aa, 'debug', 0), &
628 varattr('wu_DecTr', 'mm', f104, 'Water use for deciduous tree surface', aa, 'debug', 0), &
629 varattr('wu_Grass', 'mm', f104, 'Water use for grass surface', aa, 'debug', 0), &
630 varattr('wu_BSoil', 'mm', f104, 'Water use for bare soil surface', aa, 'debug', 0), &
631 varattr('wu_Water', 'mm', f104, 'Water use for water surface', aa, 'debug', 0), &
632 varattr('ev0_Paved', 'mm', f104, 'Evapotranspiration from PM for paved surface', aa, 'debug', 0), &
633 varattr('ev0_Bldgs', 'mm', f104, 'Evapotranspiration from PM for building surface', aa, 'debug', 0), &
634 varattr('ev0_EveTr', 'mm', f104, 'Evapotranspiration from PM for evergreen tree surface', aa, 'debug', 0), &
635 varattr('ev0_DecTr', 'mm', f104, 'Evapotranspiration from PM for deciduous tree surface', aa, 'debug', 0), &
636 varattr('ev0_Grass', 'mm', f104, 'Evapotranspiration from PM for grass surface', aa, 'debug', 0), &
637 varattr('ev0_BSoil', 'mm', f104, 'Evapotranspiration from PM for bare soil surface', aa, 'debug', 0), &
638 varattr('ev0_Water', 'mm', f104, 'Evapotranspiration from PM for water surface', aa, 'debug', 0), &
639 varattr('ev_Paved', 'mm', f104, 'Evapotranspiration from PM for paved surface', aa, 'debug', 0), &
640 varattr('ev_Bldgs', 'mm', f104, 'Evapotranspiration for building surface', aa, 'debug', 0), &
641 varattr('ev_EveTr', 'mm', f104, 'Evapotranspiration for evergreen tree surface', aa, 'debug', 0), &
642 varattr('ev_DecTr', 'mm', f104, 'Evapotranspiration for deciduous tree surface', aa, 'debug', 0), &
643 varattr('ev_Grass', 'mm', f104, 'Evapotranspiration for grass surface', aa, 'debug', 0), &
644 varattr('ev_BSoil', 'mm', f104, 'Evapotranspiration for bare soil surface', aa, 'debug', 0), &
645 varattr('ev_Water', 'mm', f104, 'Evapotranspiration for water surface', aa, 'debug', 0), &
646 varattr('drain_Paved', 'mm', f104, 'Drainage for paved surface', aa, 'debug', 0), &
647 varattr('drain_Bldgs', 'mm', f104, 'Drainage for building surface', aa, 'debug', 0), &
648 varattr('drain_EveTr', 'mm', f104, 'Drainage for evergreen tree surface', aa, 'debug', 0), &
649 varattr('drain_DecTr', 'mm', f104, 'Drainage for deciduous tree surface', aa, 'debug', 0), &
650 varattr('drain_Grass', 'mm', f104, 'Drainage for grass surface', aa, 'debug', 0), &
651 varattr('drain_BSoil', 'mm', f104, 'Drainage for bare soil surface', aa, 'debug', 0), &
652 varattr('drain_Water', 'mm', f104, 'Drainage for water surface', aa, 'debug', 0), &
653 varattr('st_Paved_prev', 'mm', f104, 'surface wetness (prev) for paved surface', aa, 'debug', 0), &
654 varattr('st_Bldgs_prev', 'mm', f104, 'surface wetness (prev) for building surface', aa, 'debug', 0), &
655 varattr('st_EveTr_prev', 'mm', f104, 'surface wetness (prev) for evergreen tree surface', aa, 'debug', 0), &
656 varattr('st_DecTr_prev', 'mm', f104, 'surface wetness (prev) for deciduous tree surface', aa, 'debug', 0), &
657 varattr('st_Grass_prev', 'mm', f104, 'surface wetness (prev) for grass surface', aa, 'debug', 0), &
658 varattr('st_BSoil_prev', 'mm', f104, 'surface wetness (prev) for bare soil surface', aa, 'debug', 0), &
659 varattr('st_Water_prev', 'mm', f104, 'surface wetness (prev) for water surface', aa, 'debug', 0), &
660 varattr('st_Paved_next', 'mm', f104, 'surface wetness (next) for paved surface', aa, 'debug', 0), &
661 varattr('st_Bldgs_next', 'mm', f104, 'surface wetness (next) for building surface', aa, 'debug', 0), &
662 varattr('st_EveTr_next', 'mm', f104, 'surface wetness (next) for evergreen tree surface', aa, 'debug', 0), &
663 varattr('st_DecTr_next', 'mm', f104, 'surface wetness (next) for deciduous tree surface', aa, 'debug', 0), &
664 varattr('st_Grass_next', 'mm', f104, 'surface wetness (next) for grass surface', aa, 'debug', 0), &
665 varattr('st_BSoil_next', 'mm', f104, 'surface wetness (next) for bare soil surface', aa, 'debug', 0), &
666 varattr('st_Water_next', 'mm', f104, 'surface wetness (next) for water surface', aa, 'debug', 0), &
667 varattr('ss_Paved_prev', 'mm', f104, 'soil store (prev) for paved surface', aa, 'debug', 0), &
668 varattr('ss_Bldgs_prev', 'mm', f104, 'soil store (prev) for building surface', aa, 'debug', 0), &
669 varattr('ss_EveTr_prev', 'mm', f104, 'soil store (prev) for evergreen tree surface', aa, 'debug', 0), &
670 varattr('ss_DecTr_prev', 'mm', f104, 'soil store (prev) for deciduous tree surface', aa, 'debug', 0), &
671 varattr('ss_Grass_prev', 'mm', f104, 'soil store (prev) for grass surface', aa, 'debug', 0), &
672 varattr('ss_BSoil_prev', 'mm', f104, 'soil store (prev) for bare soil surface', aa, 'debug', 0), &
673 varattr('ss_Water_prev', 'mm', f104, 'soil store (prev) for water surface', aa, 'debug', 0), &
674 varattr('ss_Paved_next', 'mm', f104, 'soil store (next) for paved surface', aa, 'debug', 0), &
675 varattr('ss_Bldgs_next', 'mm', f104, 'soil store (next) for building surface', aa, 'debug', 0), &
676 varattr('ss_EveTr_next', 'mm', f104, 'soil store (next) for evergreen tree surface', aa, 'debug', 0), &
677 varattr('ss_DecTr_next', 'mm', f104, 'soil store (next) for deciduous tree surface', aa, 'debug', 0), &
678 varattr('ss_Grass_next', 'mm', f104, 'soil store (next) for grass surface', aa, 'debug', 0), &
679 varattr('ss_BSoil_next', 'mm', f104, 'soil store (next) for bare soil surface', aa, 'debug', 0), &
680 varattr('ss_Water_next', 'mm', f104, 'soil store (next) for water surface', aa, 'debug', 0), &
681 varattr('RS', 's m-1', f104, 'RS', aa, 'debug', 0), &
682 varattr('RA', 's m-1', f104, 'RA', aa, 'debug', 0), &
683 varattr('RB', 's m-1', f104, 'RB', aa, 'debug', 0), &
684 varattr('RAsnow', 's m-1', f104, 'RA for snow', aa, 'debug', 0), &
685 varattr('RSS_Paved', 's m-1', f104, 'Wetness-corrected surface conductance for paved surface', aa, 'debug', 0), &
686 varattr('RSS_Bldgs', 's m-1', f104, 'Wetness-corrected surface conductance for building surface', aa, 'debug', 0), &
687 varattr('RSS_EveTr', 's m-1', f104, 'Wetness-corrected surface conductance for evergreen tree surface', aa, 'debug', 0), &
688 varattr('RSS_DecTr', 's m-1', f104, 'Wetness-corrected surface conductance for deciduous tree surface', aa, 'debug', 0), &
689 varattr('RSS_Grass', 's m-1', f104, 'Wetness-corrected surface conductance for grass surface', aa, 'debug', 0), &
690 varattr('RSS_BSoil', 's m-1', f104, 'Wetness-corrected surface conductance for bare soil surface', aa, 'debug', 0), &
691 varattr('RSS_Water', 's m-1', f104, 'Wetness-corrected surface conductance for water surface', aa, 'debug', 0), &
692 varattr('vpd_hPa', 'hPa', f104, 'vapour pressure deficit', aa, 'debug', 0), &
693 varattr('lv_J_kg', 'J kg-1', f104, 'latent heat of vaporisation', aa, 'debug', 0), &
694 varattr('avdens', 'kg m-3', f104, 'air density', aa, 'debug', 0), &
695 varattr('avcp', 'm', f104, 'air heat capacity at constant pressure', aa, 'debug', 0), &
696 varattr('s_hPa', 'm', f104, 'Vapour pressure versus temperature slope in PM', aa, 'debug', 0), &
697 varattr('psyc_hPa', 'm', f104, 'Psychometric constant', aa, 'debug', 0), &
698 ! varAttr('qn_av', 'm', f104, 'qn_av', aA, 'debug', 0), &
699 varattr('iter', '-', f104, 'qn_av', as, 'debug', 0), &
700 varattr('dqndt', 'm', f104, 'dqndt', aa, 'debug', 0) &
701 /
702
703 ! SPARTACUS info
704 DATA(varlistall(n), &
708 + ncolumnsdataoutrsl - 5 &
710 + 1, &
714 + ncolumnsdataoutrsl - 5 &
717 )/ &
718 varattr('alb', '-', f104, 'bulk albedo from spartacus', aa, 'SPARTACUS', 0), &
719 varattr('emis', '-', f104, 'bulk emissivity from spartacus', aa, 'SPARTACUS', 0), &
720 varattr('KTopDnDir', 'W m-2', f104, 'sw downwelling direct radiation at top-of-canopy', aa, 'SPARTACUS', 0), &
721 varattr('Kup', 'W m-2', f104, 'bulk albedo from spartacus', aa, 'SPARTACUS', 0), &
722 varattr('LTopDn', 'W m-2', f104, 'lw downwelling radiation at top-of-canopy', aa, 'SPARTACUS', 0), &
723 varattr('Lup', 'W m-2', f104, 'lw upward flux from spartacus', aa, 'SPARTACUS', 0), &
724 varattr('Qn', 'W m-2', f104, 'net all-wave radiation from spartacus', aa, 'SPARTACUS', 0), &
725 varattr('KTopNet', 'W m-2', f104, 'sw net radiation at top-of-canopy', aa, 'SPARTACUS', 0), &
726 varattr('LTopNet', 'W m-2', f104, 'lw net radiation at top-of-canopy', aa, 'SPARTACUS', 0), &
727 varattr('Lemission', 'W m-2', f104, 'lw emission from spartacus', aa, 'SPARTACUS', 0), &
728 varattr('KDnDir_Grnd', 'W m-2', f104, 'sw downwelling direct radiation at ground', aa, 'SPARTACUS', 0), &
729 varattr('KVtlDif_Grnd', 'W m-2', f104, 'sw diffuse flux at ground into a vertical surface', aa, 'SPARTACUS', 0), &
730 varattr('KNet_Grnd', 'W m-2', f104, 'sw net radiation at ground', aa, 'SPARTACUS', 0), &
731 varattr('LNet_Grnd', 'W m-2', f104, 'lw net radiation at ground', aa, 'SPARTACUS', 0), &
732 varattr('KIn_Roof_1', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 1', aa, 'SPARTACUS', 0), &
733 varattr('KIn_Roof_2', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 2', aa, 'SPARTACUS', 0), &
734 varattr('KIn_Roof_3', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 3', aa, 'SPARTACUS', 0), &
735 varattr('KIn_Roof_4', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 4', aa, 'SPARTACUS', 0), &
736 varattr('KIn_Roof_5', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 5', aa, 'SPARTACUS', 0), &
737 varattr('KIn_Roof_6', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 6', aa, 'SPARTACUS', 0), &
738 varattr('KIn_Roof_7', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 7', aa, 'SPARTACUS', 0), &
739 varattr('KIn_Roof_8', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 8', aa, 'SPARTACUS', 0), &
740 varattr('KIn_Roof_9', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 9', aa, 'SPARTACUS', 0), &
741 varattr('KIn_Roof_10', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 10', aa, 'SPARTACUS', 0), &
742 varattr('KIn_Roof_11', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 11', aa, 'SPARTACUS', 0), &
743 varattr('KIn_Roof_12', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 12', aa, 'SPARTACUS', 0), &
744 varattr('KIn_Roof_13', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 13', aa, 'SPARTACUS', 0), &
745 varattr('KIn_Roof_14', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 14', aa, 'SPARTACUS', 0), &
746 varattr('KIn_Roof_15', 'W m-2', f104, 'sw radiation into roof - SPARTACUS level 15', aa, 'SPARTACUS', 0), &
747 varattr('KNet_Roof_1', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 1', aa, 'SPARTACUS', 0), &
748 varattr('KNet_Roof_2', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 2', aa, 'SPARTACUS', 0), &
749 varattr('KNet_Roof_3', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 3', aa, 'SPARTACUS', 0), &
750 varattr('KNet_Roof_4', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 4', aa, 'SPARTACUS', 0), &
751 varattr('KNet_Roof_5', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 5', aa, 'SPARTACUS', 0), &
752 varattr('KNet_Roof_6', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 6', aa, 'SPARTACUS', 0), &
753 varattr('KNet_Roof_7', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 7', aa, 'SPARTACUS', 0), &
754 varattr('KNet_Roof_8', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 8', aa, 'SPARTACUS', 0), &
755 varattr('KNet_Roof_9', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 9', aa, 'SPARTACUS', 0), &
756 varattr('KNet_Roof_10', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 10', aa, 'SPARTACUS', 0), &
757 varattr('KNet_Roof_11', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 11', aa, 'SPARTACUS', 0), &
758 varattr('KNet_Roof_12', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 12', aa, 'SPARTACUS', 0), &
759 varattr('KNet_Roof_13', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 13', aa, 'SPARTACUS', 0), &
760 varattr('KNet_Roof_14', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 14', aa, 'SPARTACUS', 0), &
761 varattr('KNet_Roof_15', 'W m-2', f104, 'sw net radiation at roof - SPARTACUS level 15', aa, 'SPARTACUS', 0), &
762 varattr('KIn_Wall_1', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 1', aa, 'SPARTACUS', 0), &
763 varattr('KIn_Wall_2', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 2', aa, 'SPARTACUS', 0), &
764 varattr('KIn_Wall_3', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 3', aa, 'SPARTACUS', 0), &
765 varattr('KIn_Wall_4', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 4', aa, 'SPARTACUS', 0), &
766 varattr('KIn_Wall_5', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 5', aa, 'SPARTACUS', 0), &
767 varattr('KIn_Wall_6', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 6', aa, 'SPARTACUS', 0), &
768 varattr('KIn_Wall_7', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 7', aa, 'SPARTACUS', 0), &
769 varattr('KIn_Wall_8', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 8', aa, 'SPARTACUS', 0), &
770 varattr('KIn_Wall_9', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 9', aa, 'SPARTACUS', 0), &
771 varattr('KIn_Wall_10', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 10', aa, 'SPARTACUS', 0), &
772 varattr('KIn_Wall_11', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 11', aa, 'SPARTACUS', 0), &
773 varattr('KIn_Wall_12', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 12', aa, 'SPARTACUS', 0), &
774 varattr('KIn_Wall_13', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 13', aa, 'SPARTACUS', 0), &
775 varattr('KIn_Wall_14', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 14', aa, 'SPARTACUS', 0), &
776 varattr('KIn_Wall_15', 'W m-2', f104, 'sw radiation into wall - SPARTACUS level 15', aa, 'SPARTACUS', 0), &
777 varattr('KNet_Wall_1', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 1', aa, 'SPARTACUS', 0), &
778 varattr('KNet_Wall_2', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 2', aa, 'SPARTACUS', 0), &
779 varattr('KNet_Wall_3', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 3', aa, 'SPARTACUS', 0), &
780 varattr('KNet_Wall_4', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 4', aa, 'SPARTACUS', 0), &
781 varattr('KNet_Wall_5', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 5', aa, 'SPARTACUS', 0), &
782 varattr('KNet_Wall_6', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 6', aa, 'SPARTACUS', 0), &
783 varattr('KNet_Wall_7', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 7', aa, 'SPARTACUS', 0), &
784 varattr('KNet_Wall_8', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 8', aa, 'SPARTACUS', 0), &
785 varattr('KNet_Wall_9', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 9', aa, 'SPARTACUS', 0), &
786 varattr('KNet_Wall_10', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 10', aa, 'SPARTACUS', 0), &
787 varattr('KNet_Wall_11', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 11', aa, 'SPARTACUS', 0), &
788 varattr('KNet_Wall_12', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 12', aa, 'SPARTACUS', 0), &
789 varattr('KNet_Wall_13', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 13', aa, 'SPARTACUS', 0), &
790 varattr('KNet_Wall_14', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 14', aa, 'SPARTACUS', 0), &
791 varattr('KNet_Wall_15', 'W m-2', f104, 'sw net radiation at wall - SPARTACUS level 15', aa, 'SPARTACUS', 0), &
792 varattr('KCAAbs_1', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 1', aa, 'SPARTACUS', 0), &
793 varattr('KCAAbs_2', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 2', aa, 'SPARTACUS', 0), &
794 varattr('KCAAbs_3', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 3', aa, 'SPARTACUS', 0), &
795 varattr('KCAAbs_4', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 4', aa, 'SPARTACUS', 0), &
796 varattr('KCAAbs_5', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 5', aa, 'SPARTACUS', 0), &
797 varattr('KCAAbs_6', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 6', aa, 'SPARTACUS', 0), &
798 varattr('KCAAbs_7', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 7', aa, 'SPARTACUS', 0), &
799 varattr('KCAAbs_8', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 8', aa, 'SPARTACUS', 0), &
800 varattr('KCAAbs_9', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 9', aa, 'SPARTACUS', 0), &
801 varattr('KCAAbs_10', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 10', aa, 'SPARTACUS', 0), &
802 varattr('KCAAbs_11', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 11', aa, 'SPARTACUS', 0), &
803 varattr('KCAAbs_12', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 12', aa, 'SPARTACUS', 0), &
804 varattr('KCAAbs_13', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 13', aa, 'SPARTACUS', 0), &
805 varattr('KCAAbs_14', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 14', aa, 'SPARTACUS', 0), &
806 varattr('KCAAbs_15', 'W m-2', f104, 'sw clear air absorption - SPARTACUS level 15', aa, 'SPARTACUS', 0), &
807 varattr('LIn_Roof_1', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 1', aa, 'SPARTACUS', 0), &
808 varattr('LIn_Roof_2', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 2', aa, 'SPARTACUS', 0), &
809 varattr('LIn_Roof_3', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 3', aa, 'SPARTACUS', 0), &
810 varattr('LIn_Roof_4', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 4', aa, 'SPARTACUS', 0), &
811 varattr('LIn_Roof_5', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 5', aa, 'SPARTACUS', 0), &
812 varattr('LIn_Roof_6', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 6', aa, 'SPARTACUS', 0), &
813 varattr('LIn_Roof_7', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 7', aa, 'SPARTACUS', 0), &
814 varattr('LIn_Roof_8', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 8', aa, 'SPARTACUS', 0), &
815 varattr('LIn_Roof_9', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 9', aa, 'SPARTACUS', 0), &
816 varattr('LIn_Roof_10', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 10', aa, 'SPARTACUS', 0), &
817 varattr('LIn_Roof_11', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 11', aa, 'SPARTACUS', 0), &
818 varattr('LIn_Roof_12', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 12', aa, 'SPARTACUS', 0), &
819 varattr('LIn_Roof_13', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 13', aa, 'SPARTACUS', 0), &
820 varattr('LIn_Roof_14', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 14', aa, 'SPARTACUS', 0), &
821 varattr('LIn_Roof_15', 'W m-2', f104, 'lw radiation into roof - SPARTACUS level 15', aa, 'SPARTACUS', 0), &
822 varattr('LNet_Roof_1', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 1', aa, 'SPARTACUS', 0), &
823 varattr('LNet_Roof_2', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 2', aa, 'SPARTACUS', 0), &
824 varattr('LNet_Roof_3', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 3', aa, 'SPARTACUS', 0), &
825 varattr('LNet_Roof_4', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 4', aa, 'SPARTACUS', 0), &
826 varattr('LNet_Roof_5', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 5', aa, 'SPARTACUS', 0), &
827 varattr('LNet_Roof_6', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 6', aa, 'SPARTACUS', 0), &
828 varattr('LNet_Roof_7', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 7', aa, 'SPARTACUS', 0), &
829 varattr('LNet_Roof_8', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 8', aa, 'SPARTACUS', 0), &
830 varattr('LNet_Roof_9', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 9', aa, 'SPARTACUS', 0), &
831 varattr('LNet_Roof_10', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 10', aa, 'SPARTACUS', 0), &
832 varattr('LNet_Roof_11', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 11', aa, 'SPARTACUS', 0), &
833 varattr('LNet_Roof_12', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 12', aa, 'SPARTACUS', 0), &
834 varattr('LNet_Roof_13', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 13', aa, 'SPARTACUS', 0), &
835 varattr('LNet_Roof_14', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 14', aa, 'SPARTACUS', 0), &
836 varattr('LNet_Roof_15', 'W m-2', f104, 'lw net radiation at roof - SPARTACUS level 15', aa, 'SPARTACUS', 0), &
837 varattr('LIn_Wall_1', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 1', aa, 'SPARTACUS', 0), &
838 varattr('LIn_Wall_2', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 2', aa, 'SPARTACUS', 0), &
839 varattr('LIn_Wall_3', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 3', aa, 'SPARTACUS', 0), &
840 varattr('LIn_Wall_4', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 4', aa, 'SPARTACUS', 0), &
841 varattr('LIn_Wall_5', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 5', aa, 'SPARTACUS', 0), &
842 varattr('LIn_Wall_6', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 6', aa, 'SPARTACUS', 0), &
843 varattr('LIn_Wall_7', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 7', aa, 'SPARTACUS', 0), &
844 varattr('LIn_Wall_8', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 8', aa, 'SPARTACUS', 0), &
845 varattr('LIn_Wall_9', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 9', aa, 'SPARTACUS', 0), &
846 varattr('LIn_Wall_10', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 10', aa, 'SPARTACUS', 0), &
847 varattr('LIn_Wall_11', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 11', aa, 'SPARTACUS', 0), &
848 varattr('LIn_Wall_12', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 12', aa, 'SPARTACUS', 0), &
849 varattr('LIn_Wall_13', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 13', aa, 'SPARTACUS', 0), &
850 varattr('LIn_Wall_14', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 14', aa, 'SPARTACUS', 0), &
851 varattr('LIn_Wall_15', 'W m-2', f104, 'lw radiation into wall - SPARTACUS level 15', aa, 'SPARTACUS', 0), &
852 varattr('LNet_Wall_1', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 1', aa, 'SPARTACUS', 0), &
853 varattr('LNet_Wall_2', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 2', aa, 'SPARTACUS', 0), &
854 varattr('LNet_Wall_3', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 3', aa, 'SPARTACUS', 0), &
855 varattr('LNet_Wall_4', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 4', aa, 'SPARTACUS', 0), &
856 varattr('LNet_Wall_5', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 5', aa, 'SPARTACUS', 0), &
857 varattr('LNet_Wall_6', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 6', aa, 'SPARTACUS', 0), &
858 varattr('LNet_Wall_7', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 7', aa, 'SPARTACUS', 0), &
859 varattr('LNet_Wall_8', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 8', aa, 'SPARTACUS', 0), &
860 varattr('LNet_Wall_9', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 9', aa, 'SPARTACUS', 0), &
861 varattr('LNet_Wall_10', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 10', aa, 'SPARTACUS', 0), &
862 varattr('LNet_Wall_11', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 11', aa, 'SPARTACUS', 0), &
863 varattr('LNet_Wall_12', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 12', aa, 'SPARTACUS', 0), &
864 varattr('LNet_Wall_13', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 13', aa, 'SPARTACUS', 0), &
865 varattr('LNet_Wall_14', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 14', aa, 'SPARTACUS', 0), &
866 varattr('LNet_Wall_15', 'W m-2', f104, 'lw net radiation at wall - SPARTACUS level 15', aa, 'SPARTACUS', 0), &
867 varattr('sfr_Roof_1', '-', f104, 'surface coverage of roof - SPARTACUS level 1', aa, 'SPARTACUS', 0), &
868 varattr('sfr_Roof_2', '-', f104, 'surface coverage of roof - SPARTACUS level 2', aa, 'SPARTACUS', 0), &
869 varattr('sfr_Roof_3', '-', f104, 'surface coverage of roof - SPARTACUS level 3', aa, 'SPARTACUS', 0), &
870 varattr('sfr_Roof_4', '-', f104, 'surface coverage of roof - SPARTACUS level 4', aa, 'SPARTACUS', 0), &
871 varattr('sfr_Roof_5', '-', f104, 'surface coverage of roof - SPARTACUS level 5', aa, 'SPARTACUS', 0), &
872 varattr('sfr_Roof_6', '-', f104, 'surface coverage of roof - SPARTACUS level 6', aa, 'SPARTACUS', 0), &
873 varattr('sfr_Roof_7', '-', f104, 'surface coverage of roof - SPARTACUS level 7', aa, 'SPARTACUS', 0), &
874 varattr('sfr_Roof_8', '-', f104, 'surface coverage of roof - SPARTACUS level 8', aa, 'SPARTACUS', 0), &
875 varattr('sfr_Roof_9', '-', f104, 'surface coverage of roof - SPARTACUS level 9', aa, 'SPARTACUS', 0), &
876 varattr('sfr_Roof_10', '-', f104, 'surface coverage of roof - SPARTACUS level 10', aa, 'SPARTACUS', 0), &
877 varattr('sfr_Roof_11', '-', f104, 'surface coverage of roof - SPARTACUS level 11', aa, 'SPARTACUS', 0), &
878 varattr('sfr_Roof_12', '-', f104, 'surface coverage of roof - SPARTACUS level 12', aa, 'SPARTACUS', 0), &
879 varattr('sfr_Roof_13', '-', f104, 'surface coverage of roof - SPARTACUS level 13', aa, 'SPARTACUS', 0), &
880 varattr('sfr_Roof_14', '-', f104, 'surface coverage of roof - SPARTACUS level 14', aa, 'SPARTACUS', 0), &
881 varattr('sfr_Roof_15', '-', f104, 'surface coverage of roof - SPARTACUS level 15', aa, 'SPARTACUS', 0), &
882 varattr('sfr_Wall_1', '-', f104, 'surface coverage of wall - SPARTACUS level 1', aa, 'SPARTACUS', 0), &
883 varattr('sfr_Wall_2', '-', f104, 'surface coverage of wall - SPARTACUS level 2', aa, 'SPARTACUS', 0), &
884 varattr('sfr_Wall_3', '-', f104, 'surface coverage of wall - SPARTACUS level 3', aa, 'SPARTACUS', 0), &
885 varattr('sfr_Wall_4', '-', f104, 'surface coverage of wall - SPARTACUS level 4', aa, 'SPARTACUS', 0), &
886 varattr('sfr_Wall_5', '-', f104, 'surface coverage of wall - SPARTACUS level 5', aa, 'SPARTACUS', 0), &
887 varattr('sfr_Wall_6', '-', f104, 'surface coverage of wall - SPARTACUS level 6', aa, 'SPARTACUS', 0), &
888 varattr('sfr_Wall_7', '-', f104, 'surface coverage of wall - SPARTACUS level 7', aa, 'SPARTACUS', 0), &
889 varattr('sfr_Wall_8', '-', f104, 'surface coverage of wall - SPARTACUS level 8', aa, 'SPARTACUS', 0), &
890 varattr('sfr_Wall_9', '-', f104, 'surface coverage of wall - SPARTACUS level 9', aa, 'SPARTACUS', 0), &
891 varattr('sfr_Wall_10', '-', f104, 'surface coverage of wall - SPARTACUS level 10', aa, 'SPARTACUS', 0), &
892 varattr('sfr_Wall_11', '-', f104, 'surface coverage of wall - SPARTACUS level 11', aa, 'SPARTACUS', 0), &
893 varattr('sfr_Wall_12', '-', f104, 'surface coverage of wall - SPARTACUS level 12', aa, 'SPARTACUS', 0), &
894 varattr('sfr_Wall_13', '-', f104, 'surface coverage of wall - SPARTACUS level 13', aa, 'SPARTACUS', 0), &
895 varattr('sfr_Wall_14', '-', f104, 'surface coverage of wall - SPARTACUS level 14', aa, 'SPARTACUS', 0), &
896 varattr('sfr_Wall_15', '-', f104, 'surface coverage of wall - SPARTACUS level 15', aa, 'SPARTACUS', 0), &
897 varattr('LCAAbs_1', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 1', aa, 'SPARTACUS', 0), &
898 varattr('LCAAbs_2', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 2', aa, 'SPARTACUS', 0), &
899 varattr('LCAAbs_3', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 3', aa, 'SPARTACUS', 0), &
900 varattr('LCAAbs_4', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 4', aa, 'SPARTACUS', 0), &
901 varattr('LCAAbs_5', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 5', aa, 'SPARTACUS', 0), &
902 varattr('LCAAbs_6', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 6', aa, 'SPARTACUS', 0), &
903 varattr('LCAAbs_7', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 7', aa, 'SPARTACUS', 0), &
904 varattr('LCAAbs_8', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 8', aa, 'SPARTACUS', 0), &
905 varattr('LCAAbs_9', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 9', aa, 'SPARTACUS', 0), &
906 varattr('LCAAbs_10', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 10', aa, 'SPARTACUS', 0), &
907 varattr('LCAAbs_11', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 11', aa, 'SPARTACUS', 0), &
908 varattr('LCAAbs_12', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 12', aa, 'SPARTACUS', 0), &
909 varattr('LCAAbs_13', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 13', aa, 'SPARTACUS', 0), &
910 varattr('LCAAbs_14', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 14', aa, 'SPARTACUS', 0), &
911 varattr('LCAAbs_15', 'W m-2', f104, 'lw clear air absorption - SPARTACUS level 15', aa, 'SPARTACUS', 0) &
912 /
913 ! ESTM_ext info
914 DATA(varlistall(n), &
916 + ncolumnsdataoutbl - 5 &
917 + ncolumnsdataoutsnow - 5 &
918 + ncolumnsdataoutestm - 5 &
920 + ncolumnsdataoutrsl - 5 &
923 + 1, &
927 + ncolumnsdataoutrsl - 5 &
931 )/ &
932 varattr('Ts_Paved', 'degC', f104, 'surface temperature of paved surface', aa, 'ESTMExt', 0), &
933 varattr('Ts_Bldgs', 'degC', f104, 'surface temperature of building surface', aa, 'ESTMExt', 0), &
934 varattr('Ts_EveTr', 'degC', f104, 'surface temperature of evergreen tree surface', aa, 'ESTMExt', 0), &
935 varattr('Ts_DecTr', 'degC', f104, 'surface temperature of deciduous tree surface', aa, 'ESTMExt', 0), &
936 varattr('Ts_Grass', 'degC', f104, 'surface temperature of grass surface', aa, 'ESTMExt', 0), &
937 varattr('Ts_BSoil', 'degC', f104, 'surface temperature of bare soil surface', aa, 'ESTMExt', 0), &
938 varattr('Ts_Water', 'degC', f104, 'surface temperature of water surface', aa, 'ESTMExt', 0), &
939 varattr('QS_Paved', 'W m-2', f104, 'storage heat flux of paved surface', aa, 'ESTMExt', 0), &
940 varattr('QS_Bldgs', 'W m-2', f104, 'storage heat flux of building surface', aa, 'ESTMExt', 0), &
941 varattr('QS_EveTr', 'W m-2', f104, 'storage heat flux of evergreen tree surface', aa, 'ESTMExt', 0), &
942 varattr('QS_DecTr', 'W m-2', f104, 'storage heat flux of deciduous tree surface', aa, 'ESTMExt', 0), &
943 varattr('QS_Grass', 'W m-2', f104, 'storage heat flux of grass surface', aa, 'ESTMExt', 0), &
944 varattr('QS_BSoil', 'W m-2', f104, 'storage heat flux of bare soil surface', aa, 'ESTMExt', 0), &
945 varattr('QS_Water', 'W m-2', f104, 'storage heat flux of water surface', aa, 'ESTMExt', 0), &
946 varattr('Ts_Roof_1', 'degC', f104, 'surface temperature of roof level 1', aa, 'ESTMExt', 0), &
947 varattr('Ts_Roof_2', 'degC', f104, 'surface temperature of roof level 2', aa, 'ESTMExt', 0), &
948 varattr('Ts_Roof_3', 'degC', f104, 'surface temperature of roof level 3', aa, 'ESTMExt', 0), &
949 varattr('Ts_Roof_4', 'degC', f104, 'surface temperature of roof level 4', aa, 'ESTMExt', 0), &
950 varattr('Ts_Roof_5', 'degC', f104, 'surface temperature of roof level 5', aa, 'ESTMExt', 0), &
951 varattr('Ts_Roof_6', 'degC', f104, 'surface temperature of roof level 6', aa, 'ESTMExt', 0), &
952 varattr('Ts_Roof_7', 'degC', f104, 'surface temperature of roof level 7', aa, 'ESTMExt', 0), &
953 varattr('Ts_Roof_8', 'degC', f104, 'surface temperature of roof level 8', aa, 'ESTMExt', 0), &
954 varattr('Ts_Roof_9', 'degC', f104, 'surface temperature of roof level 9', aa, 'ESTMExt', 0), &
955 varattr('Ts_Roof_10', 'degC', f104, 'surface temperature of roof level 10', aa, 'ESTMExt', 0), &
956 varattr('Ts_Roof_11', 'degC', f104, 'surface temperature of roof level 11', aa, 'ESTMExt', 0), &
957 varattr('Ts_Roof_12', 'degC', f104, 'surface temperature of roof level 12', aa, 'ESTMExt', 0), &
958 varattr('Ts_Roof_13', 'degC', f104, 'surface temperature of roof level 13', aa, 'ESTMExt', 0), &
959 varattr('Ts_Roof_14', 'degC', f104, 'surface temperature of roof level 14', aa, 'ESTMExt', 0), &
960 varattr('Ts_Roof_15', 'degC', f104, 'surface temperature of roof level 15', aa, 'ESTMExt', 0), &
961 varattr('Qn_Roof_1', 'degC', f104, 'net all-wave radiation of roof level 1', aa, 'ESTMExt', 0), &
962 varattr('Qn_Roof_2', 'degC', f104, 'net all-wave radiation of roof level 2', aa, 'ESTMExt', 0), &
963 varattr('Qn_Roof_3', 'degC', f104, 'net all-wave radiation of roof level 3', aa, 'ESTMExt', 0), &
964 varattr('Qn_Roof_4', 'degC', f104, 'net all-wave radiation of roof level 4', aa, 'ESTMExt', 0), &
965 varattr('Qn_Roof_5', 'degC', f104, 'net all-wave radiation of roof level 5', aa, 'ESTMExt', 0), &
966 varattr('Qn_Roof_6', 'degC', f104, 'net all-wave radiation of roof level 6', aa, 'ESTMExt', 0), &
967 varattr('Qn_Roof_7', 'degC', f104, 'net all-wave radiation of roof level 7', aa, 'ESTMExt', 0), &
968 varattr('Qn_Roof_8', 'degC', f104, 'net all-wave radiation of roof level 8', aa, 'ESTMExt', 0), &
969 varattr('Qn_Roof_9', 'degC', f104, 'net all-wave radiation of roof level 9', aa, 'ESTMExt', 0), &
970 varattr('Qn_Roof_10', 'degC', f104, 'net all-wave radiation of roof level 10', aa, 'ESTMExt', 0), &
971 varattr('Qn_Roof_11', 'degC', f104, 'net all-wave radiation of roof level 11', aa, 'ESTMExt', 0), &
972 varattr('Qn_Roof_12', 'degC', f104, 'net all-wave radiation of roof level 12', aa, 'ESTMExt', 0), &
973 varattr('Qn_Roof_13', 'degC', f104, 'net all-wave radiation of roof level 13', aa, 'ESTMExt', 0), &
974 varattr('Qn_Roof_14', 'degC', f104, 'net all-wave radiation of roof level 14', aa, 'ESTMExt', 0), &
975 varattr('Qn_Roof_15', 'degC', f104, 'net all-wave radiation of roof level 15', aa, 'ESTMExt', 0), &
976 varattr('QS_Roof_1', 'degC', f104, 'storage heat flux of roof level 1', aa, 'ESTMExt', 0), &
977 varattr('QS_Roof_2', 'degC', f104, 'storage heat flux of roof level 2', aa, 'ESTMExt', 0), &
978 varattr('QS_Roof_3', 'degC', f104, 'storage heat flux of roof level 3', aa, 'ESTMExt', 0), &
979 varattr('QS_Roof_4', 'degC', f104, 'storage heat flux of roof level 4', aa, 'ESTMExt', 0), &
980 varattr('QS_Roof_5', 'degC', f104, 'storage heat flux of roof level 5', aa, 'ESTMExt', 0), &
981 varattr('QS_Roof_6', 'degC', f104, 'storage heat flux of roof level 6', aa, 'ESTMExt', 0), &
982 varattr('QS_Roof_7', 'degC', f104, 'storage heat flux of roof level 7', aa, 'ESTMExt', 0), &
983 varattr('QS_Roof_8', 'degC', f104, 'storage heat flux of roof level 8', aa, 'ESTMExt', 0), &
984 varattr('QS_Roof_9', 'degC', f104, 'storage heat flux of roof level 9', aa, 'ESTMExt', 0), &
985 varattr('QS_Roof_10', 'degC', f104, 'storage heat flux of roof level 10', aa, 'ESTMExt', 0), &
986 varattr('QS_Roof_11', 'degC', f104, 'storage heat flux of roof level 11', aa, 'ESTMExt', 0), &
987 varattr('QS_Roof_12', 'degC', f104, 'storage heat flux of roof level 12', aa, 'ESTMExt', 0), &
988 varattr('QS_Roof_13', 'degC', f104, 'storage heat flux of roof level 13', aa, 'ESTMExt', 0), &
989 varattr('QS_Roof_14', 'degC', f104, 'storage heat flux of roof level 14', aa, 'ESTMExt', 0), &
990 varattr('QS_Roof_15', 'degC', f104, 'storage heat flux of roof level 15', aa, 'ESTMExt', 0), &
991 varattr('QE_Roof_1', 'degC', f104, 'latent heat flux of roof level 1', aa, 'ESTMExt', 0), &
992 varattr('QE_Roof_2', 'degC', f104, 'latent heat flux of roof level 2', aa, 'ESTMExt', 0), &
993 varattr('QE_Roof_3', 'degC', f104, 'latent heat flux of roof level 3', aa, 'ESTMExt', 0), &
994 varattr('QE_Roof_4', 'degC', f104, 'latent heat flux of roof level 4', aa, 'ESTMExt', 0), &
995 varattr('QE_Roof_5', 'degC', f104, 'latent heat flux of roof level 5', aa, 'ESTMExt', 0), &
996 varattr('QE_Roof_6', 'degC', f104, 'latent heat flux of roof level 6', aa, 'ESTMExt', 0), &
997 varattr('QE_Roof_7', 'degC', f104, 'latent heat flux of roof level 7', aa, 'ESTMExt', 0), &
998 varattr('QE_Roof_8', 'degC', f104, 'latent heat flux of roof level 8', aa, 'ESTMExt', 0), &
999 varattr('QE_Roof_9', 'degC', f104, 'latent heat flux of roof level 9', aa, 'ESTMExt', 0), &
1000 varattr('QE_Roof_10', 'degC', f104, 'latent heat flux of roof level 10', aa, 'ESTMExt', 0), &
1001 varattr('QE_Roof_11', 'degC', f104, 'latent heat flux of roof level 11', aa, 'ESTMExt', 0), &
1002 varattr('QE_Roof_12', 'degC', f104, 'latent heat flux of roof level 12', aa, 'ESTMExt', 0), &
1003 varattr('QE_Roof_13', 'degC', f104, 'latent heat flux of roof level 13', aa, 'ESTMExt', 0), &
1004 varattr('QE_Roof_14', 'degC', f104, 'latent heat flux of roof level 14', aa, 'ESTMExt', 0), &
1005 varattr('QE_Roof_15', 'degC', f104, 'latent heat flux of roof level 15', aa, 'ESTMExt', 0), &
1006 varattr('QH_Roof_1', 'degC', f104, 'sensible heat flux of roof level 1', aa, 'ESTMExt', 0), &
1007 varattr('QH_Roof_2', 'degC', f104, 'sensible heat flux of roof level 2', aa, 'ESTMExt', 0), &
1008 varattr('QH_Roof_3', 'degC', f104, 'sensible heat flux of roof level 3', aa, 'ESTMExt', 0), &
1009 varattr('QH_Roof_4', 'degC', f104, 'sensible heat flux of roof level 4', aa, 'ESTMExt', 0), &
1010 varattr('QH_Roof_5', 'degC', f104, 'sensible heat flux of roof level 5', aa, 'ESTMExt', 0), &
1011 varattr('QH_Roof_6', 'degC', f104, 'sensible heat flux of roof level 6', aa, 'ESTMExt', 0), &
1012 varattr('QH_Roof_7', 'degC', f104, 'sensible heat flux of roof level 7', aa, 'ESTMExt', 0), &
1013 varattr('QH_Roof_8', 'degC', f104, 'sensible heat flux of roof level 8', aa, 'ESTMExt', 0), &
1014 varattr('QH_Roof_9', 'degC', f104, 'sensible heat flux of roof level 9', aa, 'ESTMExt', 0), &
1015 varattr('QH_Roof_10', 'degC', f104, 'sensible heat flux of roof level 10', aa, 'ESTMExt', 0), &
1016 varattr('QH_Roof_11', 'degC', f104, 'sensible heat flux of roof level 11', aa, 'ESTMExt', 0), &
1017 varattr('QH_Roof_12', 'degC', f104, 'sensible heat flux of roof level 12', aa, 'ESTMExt', 0), &
1018 varattr('QH_Roof_13', 'degC', f104, 'sensible heat flux of roof level 13', aa, 'ESTMExt', 0), &
1019 varattr('QH_Roof_14', 'degC', f104, 'sensible heat flux of roof level 14', aa, 'ESTMExt', 0), &
1020 varattr('QH_Roof_15', 'degC', f104, 'sensible heat flux of roof level 15', aa, 'ESTMExt', 0), &
1021 varattr('St_Roof_1', 'mm', f104, 'surface state of roof level 1', aa, 'ESTMExt', 0), &
1022 varattr('St_Roof_2', 'mm', f104, 'surface state of roof level 2', aa, 'ESTMExt', 0), &
1023 varattr('St_Roof_3', 'mm', f104, 'surface state of roof level 3', aa, 'ESTMExt', 0), &
1024 varattr('St_Roof_4', 'mm', f104, 'surface state of roof level 4', aa, 'ESTMExt', 0), &
1025 varattr('St_Roof_5', 'mm', f104, 'surface state of roof level 5', aa, 'ESTMExt', 0), &
1026 varattr('St_Roof_6', 'mm', f104, 'surface state of roof level 6', aa, 'ESTMExt', 0), &
1027 varattr('St_Roof_7', 'mm', f104, 'surface state of roof level 7', aa, 'ESTMExt', 0), &
1028 varattr('St_Roof_8', 'mm', f104, 'surface state of roof level 8', aa, 'ESTMExt', 0), &
1029 varattr('St_Roof_9', 'mm', f104, 'surface state of roof level 9', aa, 'ESTMExt', 0), &
1030 varattr('St_Roof_10', 'mm', f104, 'surface state of roof level 10', aa, 'ESTMExt', 0), &
1031 varattr('St_Roof_11', 'mm', f104, 'surface state of roof level 11', aa, 'ESTMExt', 0), &
1032 varattr('St_Roof_12', 'mm', f104, 'surface state of roof level 12', aa, 'ESTMExt', 0), &
1033 varattr('St_Roof_13', 'mm', f104, 'surface state of roof level 13', aa, 'ESTMExt', 0), &
1034 varattr('St_Roof_14', 'mm', f104, 'surface state of roof level 14', aa, 'ESTMExt', 0), &
1035 varattr('St_Roof_15', 'mm', f104, 'surface state of roof level 15', aa, 'ESTMExt', 0), &
1036 varattr('SS_Roof_1', 'mm', f104, 'soil store of roof level 1', aa, 'ESTMExt', 0), &
1037 varattr('SS_Roof_2', 'mm', f104, 'soil store of roof level 2', aa, 'ESTMExt', 0), &
1038 varattr('SS_Roof_3', 'mm', f104, 'soil store of roof level 3', aa, 'ESTMExt', 0), &
1039 varattr('SS_Roof_4', 'mm', f104, 'soil store of roof level 4', aa, 'ESTMExt', 0), &
1040 varattr('SS_Roof_5', 'mm', f104, 'soil store of roof level 5', aa, 'ESTMExt', 0), &
1041 varattr('SS_Roof_6', 'mm', f104, 'soil store of roof level 6', aa, 'ESTMExt', 0), &
1042 varattr('SS_Roof_7', 'mm', f104, 'soil store of roof level 7', aa, 'ESTMExt', 0), &
1043 varattr('SS_Roof_8', 'mm', f104, 'soil store of roof level 8', aa, 'ESTMExt', 0), &
1044 varattr('SS_Roof_9', 'mm', f104, 'soil store of roof level 9', aa, 'ESTMExt', 0), &
1045 varattr('SS_Roof_10', 'mm', f104, 'soil store of roof level 10', aa, 'ESTMExt', 0), &
1046 varattr('SS_Roof_11', 'mm', f104, 'soil store of roof level 11', aa, 'ESTMExt', 0), &
1047 varattr('SS_Roof_12', 'mm', f104, 'soil store of roof level 12', aa, 'ESTMExt', 0), &
1048 varattr('SS_Roof_13', 'mm', f104, 'soil store of roof level 13', aa, 'ESTMExt', 0), &
1049 varattr('SS_Roof_14', 'mm', f104, 'soil store of roof level 14', aa, 'ESTMExt', 0), &
1050 varattr('SS_Roof_15', 'mm', f104, 'soil store of roof level 15', aa, 'ESTMExt', 0), &
1051 varattr('Ts_Wall_1', 'degC', f104, 'surface temperature of wall level 1', aa, 'ESTMExt', 0), &
1052 varattr('Ts_Wall_2', 'degC', f104, 'surface temperature of wall level 2', aa, 'ESTMExt', 0), &
1053 varattr('Ts_Wall_3', 'degC', f104, 'surface temperature of wall level 3', aa, 'ESTMExt', 0), &
1054 varattr('Ts_Wall_4', 'degC', f104, 'surface temperature of wall level 4', aa, 'ESTMExt', 0), &
1055 varattr('Ts_Wall_5', 'degC', f104, 'surface temperature of wall level 5', aa, 'ESTMExt', 0), &
1056 varattr('Ts_Wall_6', 'degC', f104, 'surface temperature of wall level 6', aa, 'ESTMExt', 0), &
1057 varattr('Ts_Wall_7', 'degC', f104, 'surface temperature of wall level 7', aa, 'ESTMExt', 0), &
1058 varattr('Ts_Wall_8', 'degC', f104, 'surface temperature of wall level 8', aa, 'ESTMExt', 0), &
1059 varattr('Ts_Wall_9', 'degC', f104, 'surface temperature of wall level 9', aa, 'ESTMExt', 0), &
1060 varattr('Ts_Wall_10', 'degC', f104, 'surface temperature of wall level 10', aa, 'ESTMExt', 0), &
1061 varattr('Ts_Wall_11', 'degC', f104, 'surface temperature of wall level 11', aa, 'ESTMExt', 0), &
1062 varattr('Ts_Wall_12', 'degC', f104, 'surface temperature of wall level 12', aa, 'ESTMExt', 0), &
1063 varattr('Ts_Wall_13', 'degC', f104, 'surface temperature of wall level 13', aa, 'ESTMExt', 0), &
1064 varattr('Ts_Wall_14', 'degC', f104, 'surface temperature of wall level 14', aa, 'ESTMExt', 0), &
1065 varattr('Ts_Wall_15', 'degC', f104, 'surface temperature of wall level 15', aa, 'ESTMExt', 0), &
1066 varattr('Qn_Wall_1', 'degC', f104, 'net all-wave radiation of wall level 1', aa, 'ESTMExt', 0), &
1067 varattr('Qn_Wall_2', 'degC', f104, 'net all-wave radiation of wall level 2', aa, 'ESTMExt', 0), &
1068 varattr('Qn_Wall_3', 'degC', f104, 'net all-wave radiation of wall level 3', aa, 'ESTMExt', 0), &
1069 varattr('Qn_Wall_4', 'degC', f104, 'net all-wave radiation of wall level 4', aa, 'ESTMExt', 0), &
1070 varattr('Qn_Wall_5', 'degC', f104, 'net all-wave radiation of wall level 5', aa, 'ESTMExt', 0), &
1071 varattr('Qn_Wall_6', 'degC', f104, 'net all-wave radiation of wall level 6', aa, 'ESTMExt', 0), &
1072 varattr('Qn_Wall_7', 'degC', f104, 'net all-wave radiation of wall level 7', aa, 'ESTMExt', 0), &
1073 varattr('Qn_Wall_8', 'degC', f104, 'net all-wave radiation of wall level 8', aa, 'ESTMExt', 0), &
1074 varattr('Qn_Wall_9', 'degC', f104, 'net all-wave radiation of wall level 9', aa, 'ESTMExt', 0), &
1075 varattr('Qn_Wall_10', 'degC', f104, 'net all-wave radiation of wall level 10', aa, 'ESTMExt', 0), &
1076 varattr('Qn_Wall_11', 'degC', f104, 'net all-wave radiation of wall level 11', aa, 'ESTMExt', 0), &
1077 varattr('Qn_Wall_12', 'degC', f104, 'net all-wave radiation of wall level 12', aa, 'ESTMExt', 0), &
1078 varattr('Qn_Wall_13', 'degC', f104, 'net all-wave radiation of wall level 13', aa, 'ESTMExt', 0), &
1079 varattr('Qn_Wall_14', 'degC', f104, 'net all-wave radiation of wall level 14', aa, 'ESTMExt', 0), &
1080 varattr('Qn_Wall_15', 'degC', f104, 'net all-wave radiation of wall level 15', aa, 'ESTMExt', 0), &
1081 varattr('QS_Wall_1', 'degC', f104, 'storage heat flux of wall level 1', aa, 'ESTMExt', 0), &
1082 varattr('QS_Wall_2', 'degC', f104, 'storage heat flux of wall level 2', aa, 'ESTMExt', 0), &
1083 varattr('QS_Wall_3', 'degC', f104, 'storage heat flux of wall level 3', aa, 'ESTMExt', 0), &
1084 varattr('QS_Wall_4', 'degC', f104, 'storage heat flux of wall level 4', aa, 'ESTMExt', 0), &
1085 varattr('QS_Wall_5', 'degC', f104, 'storage heat flux of wall level 5', aa, 'ESTMExt', 0), &
1086 varattr('QS_Wall_6', 'degC', f104, 'storage heat flux of wall level 6', aa, 'ESTMExt', 0), &
1087 varattr('QS_Wall_7', 'degC', f104, 'storage heat flux of wall level 7', aa, 'ESTMExt', 0), &
1088 varattr('QS_Wall_8', 'degC', f104, 'storage heat flux of wall level 8', aa, 'ESTMExt', 0), &
1089 varattr('QS_Wall_9', 'degC', f104, 'storage heat flux of wall level 9', aa, 'ESTMExt', 0), &
1090 varattr('QS_Wall_10', 'degC', f104, 'storage heat flux of wall level 10', aa, 'ESTMExt', 0), &
1091 varattr('QS_Wall_11', 'degC', f104, 'storage heat flux of wall level 11', aa, 'ESTMExt', 0), &
1092 varattr('QS_Wall_12', 'degC', f104, 'storage heat flux of wall level 12', aa, 'ESTMExt', 0), &
1093 varattr('QS_Wall_13', 'degC', f104, 'storage heat flux of wall level 13', aa, 'ESTMExt', 0), &
1094 varattr('QS_Wall_14', 'degC', f104, 'storage heat flux of wall level 14', aa, 'ESTMExt', 0), &
1095 varattr('QS_Wall_15', 'degC', f104, 'storage heat flux of wall level 15', aa, 'ESTMExt', 0), &
1096 varattr('QE_Wall_1', 'degC', f104, 'latent heat flux of wall level 1', aa, 'ESTMExt', 0), &
1097 varattr('QE_Wall_2', 'degC', f104, 'latent heat flux of wall level 2', aa, 'ESTMExt', 0), &
1098 varattr('QE_Wall_3', 'degC', f104, 'latent heat flux of wall level 3', aa, 'ESTMExt', 0), &
1099 varattr('QE_Wall_4', 'degC', f104, 'latent heat flux of wall level 4', aa, 'ESTMExt', 0), &
1100 varattr('QE_Wall_5', 'degC', f104, 'latent heat flux of wall level 5', aa, 'ESTMExt', 0), &
1101 varattr('QE_Wall_6', 'degC', f104, 'latent heat flux of wall level 6', aa, 'ESTMExt', 0), &
1102 varattr('QE_Wall_7', 'degC', f104, 'latent heat flux of wall level 7', aa, 'ESTMExt', 0), &
1103 varattr('QE_Wall_8', 'degC', f104, 'latent heat flux of wall level 8', aa, 'ESTMExt', 0), &
1104 varattr('QE_Wall_9', 'degC', f104, 'latent heat flux of wall level 9', aa, 'ESTMExt', 0), &
1105 varattr('QE_Wall_10', 'degC', f104, 'latent heat flux of wall level 10', aa, 'ESTMExt', 0), &
1106 varattr('QE_Wall_11', 'degC', f104, 'latent heat flux of wall level 11', aa, 'ESTMExt', 0), &
1107 varattr('QE_Wall_12', 'degC', f104, 'latent heat flux of wall level 12', aa, 'ESTMExt', 0), &
1108 varattr('QE_Wall_13', 'degC', f104, 'latent heat flux of wall level 13', aa, 'ESTMExt', 0), &
1109 varattr('QE_Wall_14', 'degC', f104, 'latent heat flux of wall level 14', aa, 'ESTMExt', 0), &
1110 varattr('QE_Wall_15', 'degC', f104, 'latent heat flux of wall level 15', aa, 'ESTMExt', 0), &
1111 varattr('QH_Wall_1', 'degC', f104, 'sensible heat flux of wall level 1', aa, 'ESTMExt', 0), &
1112 varattr('QH_Wall_2', 'degC', f104, 'sensible heat flux of wall level 2', aa, 'ESTMExt', 0), &
1113 varattr('QH_Wall_3', 'degC', f104, 'sensible heat flux of wall level 3', aa, 'ESTMExt', 0), &
1114 varattr('QH_Wall_4', 'degC', f104, 'sensible heat flux of wall level 4', aa, 'ESTMExt', 0), &
1115 varattr('QH_Wall_5', 'degC', f104, 'sensible heat flux of wall level 5', aa, 'ESTMExt', 0), &
1116 varattr('QH_Wall_6', 'degC', f104, 'sensible heat flux of wall level 6', aa, 'ESTMExt', 0), &
1117 varattr('QH_Wall_7', 'degC', f104, 'sensible heat flux of wall level 7', aa, 'ESTMExt', 0), &
1118 varattr('QH_Wall_8', 'degC', f104, 'sensible heat flux of wall level 8', aa, 'ESTMExt', 0), &
1119 varattr('QH_Wall_9', 'degC', f104, 'sensible heat flux of wall level 9', aa, 'ESTMExt', 0), &
1120 varattr('QH_Wall_10', 'degC', f104, 'sensible heat flux of wall level 10', aa, 'ESTMExt', 0), &
1121 varattr('QH_Wall_11', 'degC', f104, 'sensible heat flux of wall level 11', aa, 'ESTMExt', 0), &
1122 varattr('QH_Wall_12', 'degC', f104, 'sensible heat flux of wall level 12', aa, 'ESTMExt', 0), &
1123 varattr('QH_Wall_13', 'degC', f104, 'sensible heat flux of wall level 13', aa, 'ESTMExt', 0), &
1124 varattr('QH_Wall_14', 'degC', f104, 'sensible heat flux of wall level 14', aa, 'ESTMExt', 0), &
1125 varattr('QH_Wall_15', 'degC', f104, 'sensible heat flux of wall level 15', aa, 'ESTMExt', 0), &
1126 varattr('St_Wall_1', 'mm', f104, 'surface state of wall level 1', aa, 'ESTMExt', 0), &
1127 varattr('St_Wall_2', 'mm', f104, 'surface state of wall level 2', aa, 'ESTMExt', 0), &
1128 varattr('St_Wall_3', 'mm', f104, 'surface state of wall level 3', aa, 'ESTMExt', 0), &
1129 varattr('St_Wall_4', 'mm', f104, 'surface state of wall level 4', aa, 'ESTMExt', 0), &
1130 varattr('St_Wall_5', 'mm', f104, 'surface state of wall level 5', aa, 'ESTMExt', 0), &
1131 varattr('St_Wall_6', 'mm', f104, 'surface state of wall level 6', aa, 'ESTMExt', 0), &
1132 varattr('St_Wall_7', 'mm', f104, 'surface state of wall level 7', aa, 'ESTMExt', 0), &
1133 varattr('St_Wall_8', 'mm', f104, 'surface state of wall level 8', aa, 'ESTMExt', 0), &
1134 varattr('St_Wall_9', 'mm', f104, 'surface state of wall level 9', aa, 'ESTMExt', 0), &
1135 varattr('St_Wall_10', 'mm', f104, 'surface state of wall level 10', aa, 'ESTMExt', 0), &
1136 varattr('St_Wall_11', 'mm', f104, 'surface state of wall level 11', aa, 'ESTMExt', 0), &
1137 varattr('St_Wall_12', 'mm', f104, 'surface state of wall level 12', aa, 'ESTMExt', 0), &
1138 varattr('St_Wall_13', 'mm', f104, 'surface state of wall level 13', aa, 'ESTMExt', 0), &
1139 varattr('St_Wall_14', 'mm', f104, 'surface state of wall level 14', aa, 'ESTMExt', 0), &
1140 varattr('St_Wall_15', 'mm', f104, 'surface state of wall level 15', aa, 'ESTMExt', 0), &
1141 varattr('SS_Wall_1', 'mm', f104, 'soil store of wall level 1', aa, 'ESTMExt', 0), &
1142 varattr('SS_Wall_2', 'mm', f104, 'soil store of wall level 2', aa, 'ESTMExt', 0), &
1143 varattr('SS_Wall_3', 'mm', f104, 'soil store of wall level 3', aa, 'ESTMExt', 0), &
1144 varattr('SS_Wall_4', 'mm', f104, 'soil store of wall level 4', aa, 'ESTMExt', 0), &
1145 varattr('SS_Wall_5', 'mm', f104, 'soil store of wall level 5', aa, 'ESTMExt', 0), &
1146 varattr('SS_Wall_6', 'mm', f104, 'soil store of wall level 6', aa, 'ESTMExt', 0), &
1147 varattr('SS_Wall_7', 'mm', f104, 'soil store of wall level 7', aa, 'ESTMExt', 0), &
1148 varattr('SS_Wall_8', 'mm', f104, 'soil store of wall level 8', aa, 'ESTMExt', 0), &
1149 varattr('SS_Wall_9', 'mm', f104, 'soil store of wall level 9', aa, 'ESTMExt', 0), &
1150 varattr('SS_Wall_10', 'mm', f104, 'soil store of wall level 10', aa, 'ESTMExt', 0), &
1151 varattr('SS_Wall_11', 'mm', f104, 'soil store of wall level 11', aa, 'ESTMExt', 0), &
1152 varattr('SS_Wall_12', 'mm', f104, 'soil store of wall level 12', aa, 'ESTMExt', 0), &
1153 varattr('SS_Wall_13', 'mm', f104, 'soil store of wall level 13', aa, 'ESTMExt', 0), &
1154 varattr('SS_Wall_14', 'mm', f104, 'soil store of wall level 14', aa, 'ESTMExt', 0), &
1155 varattr('SS_Wall_15', 'mm', f104, 'soil store of wall level 15', aa, 'ESTMExt', 0) &
1156 /
1157
1158CONTAINS
1159 ! main wrapper that handles both txt and nc files
1160 SUBROUTINE suews_output(irMax, iv, Gridiv, iyr)
1161 IMPLICIT NONE
1162 INTEGER, INTENT(in) :: irMax
1163! #ifdef nc
1164! INTEGER, INTENT(in), OPTIONAL ::iv, Gridiv, iyr
1165! #else
1166 INTEGER, INTENT(in) :: iv, Gridiv, iyr
1167! #endif
1168
1169 INTEGER :: n_group_use, err, outLevel, i
1170 TYPE(varattr), DIMENSION(:), ALLOCATABLE :: varListX
1171 CHARACTER(len=10) :: groupList0(10)
1172 CHARACTER(len=10), DIMENSION(:), ALLOCATABLE :: grpList
1173 LOGICAL :: groupCond(10)
1174
1175 ! determine outLevel
1176 SELECT CASE (writeoutoption)
1177 CASE (0) !all (not snow-related)
1178 outlevel = 1
1179 CASE (1) !all plus snow-related
1180 outlevel = 2
1181 CASE (2) !minimal output
1182 outlevel = 0
1183 END SELECT
1184
1185 ! determine groups to output
1186 ! TODO: needs to be smarter, automate this filtering
1187 grouplist0(1) = 'SUEWS'
1188 grouplist0(2) = 'BEERS'
1189 grouplist0(3) = 'BL'
1190 grouplist0(4) = 'snow'
1191 grouplist0(5) = 'ESTM'
1192 grouplist0(6) = 'DailyState'
1193 grouplist0(7) = 'RSL'
1194 grouplist0(8) = 'debug'
1195 grouplist0(9) = 'SPARTACUS'
1196 grouplist0(10) = 'ESTMExt'
1197 groupcond = [ &
1198 .true., &
1199 .true., &
1200 cbluse >= 1, &
1201 snowuse >= 1, &
1202 storageheatmethod == 4 .OR. storageheatmethod == 14, &
1203 .true., &
1204 .true., &
1205 .true., &
1206 .true., &
1207 storageheatmethod == 5 &
1208 ]
1209 n_group_use = count(groupcond)
1210
1211 ! PRINT*, grpList0,xx
1212
1213 ALLOCATE (grplist(n_group_use), stat=err)
1214 IF (err /= 0) print *, "grpList: Allocation request denied"
1215
1216 grplist = pack(grouplist0, mask=groupcond)
1217
1218 ! PRINT*, grpList,SIZE(grpList, dim=1)
1219
1220 ! loop over all groups
1221 DO i = 1, SIZE(grplist), 1
1222 !PRINT*, 'i',i
1223 n_group_use = count(varlistall%group == trim(grplist(i)), dim=1)
1224 ! PRINT*, 'number of variables:',xx, 'in group: ',grpList(i)
1225 ! print*, 'all group names: ',varList%group
1226 ALLOCATE (varlistx(5 + n_group_use), stat=err)
1227 IF (err /= 0) print *, "varListX: Allocation request denied"
1228 ! datetime
1229 varlistx(1:5) = varlistall(1:5)
1230 ! variable
1231 varlistx(6:5 + n_group_use) = pack(varlistall, mask=(varlistall%group == trim(grplist(i))))
1232
1233 IF (trim(varlistx(SIZE(varlistx))%group) /= 'DailyState') THEN
1234 ! all output arrays but DailyState
1235 ! all output frequency option:
1236 ! as forcing:
1237 IF (resolutionfilesout == tstep .OR. keeptstepfilesout == 1) THEN
1238 CALL suews_output_txt_grp(iv, irmax, iyr, varlistx, gridiv, outlevel, tstep)
1239 END IF
1240 ! as specified ResolutionFilesOut:
1241 IF (resolutionfilesout /= tstep) THEN
1242 CALL suews_output_txt_grp(iv, irmax, iyr, varlistx, gridiv, outlevel, resolutionfilesout)
1243 END IF
1244 ELSE
1245 ! DailyState array, which does not need aggregation
1246 CALL suews_output_txt_grp(iv, irmax, iyr, varlistx, gridiv, outlevel, tstep)
1247
1248 END IF
1249
1250 IF (ALLOCATED(varlistx)) DEALLOCATE (varlistx, stat=err)
1251 IF (err /= 0) print *, "varListX: Deallocation request denied"
1252 ! PRINT*, 'i',i,'end'
1253
1254 END DO
1255 END SUBROUTINE suews_output
1256
1257 ! output wrapper function for one group
1258 SUBROUTINE suews_output_txt_grp(iv, irMax, iyr, varListX, Gridiv, outLevel, outFreq_s)
1259 IMPLICIT NONE
1260
1261 TYPE(varattr), DIMENSION(:), INTENT(in) :: varListX
1262 INTEGER, INTENT(in) :: iv, irMax, iyr, Gridiv, outLevel, outFreq_s
1263
1264 INTEGER :: err
1265 INTEGER :: n_var
1266
1267 INTEGER, DIMENSION(:), ALLOCATABLE :: id_seq ! id sequence as in the dataOutX/dataOutX_agg
1268 REAL(KIND(1D0)), DIMENSION(:, :), ALLOCATABLE :: dataOutX
1269 REAL(KIND(1D0)), DIMENSION(:, :), ALLOCATABLE :: dataOutX_agg
1270
1271 ! number of varialbes for output
1272 n_var = SIZE(varlistx)
1273
1274 IF (.NOT. ALLOCATED(dataoutx)) THEN
1275 ALLOCATE (dataoutx(irmax, n_var), stat=err)
1276 IF (err /= 0) print *, "dataOutX: Allocation request denied"
1277 END IF
1278
1279 ! determine dataOutX array according to variable group
1280 SELECT CASE (trim(varlistx(n_var)%group))
1281 CASE ('SUEWS') !default
1282 dataoutx = dataoutsuews(1:irmax, 1:n_var, gridiv)
1283
1284 CASE ('BEERS') !SOLWEIG
1285 dataoutx = dataoutbeers(1:irmax, 1:n_var, gridiv)
1286 ! dataOutX = dataOutSOLWEIG(1:irMax, 1:n_var, Gridiv)
1287
1288 CASE ('BL') !BL
1289 dataoutx = dataoutbl(1:irmax, 1:n_var, gridiv)
1290
1291 CASE ('snow') !snow
1292 dataoutx = dataoutsnow(1:irmax, 1:n_var, gridiv)
1293
1294 CASE ('ESTM') !ESTM
1295 dataoutx = dataoutestm(1:irmax, 1:n_var, gridiv)
1296
1297 CASE ('RSL') !RSL
1298 dataoutx = dataoutrsl(1:irmax, 1:n_var, gridiv)
1299
1300 CASE ('debug') !debug
1301 dataoutx = dataoutdebug(1:irmax, 1:n_var, gridiv)
1302
1303 CASE ('SPARTACUS') !SPARTACUS
1304 dataoutx = dataoutspartacus(1:irmax, 1:n_var, gridiv)
1305
1306 CASE ('ESTMExt') !ESTMExt
1307 dataoutx = dataoutestmext(1:irmax, 1:n_var, gridiv)
1308
1309 CASE ('DailyState') !DailyState
1310 ! get correct day index
1311 CALL unique(int(pack(dataoutsuews(1:irmax, 2, gridiv), &
1312 mask=(dataoutsuews(1:irmax, 3, gridiv) == 23 &
1313 .AND. dataoutsuews(1:irmax, 4, gridiv) == (nsh - 1.)/nsh*60))), &
1314 id_seq)
1315
1316 IF (ALLOCATED(dataoutx)) THEN
1317 DEALLOCATE (dataoutx)
1318 IF (err /= 0) print *, "dataOutX: Deallocation request denied"
1319 END IF
1320
1321 IF (.NOT. ALLOCATED(dataoutx)) THEN
1322 ALLOCATE (dataoutx(SIZE(id_seq), n_var), stat=err)
1323 IF (err /= 0) print *, "dataOutX: Allocation request denied"
1324 END IF
1325
1326 dataoutx = dataoutdailystate(id_seq, 1:n_var, gridiv)
1327 ! print*, id_seq
1328 ! print*, dataOutDailyState(id_seq,1:SIZE(varListX),Gridiv)
1329 ! print*, 1/(nsh-nsh)
1330 END SELECT
1331
1332 ! aggregation:
1333 ! aggregation is done for every group but 'DailyState'
1334 IF (trim(varlistx(SIZE(varlistx))%group) /= 'DailyState') THEN
1335
1336 CALL suews_output_agg(dataoutx_agg, dataoutx, varlistx, irmax, outfreq_s)
1337 ELSE
1338 IF (.NOT. ALLOCATED(dataoutx_agg)) THEN
1339 ALLOCATE (dataoutx_agg(SIZE(dataoutx, dim=1), SIZE(varlistx)), stat=err)
1340 IF (err /= 0) print *, ": Allocation request denied"
1341 END IF
1342 dataoutx_agg = dataoutx
1343 END IF
1344
1345 ! output:
1346 ! initialise file when processing first metblock
1347 IF (iv == 1) CALL suews_output_init(dataoutx_agg, varlistx, iyr, gridiv, outlevel)
1348
1349 ! append the aggregated data to the specific txt file
1350 CALL suews_write_txt(dataoutx_agg, varlistx, iyr, gridiv, outlevel)
1351
1352 END SUBROUTINE suews_output_txt_grp
1353
1354 ! initialise an output file with file name and headers
1355 SUBROUTINE suews_output_init(dataOutX, varList, iyr, Gridiv, outLevel)
1356 IMPLICIT NONE
1357 REAL(KIND(1D0)), DIMENSION(:, :), INTENT(in) :: dataOutX
1358 TYPE(varattr), DIMENSION(:), INTENT(in) :: varList
1359 INTEGER, INTENT(in) :: iyr, Gridiv, outLevel
1360
1361 TYPE(varattr), DIMENSION(:), ALLOCATABLE :: varListSel
1362 INTEGER :: xx, err, fn, i, nargs
1363 CHARACTER(len=365) :: FileOutX
1364 CHARACTER(len=3) :: itextX
1365 CHARACTER(len=6) :: args(5)
1366 CHARACTER(len=16*SIZE(varList)) :: FormatOut
1367 CHARACTER(len=16) :: formatX
1368 CHARACTER(len=16), DIMENSION(:), ALLOCATABLE :: headerOut
1369
1370 ! select variables to output
1371 xx = count((varlist%level <= outlevel), dim=1)
1372 WRITE (itextx, '(i3)') xx
1373 ALLOCATE (varlistsel(xx), stat=err)
1374 IF (err /= 0) print *, "varListSel: Allocation request denied"
1375 varlistsel = pack(varlist, mask=(varlist%level <= outlevel))
1376
1377 ! generate file name
1378 CALL filename_gen(dataoutx, varlist, iyr, gridiv, fileoutx)
1379
1380 ! store right-aligned headers
1381 ALLOCATE (headerout(xx), stat=err)
1382 IF (err /= 0) print *, "headerOut: Allocation request denied"
1383
1384 ! create format string:
1385 DO i = 1, SIZE(varlistsel)
1386 CALL parse(varlistsel(i)%fmt, 'if.,', args, nargs)
1387 formatx = adjustl('(a'//trim(args(2))//',1x)')
1388 ! adjust headers to right-aligned
1389 WRITE (headerout(i), formatx) adjustr(trim(adjustl(varlistsel(i)%header)))
1390 IF (i == 1) THEN
1391 formatout = adjustl(trim(formatx))
1392 ELSE
1393 formatout = trim(formatout)//' '//adjustl(trim(formatx))
1394 END IF
1395 END DO
1396 formatout = '('//trim(adjustl(formatout))//')'
1397
1398 ! create file
1399 fn = 9
1400 OPEN (fn, file=trim(adjustl(fileoutx)), status='unknown')
1401 ! PRINT*, 'FileOutX in SUEWS_Output_Init: ',FileOutX
1402
1403 ! write out headers
1404 WRITE (fn, formatout) headerout
1405 CLOSE (fn)
1406
1407 ! write out format file
1408 CALL formatfile_gen(dataoutx, varlist, iyr, gridiv, outlevel)
1409
1410 ! clean up
1411 IF (ALLOCATED(varlistsel)) DEALLOCATE (varlistsel, stat=err)
1412 IF (err /= 0) print *, "varListSel: Deallocation request denied"
1413 IF (ALLOCATED(headerout)) DEALLOCATE (headerout, stat=err)
1414 IF (err /= 0) print *, "headerOut: Deallocation request denied"
1415
1416 END SUBROUTINE suews_output_init
1417
1418 ! generate output format file
1419 SUBROUTINE formatfile_gen(dataOutX, varList, iyr, Gridiv, outLevel)
1420 IMPLICIT NONE
1421 REAL(KIND(1D0)), DIMENSION(:, :), INTENT(in) :: dataOutX
1422 TYPE(varattr), DIMENSION(:), INTENT(in) :: varList
1423 INTEGER, INTENT(in) :: iyr, Gridiv, outLevel
1424
1425 TYPE(varattr), DIMENSION(:), ALLOCATABLE :: varListSel
1426 INTEGER :: xx, err, fn, i
1427 CHARACTER(len=365) :: FileOutX
1428 CHARACTER(len=100*300) :: str_cat
1429 CHARACTER(len=100) :: str_x = ''
1430 CHARACTER(len=3) :: itextX
1431
1432 ! get filename
1433 CALL filename_gen(dataoutx, varlist, iyr, gridiv, fileoutx, 1)
1434
1435 !select variables to output
1436 xx = count((varlist%level <= outlevel), dim=1)
1437 ALLOCATE (varlistsel(xx), stat=err)
1438 IF (err /= 0) print *, "varListSel: Allocation request denied"
1439 varlistsel = pack(varlist, mask=(varlist%level <= outlevel))
1440
1441 ! create file
1442 fn = 9
1443 OPEN (fn, file=trim(adjustl(fileoutx)), status='unknown')
1444
1445 ! write out format strings
1446 ! column number:
1447 str_cat = ''
1448 DO i = 1, SIZE(varlistsel)
1449 WRITE (itextx, '(i3)') i
1450 IF (i == 1) THEN
1451 str_cat = trim(adjustl(itextx))
1452 ELSE
1453 str_cat = trim(str_cat)//';'//adjustl(itextx)
1454 END IF
1455 END DO
1456 WRITE (fn, '(a)') trim(str_cat)
1457
1458 ! header:
1459 str_cat = ''
1460 DO i = 1, SIZE(varlistsel)
1461 str_x = varlistsel(i)%header
1462 IF (i == 1) THEN
1463 str_cat = trim(adjustl(str_x))
1464 ELSE
1465 str_cat = trim(str_cat)//';'//adjustl(str_x)
1466 END IF
1467 END DO
1468 WRITE (fn, '(a)') trim(str_cat)
1469
1470 ! long name:
1471 str_cat = ''
1472 DO i = 1, SIZE(varlistsel)
1473 str_x = varlistsel(i)%longNm
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 ! unit:
1483 str_cat = ''
1484 DO i = 1, SIZE(varlistsel)
1485 str_x = varlistsel(i)%unit
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 ! format:
1495 str_cat = ''
1496 DO i = 1, SIZE(varlistsel)
1497 str_x = varlistsel(i)%fmt
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 ! aggregation method:
1507 str_cat = ''
1508 DO i = 1, SIZE(varlistsel)
1509 str_x = varlistsel(i)%aggreg
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 ! close file
1519 CLOSE (fn)
1520
1521 ! clean up
1522 IF (ALLOCATED(varlistsel)) DEALLOCATE (varlistsel, stat=err)
1523 IF (err /= 0) print *, "varListSel: Deallocation request denied"
1524
1525 END SUBROUTINE formatfile_gen
1526
1527 ! aggregate data to specified resolution
1528 SUBROUTINE suews_output_agg(dataOut_agg, dataOutX, varList, irMax, outFreq_s)
1529 IMPLICIT NONE
1530 REAL(KIND(1D0)), DIMENSION(:, :), INTENT(in) :: dataOutX
1531 TYPE(varattr), DIMENSION(:), INTENT(in) :: varList
1532 INTEGER, INTENT(in) :: irMax, outFreq_s
1533 REAL(KIND(1D0)), DIMENSION(:, :), ALLOCATABLE, INTENT(out) :: dataOut_agg
1534
1535 INTEGER :: nlinesOut, i, j, x
1536 REAL(KIND(1D0)) :: dataOut_aggX(1:SIZE(varList))
1537 REAL(KIND(1D0)), DIMENSION(:, :), ALLOCATABLE :: dataOut_agg0
1538 nlinesout = int(nsh/(60.*60/outfreq_s))
1539 ! nGrid=SIZE(dataOutX, dim=3)
1540
1541 ALLOCATE (dataout_agg(int(irmax/nlinesout), SIZE(varlist)))
1542 ALLOCATE (dataout_agg0(nlinesout, SIZE(varlist)))
1543
1544 DO i = nlinesout, irmax, nlinesout
1545 x = i/nlinesout
1546 dataout_agg0 = dataoutx(i - nlinesout + 1:i, :)
1547 DO j = 1, SIZE(varlist), 1
1548 IF (diagnose == 1) THEN
1549 print *, "aggregating variable ", j, " of ", varlist(j)%header, 'in group ', varlist(j)%group
1550 END IF
1551 ! aggregating different variables
1552 SELECT CASE (varlist(j)%aggreg)
1553 CASE (at) !time columns, aT
1554 dataout_aggx(j) = dataout_agg0(nlinesout, j)
1555 CASE (aa) !average, aA
1556 dataout_aggx(j) = sum(dataout_agg0(:, j))/nlinesout
1557 CASE (as) !sum, aS
1558 dataout_aggx(j) = sum(dataout_agg0(:, j))
1559 CASE (al) !last value, aL
1560 dataout_aggx(j) = dataout_agg0(nlinesout, j)
1561 END SELECT
1562
1563 IF (diagnose == 1 .AND. i == irmax) THEN
1564 ! IF ( i==irMax ) THEN
1565 print *, 'raw data of ', j, ':'
1566 print *, dataout_agg0(:, j)
1567 print *, 'aggregated with method: ', varlist(j)%aggreg
1568 print *, dataout_aggx(j)
1569 print *, ''
1570 END IF
1571 END DO
1572 dataout_agg(x, :) = dataout_aggx
1573 END DO
1574
1575 END SUBROUTINE suews_output_agg
1576
1577 ! append output data to the specific file at the specified outLevel
1578 SUBROUTINE suews_write_txt(dataOutX, varList, iyr, Gridiv, outLevel)
1579 IMPLICIT NONE
1580 REAL(KIND(1D0)), DIMENSION(:, :), INTENT(in) :: dataOutX
1581 TYPE(varattr), DIMENSION(:), INTENT(in) :: varList
1582 INTEGER, INTENT(in) :: iyr, Gridiv, outLevel
1583
1584 REAL(KIND(1D0)), DIMENSION(:, :), ALLOCATABLE :: dataOutSel
1585 TYPE(varattr), DIMENSION(:), ALLOCATABLE :: varListSel
1586 CHARACTER(len=365) :: FileOutX
1587 INTEGER :: fn, i, xx, err
1588 INTEGER :: sizeVarListSel, sizedataOutX
1589 CHARACTER(len=12*SIZE(varList)) :: FormatOut
1590 ! LOGICAL :: initQ_file
1591 formatout = ''
1592
1593 IF (diagnose == 1) WRITE (*, *) 'Writting data of group: ', varlist(SIZE(varlist))%group
1594
1595 !select variables to output
1596 sizevarlistsel = count((varlist%level <= outlevel), dim=1)
1597 ALLOCATE (varlistsel(sizevarlistsel), stat=err)
1598 IF (err /= 0) print *, "varListSel: Allocation request denied"
1599 varlistsel = pack(varlist, mask=(varlist%level <= outlevel))
1600
1601 ! copy data accordingly
1602 sizedataoutx = SIZE(dataoutx, dim=1)
1603 ALLOCATE (dataoutsel(sizedataoutx, sizevarlistsel), stat=err)
1604 IF (err /= 0) print *, "dataOutSel: Allocation request denied"
1605 ! print*, SIZE(varList%level),PACK((/(i,i=1,SIZE(varList%level))/), varList%level <= outLevel)
1606 ! print*, irMax,shape(dataOutX)
1607 dataoutsel = dataoutx(:, pack((/(i, i=1, SIZE(varlist%level))/), varlist%level <= outlevel))
1608 ! do i = 1, 5
1609 ! print*, 'first several lines of dataOutX:', i, dataOutX(i,:)
1610
1611 ! end do
1612
1613 ! create format string:
1614 DO i = 1, sizevarlistsel
1615 ! PRINT*,''
1616 ! PRINT*,i
1617 ! PRINT*, LEN_TRIM(FormatOut),TRIM(FormatOut)
1618 ! PRINT*, LEN_TRIM(TRIM(FormatOut)//','),TRIM(FormatOut)//','
1619 IF (i == 1) THEN
1620 ! FormatOut=ADJUSTL(varListSel(i)%fmt)
1621 formatout = varlistsel(i)%fmt
1622 ELSE
1623
1624 ! FormatOut=TRIM(FormatOut)//','//ADJUSTL(varListSel(i)%fmt)
1625 formatout = trim(formatout)//','//trim(varlistsel(i)%fmt)
1626 END IF
1627 ! PRINT*,''
1628 ! PRINT*,i
1629 ! PRINT*, 'FormatOut',FormatOut
1630 END DO
1631 formatout = '('//trim(adjustl(formatout))//')'
1632
1633 ! get filename
1634 CALL filename_gen(dataoutsel, varlistsel, iyr, gridiv, fileoutx)
1635 ! PRINT*, 'FileOutX in SUEWS_Write_txt: ',FileOutX
1636
1637 ! test if FileOutX has been initialised
1638 ! IF ( .NOT. initQ_file(FileOutX) ) THEN
1639 ! CALL SUEWS_Output_Init(dataOutSel,varListSel,Gridiv,outLevel)
1640 ! END IF
1641
1642 ! write out data
1643 fn = 50
1644 OPEN (fn, file=trim(fileoutx), position='append') !,err=112)
1645 DO i = 1, sizedataoutx
1646 ! PRINT*, 'Writting line',i
1647 ! PRINT*, 'FormatOut in writing',FormatOut
1648 ! PRINT*, dataOutSel(i,1:sizeVarListSel)
1649 WRITE (fn, formatout) &
1650 (int(dataoutsel(i, xx)), xx=1, 4), &
1651 (dataoutsel(i, xx), xx=5, sizevarlistsel)
1652 END DO
1653 CLOSE (fn)
1654
1655 IF (ALLOCATED(varlistsel)) DEALLOCATE (varlistsel, stat=err)
1656 IF (err /= 0) print *, "varListSel: Deallocation request denied"
1657
1658 IF (ALLOCATED(dataoutsel)) DEALLOCATE (dataoutsel, stat=err)
1659 IF (err /= 0) print *, "dataOutSel: Deallocation request denied"
1660
1661 END SUBROUTINE suews_write_txt
1662
1663 SUBROUTINE filename_gen(dataOutX, varList, iyr, Gridiv, FileOutX, opt_fmt)
1664 USE datetime_module
1665
1666 IMPLICIT NONE
1667 REAL(KIND(1D0)), DIMENSION(:, :), INTENT(in) :: dataOutX ! to determine year & output frequency
1668 TYPE(varattr), DIMENSION(:), INTENT(in) :: varList ! to determine output group
1669 INTEGER, INTENT(in) :: iyr ! to determine year
1670 INTEGER, INTENT(in) :: Gridiv ! to determine grid name as in SiteSelect
1671 INTEGER, INTENT(in), OPTIONAL :: opt_fmt ! to determine if a format file
1672 CHARACTER(len=365), INTENT(out) :: FileOutX ! the output file name
1673
1674 CHARACTER(len=20) :: str_out_min, str_grid, &
1675 str_date, str_year, str_DOY, str_grp, str_sfx
1676 INTEGER :: year_int, DOY_int, val_fmt, delta_t_min
1677 TYPE(datetime) :: dt1, dt2
1678 TYPE(timedelta) :: dt_x
1679
1680 ! initialise with a default value
1681 val_fmt = -999
1682
1683 IF (PRESENT(opt_fmt)) val_fmt = opt_fmt
1684
1685 ! PRINT*, varList(:)%header
1686 ! PRINT*, 'dataOutX(1)',dataOutX(1,:)
1687
1688 ! date:
1689 doy_int = int(dataoutx(1, 2))
1690 WRITE (str_doy, '(i3.3)') doy_int
1691
1692! #ifdef nc
1693! ! year for nc use that in dataOutX
1694! year_int = INT(dataOutX(1, 1))
1695! WRITE (str_year, '(i4)') year_int
1696! str_date = '_'//TRIM(ADJUSTL(str_year))
1697! ! add DOY as a specifier
1698! IF (ncMode == 1) str_date = TRIM(ADJUSTL(str_date))//TRIM(ADJUSTL(str_DOY))
1699! #endif
1700
1701 ! year for txt use specified value to avoid conflicts when crossing years
1702 year_int = iyr
1703 WRITE (str_year, '(i4)') year_int
1704 str_date = '_'//trim(adjustl(str_year))
1705
1706 ! output frequency in minute:
1707 IF (varlist(6)%group == 'DailyState') THEN
1708 str_out_min = '' ! ignore this for DailyState
1709 ELSE
1710 ! derive output frequency from output arrays
1711 ! dt_x=
1712 dt1 = datetime(int(dataoutx(1, 1)), 1, 1) + &
1713 timedelta(days=int(dataoutx(1, 2) - 1), &
1714 hours=int(dataoutx(1, 3)), &
1715 minutes=int(dataoutx(1, 4)))
1716
1717 dt2 = datetime(int(dataoutx(2, 1)), 1, 1) + &
1718 timedelta(days=int(dataoutx(2, 2) - 1), &
1719 hours=int(dataoutx(2, 3)), &
1720 minutes=int(dataoutx(2, 4)))
1721
1722 dt_x = dt2 - dt1
1723 delta_t_min = int(dt_x%total_seconds()/60)
1724 WRITE (str_out_min, '(i4)') delta_t_min
1725 str_out_min = '_'//trim(adjustl(str_out_min))
1726 END IF
1727
1728 ! group: output type
1729 str_grp = varlist(6)%group
1730 IF (len(trim(str_grp)) > 0) str_grp = '_'//trim(adjustl(str_grp))
1731
1732 ! grid name:
1733 WRITE (str_grid, '(i10)') grididmatrix(gridiv)
1734! #ifdef nc
1735! IF (ncMode == 1) str_grid = '' ! grid name not needed by nc files
1736! #endif
1737
1738 ! suffix:
1739 str_sfx = '.txt'
1740! #ifdef nc
1741! IF (ncMode == 1) str_sfx = '.nc'
1742! #endif
1743
1744 ! filename: FileOutX
1745 fileoutx = trim(fileoutputpath)// &
1746 trim(filecode)// &
1747 trim(adjustl(str_grid))// &
1748 trim(adjustl(str_date))// &
1749 trim(adjustl(str_grp))// &
1750 trim(adjustl(str_out_min))// &
1751 trim(adjustl(str_sfx))
1752
1753 ! filename: format
1754 IF (val_fmt == 1) THEN
1755 fileoutx = trim(fileoutputpath)// &
1756 trim(filecode)// &
1757 trim(adjustl(str_grp))// &
1758 '_OutputFormat.txt'
1759 END IF
1760
1761 END SUBROUTINE filename_gen
1762
1763 SUBROUTINE unique(vec, vec_unique)
1764 ! Return only the unique values from vec.
1765
1766 IMPLICIT NONE
1767
1768 INTEGER, DIMENSION(:), INTENT(in) :: vec
1769 INTEGER, DIMENSION(:), ALLOCATABLE, INTENT(out) :: vec_unique
1770
1771 INTEGER :: i, num
1772 LOGICAL, DIMENSION(SIZE(vec)) :: mask
1773
1774 mask = .false.
1775
1776 DO i = 1, SIZE(vec)
1777
1778 !count the number of occurrences of this element:
1779 num = count(vec(i) == vec)
1780
1781 IF (num == 1) THEN
1782 !there is only one, flag it:
1783 mask(i) = .true.
1784 ELSE
1785 !flag this value only if it hasn't already been flagged:
1786 IF (.NOT. any(vec(i) == vec .AND. mask)) mask(i) = .true.
1787 END IF
1788
1789 END DO
1790
1791 !return only flagged elements:
1792 ALLOCATE (vec_unique(count(mask)))
1793 vec_unique = pack(vec, mask)
1794
1795 !if you also need it sorted, then do so.
1796 ! For example, with slatec routine:
1797 !call ISORT (vec_unique, [0], size(vec_unique), 1)
1798
1799 END SUBROUTINE unique
1800
1801 ! test if a txt file has been initialised
1802 LOGICAL FUNCTION initq_file(FileName)
1803 IMPLICIT NONE
1804 CHARACTER(len=365), INTENT(in) :: filename ! the output file name
1805 LOGICAL :: existq
1806 CHARACTER(len=1000) :: longstring
1807
1808 INQUIRE (file=trim(filename), exist=existq)
1809 IF (existq) THEN
1810 OPEN (10, file=trim(filename))
1811 READ (10, '(a)') longstring
1812 ! print*, 'longstring: ',longstring
1813 IF (verify(longstring, 'Year') == 0) initq_file = .false.
1814 CLOSE (unit=10)
1815 ELSE
1816 initq_file = .false.
1817 END IF
1818
1819 END FUNCTION initq_file
1820
1821 !========================================================================================
1822 FUNCTION count_lines(filename) RESULT(nlines)
1823 ! count the number of valid lines in a file
1824 ! invalid line starting with -9
1825
1826 !========================================================================================
1827 IMPLICIT NONE
1828 CHARACTER(len=*) :: filename
1829 INTEGER :: nlines
1830 INTEGER :: io, iv
1831
1832 OPEN (10, file=filename, iostat=io, status='old')
1833
1834 ! if io error found, report iostat and exit
1835 IF (io /= 0) THEN
1836 print *, 'io', io, 'for', filename
1837 stop 'Cannot open file! '
1838 END IF
1839
1840 nlines = 0
1841 DO
1842 READ (10, *, iostat=io) iv
1843 IF (io < 0 .OR. iv == -9) EXIT
1844
1845 nlines = nlines + 1
1846 END DO
1847 CLOSE (10)
1848 nlines = nlines - 1 ! skip header
1849 END FUNCTION count_lines
1850
1851 !===========================================================================!
1852 ! write the output of final SUEWS results in netCDF
1853 ! with spatial layout of QGIS convention
1854 ! the spatial matrix arranges successive rows down the page (i.e., north to south)
1855 ! and succesive columns across (i.e., west to east)
1856 ! the output file frequency is the same as metblocks in the main SUEWS loop
1857 !===========================================================================!
1858
1859! #ifdef nc
1860
1861! SUBROUTINE SUEWS_Output_nc_grp(irMax, varList, outLevel, outFreq_s)
1862! IMPLICIT NONE
1863
1864! TYPE(varAttr), DIMENSION(:), INTENT(in)::varList
1865! INTEGER, INTENT(in) :: irMax, outLevel, outFreq_s
1866
1867! REAL(KIND(1d0)), ALLOCATABLE::dataOutX(:, :, :)
1868! REAL(KIND(1d0)), ALLOCATABLE::dataOutX_agg(:, :, :), dataOutX_agg0(:, :)
1869! INTEGER :: iGrid, err, idMin, idMax
1870! INTEGER, DIMENSION(:), ALLOCATABLE ::id_seq
1871
1872! IF (.NOT. ALLOCATED(dataOutX)) THEN
1873! ALLOCATE (dataOutX(irMax, SIZE(varList), NumberOfGrids), stat=err)
1874! IF (err /= 0) PRINT *, "dataOutX: Allocation request denied"
1875! ENDIF
1876
1877! ! determine dataOutX array according to variable group
1878! SELECT CASE (TRIM(varList(SIZE(varList))%group))
1879! CASE ('SUEWS') !default
1880! dataOutX = dataOutSUEWS(1:irMax, 1:SIZE(varList), :)
1881
1882! CASE ('BEERS') !SOLWEIG
1883! ! todo: inconsistent data structure
1884! dataOutX = dataOutSOLWEIG(1:irMax, 1:SIZE(varList), :)
1885
1886! CASE ('BL') !BL
1887! dataOutX = dataOutBL(1:irMax, 1:SIZE(varList), :)
1888
1889! CASE ('snow') !snow
1890! dataOutX = dataOutSnow(1:irMax, 1:SIZE(varList), :)
1891
1892! CASE ('ESTM') !ESTM
1893! dataOutX = dataOutESTM(1:irMax, 1:SIZE(varList), :)
1894
1895! CASE ('DailyState') !DailyState
1896! ! get correct day index
1897! CALL unique(INT(PACK(dataOutSUEWS(1:irMax, 2, 1), &
1898! mask=(dataOutSUEWS(1:irMax, 3, Gridiv) == 23 &
1899! .AND. dataOutSUEWS(1:irMax, 4, Gridiv) == (nsh - 1)/nsh*60))), &
1900! id_seq)
1901! IF (ALLOCATED(dataOutX)) THEN
1902! DEALLOCATE (dataOutX)
1903! IF (err /= 0) PRINT *, "dataOutX: Deallocation request denied"
1904! ENDIF
1905
1906! IF (.NOT. ALLOCATED(dataOutX)) THEN
1907! ALLOCATE (dataOutX(SIZE(id_seq), SIZE(varList), NumberOfGrids), stat=err)
1908! IF (err /= 0) PRINT *, "dataOutX: Allocation request denied"
1909! ENDIF
1910
1911! dataOutX = dataOutDailyState(id_seq, 1:SIZE(varList), :)
1912! ! print*, 'idMin line',dataOutX(idMin,1:4,1)
1913! ! print*, 'idMax line',dataOutX(idMax,1:4,1)
1914
1915! END SELECT
1916
1917! ! aggregation:
1918! IF (TRIM(varList(SIZE(varList))%group) /= 'DailyState') THEN
1919! DO iGrid = 1, NumberOfGrids
1920! CALL SUEWS_Output_Agg(dataOutX_agg0, dataOutX(:, :, iGrid), varList, irMax, outFreq_s)
1921! IF (.NOT. ALLOCATED(dataOutX_agg)) THEN
1922! ALLOCATE (dataOutX_agg(SIZE(dataOutX_agg0, dim=1), SIZE(varList), NumberOfGrids), stat=err)
1923! IF (err /= 0) PRINT *, ": Allocation request denied"
1924! ENDIF
1925! dataOutX_agg(:, :, iGrid) = dataOutX_agg0
1926! END DO
1927! ELSE
1928! IF (.NOT. ALLOCATED(dataOutX_agg)) THEN
1929! ALLOCATE (dataOutX_agg(SIZE(dataOutX, dim=1), SIZE(varList), NumberOfGrids), stat=err)
1930! IF (err /= 0) PRINT *, ": Allocation request denied"
1931! ENDIF
1932! dataOutX_agg = dataOutX
1933! ENDIF
1934
1935! ! write out data
1936! CALL SUEWS_Write_nc(dataOutX_agg, varList, outLevel)
1937! IF (ALLOCATED(dataOutX_agg)) THEN
1938! DEALLOCATE (dataOutX_agg)
1939! IF (err /= 0) PRINT *, "dataOutX_agg: Deallocation request denied"
1940! ENDIF
1941! END SUBROUTINE SUEWS_Output_nc_grp
1942
1943! ! SUBROUTINE SUEWS_Write_nc(dataOutX, varList, outLevel)
1944! ! ! generic subroutine to write out data in netCDF format
1945! ! USE netCDF
1946
1947! ! IMPLICIT NONE
1948! ! REAL(KIND(1d0)), DIMENSION(:, :, :), INTENT(in)::dataOutX
1949! ! TYPE(varAttr), DIMENSION(:), INTENT(in)::varList
1950! ! INTEGER, INTENT(in) :: outLevel
1951
1952! ! CHARACTER(len=365):: fileOut
1953! ! REAL(KIND(1d0)), DIMENSION(:, :, :), ALLOCATABLE::dataOutSel
1954! ! TYPE(varAttr), DIMENSION(:), ALLOCATABLE::varListSel
1955
1956! ! ! We are writing 3D data, {time, y, x}
1957! ! INTEGER, PARAMETER :: NDIMS = 3, iVarStart = 6
1958! ! INTEGER :: NX, NY, nTime, nVar, err
1959
1960! ! ! When we create netCDF files, variables and dimensions, we get back
1961! ! ! an ID for each one.
1962! ! INTEGER :: ncID, varID, dimids(NDIMS), varIDGrid
1963! ! INTEGER :: x_dimid, y_dimid, time_dimid, iVar, varIDx, varIDy, varIDt, varIDCRS
1964! ! REAL(KIND(1d0)), ALLOCATABLE :: varOut(:, :, :), &
1965! ! varX(:, :), varY(:, :), &
1966! ! lat(:, :), lon(:, :), &
1967! ! varSeq0(:), varSeq(:), &
1968! ! xTime(:), xGridID(:, :)
1969
1970! ! INTEGER :: idVar(iVarStart:SIZE(varList))
1971! ! CHARACTER(len=50):: header_str, longNm_str, unit_str
1972! ! CHARACTER(len=4) :: yrStr2
1973! ! CHARACTER(len=40) :: startStr2
1974! ! REAL(KIND(1d0)) :: minLat, maxLat, dLat, minLon, maxLon, dLon
1975! ! REAL(KIND(1d0)), DIMENSION(1:6) :: geoTrans
1976! ! CHARACTER(len=80) :: strGeoTrans
1977
1978! ! ! determine number of times
1979! ! nTime = SIZE(dataOutX, dim=1)
1980
1981! ! !select variables to output
1982! ! nVar = COUNT((varList%level <= outLevel), dim=1)
1983! ! ALLOCATE (varListSel(nVar), stat=err)
1984! ! IF (err /= 0) PRINT *, "varListSel: Allocation request denied"
1985! ! varListSel = PACK(varList, mask=(varList%level <= outLevel))
1986
1987! ! ! copy data accordingly
1988! ! ALLOCATE (dataOutSel(nTime, nVar, NumberOfGrids), stat=err)
1989! ! IF (err /= 0) PRINT *, "dataOutSel: Allocation request denied"
1990! ! dataOutSel = dataOutX(:, PACK((/(i, i=1, SIZE(varList))/), varList%level <= outLevel), :)
1991
1992! ! ! determine filename
1993! ! CALL filename_gen(dataOutSel(:, :, 1), varListSel, 1, FileOut)
1994! ! ! PRINT*, 'writing file:',TRIM(fileOut)
1995
1996! ! ! set year string
1997! ! WRITE (yrStr2, '(i4)') INT(dataOutX(1, 1, 1))
1998! ! ! get start for later time unit creation
1999! ! startStr2 = TRIM(yrStr2)//'-01-01 00:00:00'
2000
2001! ! ! define the dimension of spatial array/frame in the output
2002! ! nX = nCol
2003! ! nY = nRow
2004
2005! ! ALLOCATE (varSeq0(nX*nY))
2006! ! ALLOCATE (varSeq(nX*nY))
2007! ! ALLOCATE (xGridID(nX, nY))
2008! ! ALLOCATE (lon(nX, nY))
2009! ! ALLOCATE (lat(nX, nY))
2010! ! ALLOCATE (varY(nX, nY))
2011! ! ALLOCATE (varX(nX, nY))
2012! ! ALLOCATE (xTime(nTime))
2013
2014! ! ! GridID:
2015! ! varSeq = SurfaceChar(1:nX*nY, 1)
2016! ! ! CALL sortSeqReal(varSeq0,varSeq,nY,nX)
2017! ! xGridID = RESHAPE(varSeq, (/nX, nY/), order=(/1, 2/))
2018! ! ! PRINT*, 'before flipping:',lat(1:2,1)
2019! ! xGridID = xGridID(:, nY:1:-1)
2020
2021! ! ! latitude:
2022! ! varSeq = SurfaceChar(1:nX*nY, 5)
2023! ! ! CALL sortSeqReal(varSeq0,varSeq,nY,nX)
2024! ! lat = RESHAPE(varSeq, (/nX, nY/), order=(/1, 2/))
2025! ! ! PRINT*, 'before flipping:',lat(1:2,1)
2026! ! lat = lat(:, nY:1:-1)
2027! ! ! PRINT*, 'after flipping:',lat(1:2,1)
2028
2029! ! ! longitude:
2030! ! varSeq = SurfaceChar(1:nX*nY, 6)
2031! ! ! CALL sortSeqReal(varSeq0,varSeq,nY,nX)
2032! ! lon = RESHAPE(varSeq, (/nX, nY/), order=(/1, 2/))
2033! ! lon = lon(:, nY:1:-1)
2034
2035! ! ! pass values to coordinate variables
2036! ! varY = lat
2037! ! varX = lon
2038
2039! ! ! calculate GeoTransform array as needed by GDAL
2040! ! ! ref: http://www.perrygeo.com/python-affine-transforms.html
2041! ! ! the values below are different from the above ref,
2042! ! ! as the layout of SUEWS output is different from the schematic shown there
2043! ! ! SUEWS output is arranged northward down the page
2044! ! ! if data are formatted as a normal matrix
2045! ! minLat = lat(1, 1) ! the lower-left pixel
2046! ! maxLat = lat(1, NY) ! the upper-left pixel
2047! ! IF (nY > 1) THEN
2048! ! dLat = (maxLat - minLat)/(nY - 1) ! height of a pixel
2049! ! ELSE
2050! ! dLat = 1
2051! ! END IF
2052
2053! ! ! PRINT*, 'lat:',minLat,maxLat,dLat
2054! ! minLon = lon(1, 1) ! the lower-left pixel
2055! ! maxLon = lon(NX, 1) ! the lower-right pixel
2056! ! IF (nY > 1) THEN
2057! ! dLon = (maxLon - minLon)/(nX - 1) ! width of a pixel
2058! ! ELSE
2059! ! dLon = 1
2060! ! END IF
2061
2062! ! ! PRINT*, 'lon:',minLon,maxLon,dLon
2063! ! geoTrans(1) = minLon - dLon/2 ! x-coordinate of the lower-left corner of the lower-left pixel
2064! ! geoTrans(2) = dLon ! width of a pixel
2065! ! geoTrans(3) = 0. ! row rotation (typically zero)
2066! ! geoTrans(4) = minLat - dLat/2 ! y-coordinate of the of the lower-left corner of the lower-left pixel
2067! ! geoTrans(5) = 0. ! column rotation (typically zero)
2068! ! geoTrans(6) = dLat ! height of a pixel (typically negative, but here positive)
2069! ! ! write GeoTransform to strGeoTrans
2070! ! WRITE (strGeoTrans, '(6(f12.8,1x))') geoTrans
2071
2072! ! ! Create the netCDF file. The nf90_clobber parameter tells netCDF to
2073! ! ! overwrite this file, if it already exists.
2074! ! CALL check(nf90_create(TRIM(fileOut), NF90_CLOBBER, ncID))
2075
2076! ! ! put global attributes
2077! ! CALL check(nf90_put_att(ncID, NF90_GLOBAL, 'Conventions', 'CF1.6'))
2078! ! CALL check(nf90_put_att(ncID, NF90_GLOBAL, 'title', 'SUEWS output'))
2079! ! CALL check(nf90_put_att(ncID, NF90_GLOBAL, 'source', 'Micromet Group, University of Reading'))
2080! ! CALL check(nf90_put_att(ncID, NF90_GLOBAL, 'references', 'http://urban-climate.net/umep/SUEWS'))
2081
2082! ! ! Define the dimensions. NetCDF will hand back an ID for each.
2083! ! ! nY = ncolumnsDataOutSUEWS-4
2084! ! ! nx = NumberOfGrids
2085! ! CALL check(nf90_def_dim(ncID, "time", NF90_UNLIMITED, time_dimid))
2086! ! CALL check(nf90_def_dim(ncID, "west_east", NX, x_dimid))
2087! ! CALL check(nf90_def_dim(ncID, "south_north", NY, y_dimid))
2088! ! ! PRINT*, 'good define dim'
2089
2090! ! ! The dimids array is used to pass the IDs of the dimensions of
2091! ! ! the variables. Note that in fortran arrays are stored in
2092! ! ! column-major format.
2093! ! dimids = (/x_dimid, y_dimid, time_dimid/)
2094
2095! ! ! write out each variable
2096! ! ALLOCATE (varOut(nX, nY, nTime))
2097
2098! ! ! define all variables
2099! ! ! define time variable:
2100! ! CALL check(nf90_def_var(ncID, 'time', NF90_REAL, time_dimid, varIDt))
2101! ! CALL check(nf90_put_att(ncID, varIDt, 'units', 'minutes since '//startStr2))
2102! ! CALL check(nf90_put_att(ncID, varIDt, 'long_name', 'time'))
2103! ! CALL check(nf90_put_att(ncID, varIDt, 'standard_name', 'time'))
2104! ! CALL check(nf90_put_att(ncID, varIDt, 'calendar', 'gregorian'))
2105! ! CALL check(nf90_put_att(ncID, varIDt, 'axis', 'T'))
2106
2107! ! ! define coordinate variables:
2108! ! CALL check(nf90_def_var(ncID, 'lon', NF90_REAL, (/x_dimid, y_dimid/), varIDx))
2109! ! CALL check(nf90_put_att(ncID, varIDx, 'units', 'degree_east'))
2110! ! CALL check(nf90_put_att(ncID, varIDx, 'long_name', 'longitude'))
2111! ! CALL check(nf90_put_att(ncID, varIDx, 'standard_name', 'longitude'))
2112! ! CALL check(nf90_put_att(ncID, varIDx, 'axis', 'X'))
2113
2114! ! CALL check(nf90_def_var(ncID, 'lat', NF90_REAL, (/x_dimid, y_dimid/), varIDy))
2115! ! CALL check(nf90_put_att(ncID, varIDy, 'units', 'degree_north'))
2116! ! CALL check(nf90_put_att(ncID, varIDy, 'long_name', 'latitude'))
2117! ! CALL check(nf90_put_att(ncID, varIDy, 'standard_name', 'latitude'))
2118! ! CALL check(nf90_put_att(ncID, varIDy, 'axis', 'Y'))
2119
2120! ! ! define coordinate referencing system:
2121! ! CALL check(nf90_def_var(ncID, 'crsWGS84', NF90_INT, varIDCRS))
2122! ! CALL check(nf90_put_att(ncID, varIDCRS, 'grid_mapping_name', 'latitude_longitude'))
2123! ! CALL check(nf90_put_att(ncID, varIDCRS, 'long_name', 'CRS definition'))
2124! ! CALL check(nf90_put_att(ncID, varIDCRS, 'longitude_of_prime_meridian', '0.0'))
2125! ! CALL check(nf90_put_att(ncID, varIDCRS, 'semi_major_axis', '6378137.0'))
2126! ! CALL check(nf90_put_att(ncID, varIDCRS, 'inverse_flattening', '298.257223563'))
2127! ! CALL check(nf90_put_att(ncID, varIDCRS, 'epsg_code', 'EPSG:4326'))
2128! ! CALL check(nf90_put_att(ncID, varIDCRS, 'GeoTransform', TRIM(strGeoTrans)))
2129! ! CALL check(nf90_put_att(ncID, varIDCRS, 'spatial_ref',&
2130! ! &'GEOGCS["WGS 84",&
2131! ! & DATUM["WGS_1984",&
2132! ! & SPHEROID["WGS 84",6378137,298.257223563,&
2133! ! & AUTHORITY["EPSG","7030"]],&
2134! ! & AUTHORITY["EPSG","6326"]],&
2135! ! & PRIMEM["Greenwich",0],&
2136! ! & UNIT["degree",0.0174532925199433],&
2137! ! & AUTHORITY["EPSG","4326"]]' &
2138! ! ))
2139
2140! ! ! define grid_ID:
2141! ! CALL check(nf90_def_var(ncID, 'grid_ID', NF90_INT, (/x_dimid, y_dimid/), varIDGrid))
2142! ! CALL check(nf90_put_att(ncID, varIDGrid, 'coordinates', 'lon lat'))
2143! ! CALL check(nf90_put_att(ncID, varIDGrid, 'long_name', 'Grid ID as in SiteSelect'))
2144! ! CALL check(nf90_put_att(ncID, varIDGrid, 'grid_mapping', 'crsWGS84'))
2145! ! ! varIDGrid=varID
2146
2147! ! ! define other 3D variables:
2148! ! DO iVar = iVarStart, nVar
2149! ! ! define variable name
2150! ! header_str = varListSel(iVar)%header
2151! ! unit_str = varListSel(iVar)%unit
2152! ! longNm_str = varListSel(iVar)%longNm
2153
2154! ! ! Define the variable. The type of the variable in this case is
2155! ! ! NF90_REAL.
2156
2157! ! CALL check(nf90_def_var(ncID, TRIM(ADJUSTL(header_str)), NF90_REAL, dimids, varID))
2158
2159! ! CALL check(nf90_put_att(ncID, varID, 'coordinates', 'lon lat'))
2160
2161! ! CALL check(nf90_put_att(ncID, varID, 'units', TRIM(ADJUSTL(unit_str))))
2162
2163! ! CALL check(nf90_put_att(ncID, varID, 'long_name', TRIM(ADJUSTL(longNm_str))))
2164
2165! ! CALL check(nf90_put_att(ncID, varID, 'grid_mapping', 'crsWGS84'))
2166
2167! ! idVar(iVar) = varID
2168! ! END DO
2169! ! CALL check(nf90_enddef(ncID))
2170! ! ! End define mode. This tells netCDF we are done defining metadata.
2171
2172! ! ! put all variable values into netCDF datasets
2173! ! ! put time variable in minute:
2174! ! xTime = (dataOutSel(1:nTime, 2, 1) - 1)*24*60 + dataOutSel(1:nTime, 3, 1)*60 + dataOutSel(1:nTime, 4, 1)
2175! ! CALL check(nf90_put_var(ncID, varIDt, xTime))
2176
2177! ! ! put coordinate variables:
2178! ! CALL check(nf90_put_var(ncID, varIDx, varX))
2179! ! CALL check(nf90_put_var(ncID, varIDy, varY))
2180
2181! ! ! put CRS variable:
2182! ! CALL check(nf90_put_var(ncID, varIDCRS, 9999))
2183
2184! ! CALL check(NF90_SYNC(ncID))
2185! ! ! PRINT*, 'good put var'
2186
2187! ! ! put grid_ID:
2188! ! CALL check(nf90_put_var(ncID, varIDGrid, xGridID))
2189! ! ! PRINT*, 'good put varIDGrid',varIDGrid
2190
2191! ! CALL check(NF90_SYNC(ncID))
2192
2193! ! ! then other 3D variables
2194! ! DO iVar = iVarStart, nVar
2195! ! ! reshape dataOutX to be aligned in checker board form
2196! ! varOut = RESHAPE(dataOutSel(1:nTime, iVar, :), (/nX, nY, nTime/), order=(/3, 1, 2/))
2197! ! varOut = varOut(:, nY:1:-1, :)
2198! ! ! get the variable id
2199! ! varID = idVar(iVar)
2200
2201! ! CALL check(nf90_put_var(ncID, varID, varOut))
2202
2203! ! CALL check(NF90_SYNC(ncID))
2204! ! END DO
2205
2206! ! IF (ALLOCATED(varOut)) DEALLOCATE (varOut)
2207! ! IF (ALLOCATED(varSeq0)) DEALLOCATE (varSeq0)
2208! ! IF (ALLOCATED(varSeq)) DEALLOCATE (varSeq)
2209! ! IF (ALLOCATED(xGridID)) DEALLOCATE (xGridID)
2210! ! IF (ALLOCATED(lon)) DEALLOCATE (lon)
2211! ! IF (ALLOCATED(lat)) DEALLOCATE (lat)
2212! ! IF (ALLOCATED(varY)) DEALLOCATE (varY)
2213! ! IF (ALLOCATED(varX)) DEALLOCATE (varX)
2214! ! IF (ALLOCATED(xTime)) DEALLOCATE (xTime)
2215
2216! ! ! Close the file. This frees up any internal netCDF resources
2217! ! ! associated with the file, and flushes any buffers.
2218! ! CALL check(nf90_close(ncID))
2219
2220! ! ! PRINT*, "*** SUCCESS writing netCDF file:"
2221! ! ! PRINT*, FileOut
2222! ! END SUBROUTINE SUEWS_Write_nc
2223
2224! !===========================================================================!
2225! ! convert a vector of grids to a matrix
2226! ! the grid IDs in seqGrid2Sort follow the QGIS convention
2227! ! the spatial matrix arranges successive rows down the page (i.e., north to south)
2228! ! and succesive columns across (i.e., west to east)
2229! ! seqGridSorted stores the grid IDs as aligned in matGrid but squeezed into a vector
2230! !===========================================================================!
2231! SUBROUTINE grid2mat(seqGrid2Sort, seqGridSorted, matGrid, nRow, nCol)
2232
2233! IMPLICIT NONE
2234
2235! INTEGER, DIMENSION(nRow*nCol) :: seqGrid2Sort, seqGridSorted
2236! INTEGER, DIMENSION(nRow, nCol) :: matGrid
2237! INTEGER :: nRow, nCol, i, j, loc
2238
2239! CALL sortGrid(seqGrid2Sort, seqGridSorted, nRow, nCol)
2240! PRINT *, 'old:'
2241! PRINT *, seqGrid2Sort(1:5)
2242! PRINT *, 'sorted:'
2243! PRINT *, seqGridSorted(1:5)
2244! PRINT *, ''
2245! DO i = 1, nRow
2246! DO j = 1, nCol
2247! loc = (i - 1)*nCol + j
2248! matGrid(i, j) = seqGridSorted(loc)
2249! END DO
2250! END DO
2251! END SUBROUTINE grid2mat
2252
2253! !===========================================================================!
2254! ! convert sequence of REAL values to a matrix
2255! ! the grid IDs in seqGrid2Sort follow the QGIS convention
2256! ! the spatial matrix arranges successive rows down the page (i.e., north to south)
2257! ! and succesive columns across (i.e., west to east)
2258! ! seqGridSorted stores the grid IDs as aligned in matGrid but squeezed into a vector
2259! !===========================================================================!
2260! SUBROUTINE seq2mat(seq2Sort, seqSorted, matGrid, nRow, nCol)
2261
2262! IMPLICIT NONE
2263
2264! REAL(KIND(1d0)), DIMENSION(nRow*nCol) :: seq2Sort, seqSorted
2265! REAL(KIND(1d0)), DIMENSION(nRow, nCol) :: matGrid
2266! INTEGER :: nRow, nCol, i, j, loc
2267
2268! CALL sortSeqReal(seq2Sort, seqSorted, nRow, nCol)
2269! PRINT *, 'old:'
2270! PRINT *, seq2Sort(1:5)
2271! PRINT *, 'sorted:'
2272! PRINT *, seqSorted(1:5)
2273! PRINT *, ''
2274! DO i = 1, nRow
2275! DO j = 1, nCol
2276! loc = (i - 1)*nCol + j
2277! matGrid(i, j) = seqSorted(loc)
2278! END DO
2279! END DO
2280! END SUBROUTINE seq2mat
2281
2282! !===========================================================================!
2283! ! sort a sequence of LONG values into the specially aligned sequence per QGIS
2284! !===========================================================================!
2285! SUBROUTINE sortGrid(seqGrid2Sort0, seqGridSorted, nRow, nCol)
2286! USE qsort_c_module
2287! ! convert a vector of grids to a matrix
2288! ! the grid IDs in seqGrid2Sort follow the QGIS convention
2289! ! the spatial matrix arranges successive rows down the page (i.e., north to south)
2290! ! and succesive columns across (i.e., west to east)
2291! ! seqGridSorted stores the grid IDs as aligned in matGrid but squeezed into a vector
2292
2293! IMPLICIT NONE
2294! INTEGER :: nRow, nCol, i = 1, j = 1, xInd, len
2295
2296! INTEGER, DIMENSION(nRow*nCol), INTENT(in) :: seqGrid2Sort0
2297! INTEGER, DIMENSION(nRow*nCol), INTENT(out) :: seqGridSorted
2298! INTEGER, DIMENSION(nRow*nCol) :: seqGrid2Sort, locSorted
2299! INTEGER :: loc
2300! REAL:: ind(nRow*nCol, 2)
2301! REAL, DIMENSION(nRow*nCol) :: seqGrid2SortReal, seqGridSortedReal
2302! REAL :: val
2303
2304! ! number of grids
2305! len = nRow*nCol
2306
2307! !sort the input array to make sure the grid order is in QGIS convention
2308! ! i.e., diagonally ascending
2309! seqGrid2SortReal = seqGrid2Sort0*1.
2310! CALL QsortC(seqGrid2SortReal)
2311! seqGrid2Sort = INT(seqGrid2SortReal)
2312
2313! ! fill in an nRow*nCol array with values to determine sequence
2314! xInd = 1
2315! DO i = 1, nRow
2316! DO j = 1, nCol
2317! ! {row, col, value for sorting, index in new sequence}
2318! ind(xInd, :) = (/i + j + i/(nRow + 1.), xInd*1./)
2319! xInd = xInd + 1
2320! END DO
2321! END DO
2322
2323! ! then sorted ind(:,3) will have the same order as seqGrid2Sort
2324! ! sort ind(:,3)
2325! seqGridSortedReal = ind(:, 1)*1.
2326! CALL QsortC(seqGridSortedReal)
2327! ! print*, 'sorted real:'
2328! ! print*, seqGridSortedReal
2329
2330! ! get index of each element of old sequence in the sorted sequence
2331! DO i = 1, len
2332! ! value in old sequence
2333! ! val=ind(i,3)*1.
2334! val = seqGridSortedReal(i)
2335! DO j = 1, len
2336! IF (val == ind(j, 1)*1.) THEN
2337! ! location in sorted sequence
2338! locSorted(i) = j
2339! END IF
2340! END DO
2341! END DO
2342
2343! ! put elements of old sequence in the sorted order
2344! DO i = 1, len
2345! loc = locSorted(i)
2346! seqGridSorted(loc) = seqGrid2Sort(i)
2347! END DO
2348! seqGridSorted = seqGridSorted(len:1:-1)
2349
2350! END SUBROUTINE sortGrid
2351
2352! !===========================================================================!
2353! ! sort a sequence of REAL values into the specially aligned sequence per QGIS
2354! !===========================================================================!
2355! SUBROUTINE sortSeqReal(seqReal2Sort, seqRealSorted, nRow, nCol)
2356! USE qsort_c_module
2357! ! convert a vector of grids to a matrix
2358! ! the grid IDs in seqReal2Sort follow the QGIS convention
2359! ! the spatial matrix arranges successive rows down the page (i.e., north to south)
2360! ! and succesive columns across (i.e., west to east)
2361! ! seqRealSorted stores the grid IDs as aligned in matGrid but squeezed into a vector
2362
2363! IMPLICIT NONE
2364! INTEGER :: nRow, nCol, i = 1, j = 1, xInd, len
2365
2366! REAL(KIND(1d0)), DIMENSION(nRow*nCol), INTENT(in) :: seqReal2Sort
2367! REAL(KIND(1d0)), DIMENSION(nRow*nCol), INTENT(out) :: seqRealSorted
2368! INTEGER(KIND(1d0)), DIMENSION(nRow*nCol) :: locSorted
2369! INTEGER(KIND(1d0)) :: loc
2370! REAL:: ind(nRow*nCol, 2)
2371! REAL :: seqRealSortedReal(nRow*nCol), val
2372
2373! ! number of grids
2374! len = nRow*nCol
2375
2376! ! fill in an nRow*nCol array with values to determine sequence
2377! xInd = 1
2378! DO i = 1, nRow
2379! DO j = 1, nCol
2380! ! {row, col, value for sorting, index in new sequence}
2381! ind(xInd, :) = (/i + j + i/(nRow + 1.), xInd*1./)
2382! xInd = xInd + 1
2383! END DO
2384! END DO
2385
2386! ! then sorted ind(:,3) will have the same order as seqReal2Sort
2387! ! sort ind(:,3)
2388! seqRealSortedReal = ind(:, 1)*1.
2389! CALL QsortC(seqRealSortedReal)
2390! ! print*, 'sorted real:'
2391! ! print*, seqRealSortedReal
2392
2393! ! get index of each element of old sequence in the sorted sequence
2394! DO i = 1, len
2395! ! value in old sequence
2396! ! val=ind(i,3)*1.
2397! val = seqRealSortedReal(i)
2398! DO j = 1, len
2399! IF (val == ind(j, 1)*1.) THEN
2400! ! location in sorted sequence
2401! locSorted(i) = j
2402! END IF
2403! END DO
2404! END DO
2405
2406! ! put elements of old sequence in the sorted order
2407! DO i = 1, len
2408! loc = locSorted(i)
2409! seqRealSorted(loc) = seqReal2Sort(i)
2410! END DO
2411! seqRealSorted = seqRealSorted(len:1:-1)
2412
2413! END SUBROUTINE sortSeqReal
2414
2415! !===========================================================================!
2416! ! a wrapper for checking netCDF status
2417! !===========================================================================!
2418
2419! SUBROUTINE check(status)
2420! USE netcdf
2421! IMPLICIT NONE
2422
2423! INTEGER, INTENT(in) :: status
2424
2425! IF (status /= nf90_noerr) THEN
2426! PRINT *, TRIM(nf90_strerror(status))
2427! STOP "Stopped"
2428! END IF
2429! END SUBROUTINE check
2430! #endif
2431
2432END MODULE ctrl_output
real(kind(1d0)), dimension(:, :, :), allocatable dataoutspartacus
real(kind(1d0)), dimension(:, :, :), allocatable dataoutestmext
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 ncolumnsdataoutestmext
integer, parameter ncolumnsdataoutsnow
real(kind(1d0)), dimension(:, :, :), allocatable dataoutrsl
real(kind(1d0)), dimension(:, :, :), allocatable dataoutsuews
integer, parameter ncolumnsdataoutdailystate
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
subroutine formatfile_gen(dataOutX, varList, iyr, Gridiv, outLevel)
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 unique(vec, vec_unique)
character(len=10), parameter f146
subroutine suews_output_txt_grp(iv, irMax, iyr, varListX, Gridiv, outLevel, outFreq_s)
character(len=1), parameter as
character(len=1), parameter at
character(len=3) itext
character(len=10), parameter f104
subroutine suews_output_agg(dataOut_agg, dataOutX, varList, irMax, outFreq_s)
character(len=10), parameter fd
character(len=1), parameter aa
subroutine filename_gen(dataOutX, varList, iyr, Gridiv, FileOutX, opt_fmt)
subroutine suews_write_txt(dataOutX, varList, iyr, Gridiv, outLevel)
integer function count_lines(filename)
character(len=1), parameter al
logical function initq_file(FileName)
subroutine suews_output_init(dataOutX, varList, iyr, Gridiv, outLevel)
character(len=20) filecode
character(len=150) fileoutputpath
integer resolutionfilesout
integer writeoutoption
integer diagnose
integer keeptstepfilesout
integer storageheatmethod
subroutine parse(str, delims, args, nargs)