31
31
from .load_ball_berry_slope_C3 import load_ball_berry_slope_C3
32
32
from .load_ball_berry_slope_C4 import load_ball_berry_slope_C4
33
33
34
- GEOS5FP_DOWNLOAD_DIRECTORY = "~/data/GEOS5FP_download"
35
-
36
- ## TODO automatic acquisition of SRTM for default elevation
34
+ from .check_distribution import check_distribution
37
35
38
36
def BESS (
39
37
ST_C : Union [Raster , np .ndarray ], # surface temperature in Celsius
@@ -78,7 +76,6 @@ def BESS(
78
76
peakVCmax_C3 : np .ndarray = None , # peak maximum carboxylation rate for C3 plants
79
77
peakVCmax_C4 : np .ndarray = None , # peak maximum carboxylation rate for C4 plants
80
78
CI : Union [Raster , np .ndarray ] = None ,
81
- GEOS5FP_download_directory : str = GEOS5FP_DOWNLOAD_DIRECTORY ,
82
79
resampling : str = RESAMPLING ): # clumping index
83
80
if geometry is None and isinstance (ST_C , Raster ):
84
81
geometry = ST_C .geometry
@@ -244,6 +241,30 @@ def BESS(
244
241
canopy_height_meters = canopy_height_meters
245
242
)
246
243
244
+ meteorology_outputs = {
245
+ "Ps_Pa" : Ps_Pa ,
246
+ "VPD_Pa" : VPD_Pa ,
247
+ "RH" : RH ,
248
+ "desTa" : desTa ,
249
+ "ddesTa" : ddesTa ,
250
+ "gamma" : gamma ,
251
+ "Cp" : Cp ,
252
+ "rhoa" : rhoa ,
253
+ "epsa" : epsa ,
254
+ "R" : R ,
255
+ "Rc" : Rc ,
256
+ "Rs" : Rs ,
257
+ "SFd" : SFd ,
258
+ "SFd2" : SFd2 ,
259
+ "DL" : DL ,
260
+ "Ra" : Ra ,
261
+ "fStress" : fStress
262
+ }
263
+
264
+ # Check the distribution for each variable
265
+ for var_name , var_value in meteorology_outputs .items ():
266
+ check_distribution (var_value , var_name , time_UTC )
267
+
247
268
# convert NDVI to LAI
248
269
LAI = LAI_from_NDVI (NDVI )
249
270
LAI_minimum = LAI_from_NDVI (NDVI_minimum )
@@ -259,6 +280,18 @@ def BESS(
259
280
kn = kn
260
281
)
261
282
283
+ # List of variable names and their corresponding values
284
+ VCmax_outputs = {
285
+ "VCmax_C3_sunlit" : VCmax_C3_sunlit ,
286
+ "VCmax_C4_sunlit" : VCmax_C4_sunlit ,
287
+ "VCmax_C3_shaded" : VCmax_C3_shaded ,
288
+ "VCmax_C4_shaded" : VCmax_C4_shaded
289
+ }
290
+
291
+ # Check the distribution for each variable
292
+ for var_name , var_value in VCmax_outputs .items ():
293
+ check_distribution (var_value , var_name , time_UTC )
294
+
262
295
sunlit_fraction , APAR_sunlit , APAR_shaded , ASW_sunlit , ASW_shaded , ASW_soil , G = canopy_shortwave_radiation (
263
296
PARDiff = VISdiff , # diffuse photosynthetically active radiation in W/m^2
264
297
PARDir = VISdir , # direct photosynthetically active radiation in W/m^2
@@ -272,6 +305,22 @@ def BESS(
272
305
albedo_NIR = albedo_NIR # surface albedo in near-infrared wavelengths
273
306
)
274
307
308
+ # List of variable names and their corresponding values
309
+ canopy_radiation_outputs = {
310
+ "sunlit_fraction" : sunlit_fraction ,
311
+ "APAR_sunlit" : APAR_sunlit ,
312
+ "APAR_shaded" : APAR_shaded ,
313
+ "ASW_sunlit" : ASW_sunlit ,
314
+ "ASW_shaded" : ASW_shaded ,
315
+ "ASW_soil" : ASW_soil ,
316
+ "G" : G
317
+ }
318
+
319
+ # Check the distribution for each variable
320
+ for var_name , var_value in canopy_radiation_outputs .items ():
321
+ check_distribution (var_value , var_name , time_UTC )
322
+
323
+
275
324
canopy_temperature_K = canopy_temperature_C + 273.15
276
325
soil_temperature_K = soil_temperature_C + 273.15
277
326
@@ -309,6 +358,22 @@ def BESS(
309
358
C4_photosynthesis = False # C3 or C4 photosynthesis
310
359
)
311
360
361
+ # List of variable names and their corresponding values
362
+ carbon_water_fluxes_outputs = {
363
+ "GPP_C3" : GPP_C3 ,
364
+ "LE_C3" : LE_C3 ,
365
+ "LE_soil_C3" : LE_soil_C3 ,
366
+ "LE_canopy_C3" : LE_canopy_C3 ,
367
+ "Rn_C3" : Rn_C3 ,
368
+ "Rn_soil_C3" : Rn_soil_C3 ,
369
+ "Rn_canopy_C3" : Rn_canopy_C3
370
+ }
371
+
372
+ # Check the distribution for each variable
373
+ for var_name , var_value in carbon_water_fluxes_outputs .items ():
374
+ check_distribution (var_value , var_name , time_UTC )
375
+
376
+
312
377
GPP_C4 , LE_C4 , LE_soil_C4 , LE_canopy_C4 , Rn_C4 , Rn_soil_C4 , Rn_canopy_C4 = carbon_water_fluxes (
313
378
canopy_temperature_K = canopy_temperature_K , # canopy temperature in Kelvin
314
379
soil_temperature_K = soil_temperature_K , # soil temperature in Kelvin
@@ -343,6 +408,21 @@ def BESS(
343
408
C4_photosynthesis = True # C3 or C4 photosynthesis
344
409
)
345
410
411
+ # List of variable names and their corresponding values
412
+ carbon_water_fluxes_C4_outputs = {
413
+ "GPP_C4" : GPP_C4 ,
414
+ "LE_C4" : LE_C4 ,
415
+ "LE_soil_C4" : LE_soil_C4 ,
416
+ "LE_canopy_C4" : LE_canopy_C4 ,
417
+ "Rn_C4" : Rn_C4 ,
418
+ "Rn_soil_C4" : Rn_soil_C4 ,
419
+ "Rn_canopy_C4" : Rn_canopy_C4
420
+ }
421
+
422
+ # Check the distribution for each variable
423
+ for var_name , var_value in carbon_water_fluxes_C4_outputs .items ():
424
+ check_distribution (var_value , var_name , time_UTC )
425
+
346
426
# interpolate C3 and C4 GPP
347
427
ST_K = ST_C + 273.15
348
428
GPP = np .clip (interpolate_C3_C4 (GPP_C3 , GPP_C4 , C4_fraction ), 0 , 50 )
0 commit comments