-
Notifications
You must be signed in to change notification settings - Fork 1
/
parameters.py
395 lines (378 loc) · 18.7 KB
/
parameters.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
# -*- coding: utf-8 -*-
"""
PARAMETERS
@author: slauniai & khaahti & jpnousu
"""
import pathlib
import time
def parameters(folder=''):
pgen = {'description': 'final_run', # description written in result file
'simtype': '1D', # 1D, TOP, 2D,
'start_date': '2020-10-01', # '2011-01-01', for tests: '2020-01-01'
'end_date': '2021-08-01', # 2021-09-01,
#'spinup_file': r'F:\SpaFHy_2D_2021/testcase_input_202304051037_spinup.nc',
'spinup_end': '2020-10-01', # '2013-09-01', for tests: '2020-09-01' results after this are saved in result file
'dt': 86400.0,
'spatial_cpy': True, # if False uses parameters from cpy['state']
# else needs cf.dat, hc.dat, LAI_decid.dat, LAI_spruce.dat, LAI_pine.dat, (cmask.dat)
'spatial_soil': True, # if False uses soil_id, ditch_depth, ditch_spacing from psp
'org_drain': True, # organic layer drainage True/False
'topmodel': True,
# else needs soil_id.dat, ditch_depth.dat, ditch_spacing.dat
'spatial_forcing': False, # if False uses forcing from forcing file with pgen['forcing_id'] and cpy['loc']
'spatial_radiation_file': r'C:\SpaFHy_v1_Pallas_2D\obs\rad_ds.nc', # if spatial radiation file, otherwise None
# else needs Ncoord.dat, Ecoord.dat, forcing_id.dat
'gis_folder': str(pathlib.Path(folder+r'/parameters')),
'forcing_file': str(pathlib.Path(folder+r'/forcing/FORCING_KENTTAROVA_final.csv')),
'forcing_id': 0, # used if spatial_forcing == False
'ncf_file': folder + '_' + time.strftime('%Y%m%d%H%M') + r'.nc', # added timestamp to result file name to avoid saving problem when running repeatedly
'mask_streams': True,
'results_folder': r'F:\SpaFHy_2D_2021/',
'save_interval': 366, # interval for writing results to file (decreases need for memory during computation)
'variables':[ # list of output variables (rows can be commented away if not all variables are of interest)
['parameters_lai_conif', 'leaf area index of conifers [m2 m-2]'],
['parameters_lai_decid_max', 'leaf area index of decidious trees [m2 m-2]'],
['parameters_lai_shrub', 'leaf area index of shrubs [m2 m-2]'],
['parameters_lai_grass', 'leaf area index of grass [m2 m-2]'],
['parameters_hc', 'canopy height [m]'],
['parameters_cf', 'canopy closure [-]'],
['parameters_soilclass', 'soil class index'],
['parameters_elevation', 'elevation from dem [m]'],
['parameters_lat', 'latitude [deg]'],
['parameters_lon', 'longitude [deg]'],
['parameters_ditches', 'ditches'],
['parameters_cmask', 'cmask'],
['parameters_sitetype', 'sitetype'],
['parameters_twi', 'twi'],
['forcing_air_temperature', 'air temperature [degC]'],
['forcing_precipitation', 'precipitation [mm d-1]'],
['forcing_vapor_pressure_deficit', 'vapor pressure deficit [kPa]'],
['forcing_global_radiation', 'global radiation [Wm-2]'],
['forcing_wind_speed','wind speed [m s-1]'],
['bucket_pond_storage', 'pond storage [m]'],
['bucket_moisture_top', 'volumetric water content of moss layer [m3 m-3]'],
['bucket_moisture_root', 'volumetric water content of rootzone [m3 m-3]'],
['bucket_potential_infiltration', 'potential infiltration [mm d-1]'],
['bucket_surface_runoff', 'surface runoff [mm d-1]'],
['bucket_evaporation', 'evaporation from soil surface [mm d-1]'],
['bucket_drainage', 'drainage from root layer [mm d-1]'],
['bucket_water_storage', 'bucket water storage (top and root) [mm d-1]'],
['bucket_water_storage_top', 'bucket water storage (top) [mm d-1]'],
['bucket_water_storage_root', 'bucket water storage (root) [mm d-1]'],
['bucket_storage_change', 'bucket water storage change (top and root) [mm d-1]'],
['bucket_water_closure', 'bucket water balance error [mm d-1]'],
['bucket_return_flow', 'return flow from deepzone to bucket [mm d-1]'],
['soil_water_storage', 'soil water storage (deeplayer) [m]'],
['soil_ground_water_level', 'ground water level [m]'],
['soil_lateral_netflow', 'subsurface lateral netflow [mm d-1]'],
['soil_netflow_to_ditch', 'netflow to ditch [mm d-1]'],
['soil_moisture_deep', 'volumetric water content of deepzone [m3 m-3]'],
['soil_water_closure', 'soil water balance error [mm d-1]'],
['soil_transpiration_limitation', 'transpiration limitation [-]'],
#['canopy_interception', 'canopy interception [mm d-1]'],
['canopy_evaporation', 'evaporation from interception storage [mm d-1]'],
['canopy_transpiration','transpiration [mm d-1]'],
#['canopy_stomatal_conductance','stomatal conductance [m s-1]'],
#['canopy_throughfall', 'throughfall to moss or snow [mm d-1]'],
['canopy_snow_water_equivalent', 'snow water equivalent [mm]'],
['canopy_water_closure', 'canopy water balance error [mm d-1]'],
['canopy_phenostate', 'canopy phenological state [-]'],
['canopy_leaf_area_index', 'canopy leaf area index [m2 m-2]'],
#['canopy_degree_day_sum', 'sum of degree days [degC]'],
['canopy_fLAI', 'state of LAI'],
['canopy_water_storage', 'canopy intercepted water storage [mm d-1]'],
['canopy_snowfall', 'canopy snowfall'],
['top_baseflow', 'topmodel baseflow [mm d-1]'],
['top_water_closure', 'topmodel water balance error [mm d-1]'],
['top_returnflow', 'topmodel returnflow [mm d-1]'],
['top_local_returnflow', 'topmodel local returnflow [mm d-1]'],
['top_drainage_in', 'topmodel inflow from drainage [mm d-1]'],
['top_saturation_deficit', 'topmodel saturation deficit [m]'],
['top_local_saturation_deficit', 'topmodel local saturation deficit [mm]'],
['top_saturated_area', 'topmodel saturated area [-]'],
['top_storage_change', 'topmodel_water_storage_change [mm d-1]']
]
}
f=1.0
# canopygrid
pcpy = {'flow' : { # flow field
'zmeas': 2.0,
'zground': 0.5,
'zo_ground': 0.01
},
'interc': { # interception
'wmax': 1.5, # storage capacity for rain (mm/LAI)
'wmaxsnow': 4.5, # storage capacity for snow (mm/LAI)
},
'snow': { # degree-day snow model
'kmelt': 2.8934e-05, # melt coefficient in open (mm/s)
'kfreeze': 5.79e-6, # freezing coefficient (mm/s)
'r': 0.05 # maximum fraction of liquid in snow (-)
},
'physpara': {
# canopy conductance
'amax': 10.0, # maximum photosynthetic rate (umolm-2(leaf)s-1)
'g1_conif': f * 2.1, # stomatal parameter, conifers
'g1_decid': f * 3.5, # stomatal parameter, deciduous
'g1_shrub': f * 3.0, # stomatal parameter, deciduous
'g1_grass': f * 5.0, # stomatal parameter, deciduous
'q50': 50.0, # light response parameter (Wm-2)
'kp': 0.6, # light attenuation parameter (-)
'rw': 0.20, # critical value for REW (-),
'rwmin': 0.02, # minimum relative conductance (-)
# soil evaporation
'gsoil': 1e-2 # soil surface conductance if soil is fully wet (m/s)
},
'spec_para': {
'conif': {'amax': 10.0, # maximum photosynthetic rate (umolm-2(leaf)s-1)
'g1': 2.1, # stomatal parameter
'q50': 50.0, # light response parameter (Wm-2)
'lai_cycle': False,
},
'decid': {'amax': 10.0, # maximum photosynthetic rate (umolm-2(leaf)s-1)
'g1': 3.5, # stomatal parameter
'q50': 50.0, # light response parameter (Wm-2)
'lai_cycle': True,
},
'shrub': {'amax': 10.0, # maximum photosynthetic rate (umolm-2(leaf)s-1)
'g1': 3.0, # stomatal parameter
'q50': 50.0, # light response parameter (Wm-2)
'lai_cycle': False,
},
'grass': {'amax': 10.0, # maximum photosynthetic rate (umolm-2(leaf)s-1)
'g1': 5.0, # stomatal parameter
'q50': 50.0, # light response parameter (Wm-2)
'lai_cycle': True,
},
},
'phenopara': {
# seasonal cycle of physiology: smax [degC], tau[d], xo[degC],fmin[-](residual photocapasity)
'smax': 18.5, # degC
'tau': 13.0, # days
'xo': -4.0, # degC
'fmin': 0.05, # minimum photosynthetic capacity in winter (-)
# deciduos phenology
'lai_decid_min': 0.1, # minimum relative LAI (-)
'ddo': 45.0, # degree-days for bud-burst (5degC threshold)
'ddur': 23.0, # duration of leaf development (days)
'sdl': 9.0, # daylength for senescence start (h)
'sdur': 30.0, # duration of leaf senescence (days),
},
'state': { # following properties are used if spatial_cpy == False
'lai_conif': 3.5, # conifer 1-sided LAI (m2 m-2)
'lai_decid_max': 0.5, # maximum annual deciduous 1-sided LAI (m2 m-2)
'lai_shrub': 0.1,
'lai_grass': 0.2,
'hc': 16.0, # canopy height (m)
'cf': 0.6, # canopy closure fraction (-)
#initial state of canopy storage [mm] and snow water equivalent [mm]
'w': 0.0, # canopy storage mm
'swe': 0.0, # snow water equivalent mm
},
'loc': { # following coordinates used if spatial_forcing == False
'lat': 67.995, # decimal degrees
'lon': 24.224
}
}
# soil profile
psp = {
# soil profile, following properties are used if spatial_soil = False
'soil_id': 2.0,
# organic (moss) layer
'org_depth': 0.05, # depth of organic top layer (m)
'org_poros': 0.448, # porosity (-)
'org_fc': 0.33, # field capacity (-)
'org_rw': 0.15, # critical vol. moisture content (-) for decreasing phase in Ef
'org_ksat': 1E-04,
'org_beta': 6.0,
'maxpond': 0.02,
# rootzone layer
'root_depth': 0.3, # depth of rootzone layer (m)
'root_sat': 0.6, # root zone saturation ratio (-)
'root_fc': 0.33, # root zone field capacity
'root_poros': 0.448, # root zone porosity
'root_wp': 0.13, # root zone wilting point
'root_ksat': 1e-05, # root zone hydraulic conductivity
'root_beta': 4.7,
# initial states
'ground_water_level': -0.5, # groundwater depth [m]
'org_sat': 1.0, # organic top layer saturation ratio (-)
'pond_storage': 0.0, # initial pond depth at surface [m]
'ditch_depth': -0.2 # initial ditch water level relative to ground surface (currently not dynamic) [m]
}
return pgen, pcpy, psp
def ptopmodel():
"""
parameters of topmodel submodel
"""
ptopmodel = {'dt': 86400.0, # timestep (s)
'm': 0.025, # 0.025 calibrated by Samuli, scaling depth (m), testin 0.01
'ko': 0.001, # transmissivity parameter (ms-1)
'twi_cutoff': 97.5, # cutoff of cumulative twi distribution (%)
'so': 0.05 # initial saturation deficit (m)
}
return ptopmodel
def topsoil():
"""
Properties of typical topsoils
Following main site type (1-4) classification
"""
topsoil = {
'mineral':{
'topsoil_id': 1,
'org_depth': 0.05,
'org_poros': 0.9,
'org_fc': 0.3,
'org_rw': 0.2,
'org_ksat': 1E-03,
'org_beta': 6.0
},
'fen':{
'topsoil_id': 2,
'org_depth': 0.05,
'org_poros': 0.9,
'org_fc': 0.65,
'org_rw': 0.3,
'org_ksat': 1E-03,
'org_beta': 6.0
},
'peatland':{
'topsoil_id': 3,
'org_depth': 0.05,
'org_poros': 0.9,
'org_fc': 0.65,
'org_rw': 0.3,
'org_ksat': 1E-03,
'org_beta': 6.0
},
'openmire':{
'topsoil_id': 4,
'org_depth': 0.05,
'org_poros': 0.9,
'org_fc': 0.65,
'org_rw': 0.3,
'org_ksat': 1E-03,
'org_beta': 6.0
}
}
return topsoil
# one layer
def soilprofiles():
"""
Properties of soil profiles.
Note z is elevation of lower boundary of layer (soil surface at 0.0),
e.g. z = [-0.05, -0.15] means first layer tickness is 5 cm and second 10 cm.
"""
soilp = {
'CoarseTextured':{ # Launiainen et al. 2021
'soil_id': 1.0,
'z': [-5.0],
'pF': { # vanGenuchten water retention parameters
'ThetaS': [0.41], # Launiainen et al. 2021
'ThetaR': [0.05], # Launiainen et al. 2021
'alpha': [0.024], # Launiainen et al. 2021
'n': [1.2]}, # Launiainen et al. 2021
'saturated_conductivity': [1E-05],
},
'MediumTextured':{
'soil_id': 2.0,
'z': [-5.0],
'pF': { # vanGenuchten water retention parameters
'ThetaS': [0.43], # Launiainen et al. 2019
'ThetaR': [0.05], # Launiainen et al. 2019
'alpha': [0.024], # Launiainen et al. 2019
'n': [1.2]}, # # Launiainen et al. 2021
'saturated_conductivity': [1E-05],
},
'FineTextured':{
'soil_id': 3.0,
'z': [-5.0],
'pF': { # vanGenuchten water retention parameters
'ThetaS': [0.6],
'ThetaR': [0.07],
'alpha': [0.018],
'n': [1.16]},
'saturated_conductivity': [1E-05],
},
'Peat':{
'soil_id': 4.0,
'z': [-5.0],
'pF': { # vanGenuchten water retention parameters
'ThetaS': [0.88], # MEASURED
'ThetaR': [0.196], # MEASURED
'alpha': [0.072], # MEASURED
'n': [1.255]}, # MEASURED
'saturated_conductivity': [1E-05], # MEASURED
}
}
return soilp
def rootproperties():
"""
Defines 5 soil types: Fine, Medium and Coarse textured + organic Peat
and Humus.
Currently SpaFHy needs following parameters: soil_id, poros, dc, wp, wr,
n, alpha, Ksat, beta
"""
psoil = {
'CoarseTextured': # Launiainen et al. 2019
{'root_airentry': 20.8,
'root_alpha': 0.024,
'root_beta': 3.1,
'root_fc': 0.21,
'root_ksat': 1E-04,
'root_n': 1.2,
'root_poros': 0.41,
'soil_id': 1.0,
'root_wp': 0.10,
'root_wr': 0.05,
},
'MediumTextured': # Launiainen et al. 2019
{'root_airentry': 20.8,
'root_alpha': 0.024,
'root_beta': 4.7,
'root_fc': 0.33,
'root_ksat': 1E-05,
'root_n': 1.2,
'root_poros': 0.43,
'soil_id': 2.0,
'root_wp': 0.13,
'root_wr': 0.05,
},
'FineTextured': # Launiainen et al. 2019
{'root_airentry': 34.2,
'root_alpha': 0.018,
'root_beta': 7.9,
'root_fc': 0.34,
'root_ksat': 1E-06,
'root_n': 1.16,
'root_poros': 0.5,
'soil_id': 3.0,
'root_wp': 0.25,
'root_wr': 0.07,
},
'Peat':
{'root_airentry': 29.2, # Launiainen et al. 2019
'root_alpha': 0.08, # Menberu et al. 2021
'root_beta': 6.0, # Launiainen et al. 2019
'root_fc': 0.53, # Menberu et al. 2021
'root_ksat': 3E-04, # MEASURED BY Autio et al. 2023
'root_n': 1.75, # Menbery et al. 2021
'root_poros': 0.888, # Autio et al. 2023 or Muhic et al. 2023
'soil_id': 4.0,
'root_wp': 0.36, # Menbery et al. 2021
'root_wr': 0.0, # Launiainen et al. 2019
},
'Humus':
{'root_airentry': 29.2,
'root_alpha': 0.123,
'root_beta': 6.0,
'root_fc': 0.35,
'root_ksat': 8e-06,
'root_n': 1.28,
'root_poros': 0.85,
'soil_id': 5.0,
'root_wp': 0.15,
'root_wr': 0.01,
},
}
return psoil