hestia-earth-models 0.65.4__py3-none-any.whl → 0.65.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of hestia-earth-models might be problematic. Click here for more details.
- hestia_earth/models/agribalyse2016/fuelElectricity.py +40 -24
- hestia_earth/models/aware/scarcityWeightedWaterUse.py +1 -1
- hestia_earth/models/chaudharyBrooks2018/damageToTerrestrialEcosystemsLandOccupation.py +1 -1
- hestia_earth/models/chaudharyBrooks2018/damageToTerrestrialEcosystemsLandTransformation.py +1 -1
- hestia_earth/models/chaudharyBrooks2018/damageToTerrestrialEcosystemsTotalLandUseEffects.py +1 -1
- hestia_earth/models/cml2001Baseline/abioticResourceDepletionFossilFuels.py +9 -5
- hestia_earth/models/cycle/completeness/electricityFuel.py +4 -2
- hestia_earth/models/geospatialDatabase/precipitationAnnual.py +2 -2
- hestia_earth/models/geospatialDatabase/precipitationLongTermAnnualMean.py +2 -2
- hestia_earth/models/geospatialDatabase/precipitationMonthly.py +2 -2
- hestia_earth/models/geospatialDatabase/temperatureAnnual.py +2 -2
- hestia_earth/models/geospatialDatabase/temperatureLongTermAnnualMean.py +2 -2
- hestia_earth/models/geospatialDatabase/temperatureMonthly.py +2 -2
- hestia_earth/models/hestia/landCover.py +101 -68
- hestia_earth/models/hestia/landTransformation100YearAverageDuringCycle.py +49 -0
- hestia_earth/models/hestia/landTransformation20YearAverageDuringCycle.py +49 -0
- hestia_earth/models/hestia/resourceUse_utils.py +200 -0
- hestia_earth/models/hestia/seed_emissions.py +35 -21
- hestia_earth/models/hestia/utils.py +48 -0
- hestia_earth/models/impact_assessment/emissions.py +20 -5
- hestia_earth/models/ipcc2019/co2ToAirCarbonStockChange_utils.py +66 -28
- hestia_earth/models/ipcc2019/organicCarbonPerHa_tier_1_utils.py +26 -142
- hestia_earth/models/ipcc2019/organicCarbonPerHa_tier_2_utils.py +3 -3
- hestia_earth/models/ipcc2019/organicCarbonPerHa_utils.py +8 -5
- hestia_earth/models/linkedImpactAssessment/utils.py +3 -1
- hestia_earth/models/mocking/search-results.json +27 -4504
- hestia_earth/models/pooreNemecek2018/freshwaterWithdrawalsDuringCycle.py +4 -1
- hestia_earth/models/schererPfister2015/nErosionSoilFlux.py +23 -14
- hestia_earth/models/schererPfister2015/pErosionSoilFlux.py +23 -15
- hestia_earth/models/schererPfister2015/utils.py +3 -5
- hestia_earth/models/site/management.py +82 -22
- hestia_earth/models/utils/blank_node.py +28 -0
- hestia_earth/models/utils/crop.py +5 -1
- hestia_earth/models/utils/fuel.py +4 -1
- hestia_earth/models/utils/impact_assessment.py +7 -5
- hestia_earth/models/utils/pesticideAI.py +1 -0
- hestia_earth/models/version.py +1 -1
- {hestia_earth_models-0.65.4.dist-info → hestia_earth_models-0.65.6.dist-info}/METADATA +2 -2
- {hestia_earth_models-0.65.4.dist-info → hestia_earth_models-0.65.6.dist-info}/RECORD +52 -46
- tests/models/cml2001Baseline/test_abioticResourceDepletionFossilFuels.py +1 -1
- tests/models/hestia/test_landCover.py +2 -1
- tests/models/hestia/test_landTransformation100YearAverageDuringCycle.py +30 -0
- tests/models/hestia/test_landTransformation20YearAverageDuringCycle.py +31 -0
- tests/models/ipcc2019/test_co2ToAirAboveGroundBiomassStockChange.py +3 -1
- tests/models/ipcc2019/test_co2ToAirBelowGroundBiomassStockChange.py +3 -1
- tests/models/ipcc2019/test_co2ToAirSoilOrganicCarbonStockChange.py +3 -1
- tests/models/ipcc2019/test_organicCarbonPerHa.py +3 -2
- tests/models/ipcc2019/test_organicCarbonPerHa_tier_1_utils.py +15 -11
- tests/models/utils/test_blank_node.py +22 -7
- {hestia_earth_models-0.65.4.dist-info → hestia_earth_models-0.65.6.dist-info}/LICENSE +0 -0
- {hestia_earth_models-0.65.4.dist-info → hestia_earth_models-0.65.6.dist-info}/WHEEL +0 -0
- {hestia_earth_models-0.65.4.dist-info → hestia_earth_models-0.65.6.dist-info}/top_level.txt +0 -0
|
@@ -219,18 +219,6 @@ _SOC_REFS = {
|
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
_LAND_USE_FACTORS = {
|
|
222
|
-
IpccLandUseCategory.GRASSLAND: {
|
|
223
|
-
EcoClimateZone.WARM_TEMPERATE_MOIST: {"value": 1},
|
|
224
|
-
EcoClimateZone.WARM_TEMPERATE_DRY: {"value": 1},
|
|
225
|
-
EcoClimateZone.COOL_TEMPERATE_MOIST: {"value": 1},
|
|
226
|
-
EcoClimateZone.COOL_TEMPERATE_DRY: {"value": 1},
|
|
227
|
-
EcoClimateZone.BOREAL_MOIST: {"value": 1},
|
|
228
|
-
EcoClimateZone.BOREAL_DRY: {"value": 1},
|
|
229
|
-
EcoClimateZone.TROPICAL_MONTANE: {"value": 1},
|
|
230
|
-
EcoClimateZone.TROPICAL_WET: {"value": 1},
|
|
231
|
-
EcoClimateZone.TROPICAL_MOIST: {"value": 1},
|
|
232
|
-
EcoClimateZone.TROPICAL_DRY: {"value": 1}
|
|
233
|
-
},
|
|
234
222
|
IpccLandUseCategory.PERENNIAL_CROPS: {
|
|
235
223
|
EcoClimateZone.WARM_TEMPERATE_MOIST: {"value": 0.72, "error": 22},
|
|
236
224
|
EcoClimateZone.WARM_TEMPERATE_DRY: {"value": 0.72, "error": 22},
|
|
@@ -290,42 +278,6 @@ _LAND_USE_FACTORS = {
|
|
|
290
278
|
EcoClimateZone.TROPICAL_WET: {"value": 0.82, "error": 17},
|
|
291
279
|
EcoClimateZone.TROPICAL_MOIST: {"value": 0.82, "error": 17},
|
|
292
280
|
EcoClimateZone.TROPICAL_DRY: {"value": 0.93, "error": 11}
|
|
293
|
-
},
|
|
294
|
-
IpccLandUseCategory.FOREST: {
|
|
295
|
-
EcoClimateZone.WARM_TEMPERATE_MOIST: {"value": 1},
|
|
296
|
-
EcoClimateZone.WARM_TEMPERATE_DRY: {"value": 1},
|
|
297
|
-
EcoClimateZone.COOL_TEMPERATE_MOIST: {"value": 1},
|
|
298
|
-
EcoClimateZone.COOL_TEMPERATE_DRY: {"value": 1},
|
|
299
|
-
EcoClimateZone.BOREAL_MOIST: {"value": 1},
|
|
300
|
-
EcoClimateZone.BOREAL_DRY: {"value": 1},
|
|
301
|
-
EcoClimateZone.TROPICAL_MONTANE: {"value": 1},
|
|
302
|
-
EcoClimateZone.TROPICAL_WET: {"value": 1},
|
|
303
|
-
EcoClimateZone.TROPICAL_MOIST: {"value": 1},
|
|
304
|
-
EcoClimateZone.TROPICAL_DRY: {"value": 1}
|
|
305
|
-
},
|
|
306
|
-
IpccLandUseCategory.NATIVE: {
|
|
307
|
-
EcoClimateZone.WARM_TEMPERATE_MOIST: {"value": 1},
|
|
308
|
-
EcoClimateZone.WARM_TEMPERATE_DRY: {"value": 1},
|
|
309
|
-
EcoClimateZone.COOL_TEMPERATE_MOIST: {"value": 1},
|
|
310
|
-
EcoClimateZone.COOL_TEMPERATE_DRY: {"value": 1},
|
|
311
|
-
EcoClimateZone.BOREAL_MOIST: {"value": 1},
|
|
312
|
-
EcoClimateZone.BOREAL_DRY: {"value": 1},
|
|
313
|
-
EcoClimateZone.TROPICAL_MONTANE: {"value": 1},
|
|
314
|
-
EcoClimateZone.TROPICAL_WET: {"value": 1},
|
|
315
|
-
EcoClimateZone.TROPICAL_MOIST: {"value": 1},
|
|
316
|
-
EcoClimateZone.TROPICAL_DRY: {"value": 1}
|
|
317
|
-
},
|
|
318
|
-
IpccLandUseCategory.OTHER: {
|
|
319
|
-
EcoClimateZone.WARM_TEMPERATE_MOIST: {"value": 1},
|
|
320
|
-
EcoClimateZone.WARM_TEMPERATE_DRY: {"value": 1},
|
|
321
|
-
EcoClimateZone.COOL_TEMPERATE_MOIST: {"value": 1},
|
|
322
|
-
EcoClimateZone.COOL_TEMPERATE_DRY: {"value": 1},
|
|
323
|
-
EcoClimateZone.BOREAL_MOIST: {"value": 1},
|
|
324
|
-
EcoClimateZone.BOREAL_DRY: {"value": 1},
|
|
325
|
-
EcoClimateZone.TROPICAL_MONTANE: {"value": 1},
|
|
326
|
-
EcoClimateZone.TROPICAL_WET: {"value": 1},
|
|
327
|
-
EcoClimateZone.TROPICAL_MOIST: {"value": 1},
|
|
328
|
-
EcoClimateZone.TROPICAL_DRY: {"value": 1}
|
|
329
281
|
}
|
|
330
282
|
}
|
|
331
283
|
|
|
@@ -366,30 +318,6 @@ _MANAGEMENT_FACTORS = {
|
|
|
366
318
|
EcoClimateZone.TROPICAL_MOIST: {"value": 0.9, "error": 8},
|
|
367
319
|
EcoClimateZone.TROPICAL_DRY: {"value": 0.9, "error": 8}
|
|
368
320
|
},
|
|
369
|
-
IpccManagementCategory.NOMINALLY_MANAGED: {
|
|
370
|
-
EcoClimateZone.WARM_TEMPERATE_MOIST: {"value": 1},
|
|
371
|
-
EcoClimateZone.WARM_TEMPERATE_DRY: {"value": 1},
|
|
372
|
-
EcoClimateZone.COOL_TEMPERATE_MOIST: {"value": 1},
|
|
373
|
-
EcoClimateZone.COOL_TEMPERATE_DRY: {"value": 1},
|
|
374
|
-
EcoClimateZone.BOREAL_MOIST: {"value": 1},
|
|
375
|
-
EcoClimateZone.BOREAL_DRY: {"value": 1},
|
|
376
|
-
EcoClimateZone.TROPICAL_MONTANE: {"value": 1},
|
|
377
|
-
EcoClimateZone.TROPICAL_WET: {"value": 1},
|
|
378
|
-
EcoClimateZone.TROPICAL_MOIST: {"value": 1},
|
|
379
|
-
EcoClimateZone.TROPICAL_DRY: {"value": 1}
|
|
380
|
-
},
|
|
381
|
-
IpccManagementCategory.FULL_TILLAGE: {
|
|
382
|
-
EcoClimateZone.WARM_TEMPERATE_MOIST: {"value": 1},
|
|
383
|
-
EcoClimateZone.WARM_TEMPERATE_DRY: {"value": 1},
|
|
384
|
-
EcoClimateZone.COOL_TEMPERATE_MOIST: {"value": 1},
|
|
385
|
-
EcoClimateZone.COOL_TEMPERATE_DRY: {"value": 1},
|
|
386
|
-
EcoClimateZone.BOREAL_MOIST: {"value": 1},
|
|
387
|
-
EcoClimateZone.BOREAL_DRY: {"value": 1},
|
|
388
|
-
EcoClimateZone.TROPICAL_MONTANE: {"value": 1},
|
|
389
|
-
EcoClimateZone.TROPICAL_WET: {"value": 1},
|
|
390
|
-
EcoClimateZone.TROPICAL_MOIST: {"value": 1},
|
|
391
|
-
EcoClimateZone.TROPICAL_DRY: {"value": 1}
|
|
392
|
-
},
|
|
393
321
|
IpccManagementCategory.REDUCED_TILLAGE: {
|
|
394
322
|
EcoClimateZone.WARM_TEMPERATE_MOIST: {"value": 1.05, "error": 4},
|
|
395
323
|
EcoClimateZone.WARM_TEMPERATE_DRY: {"value": 0.99, "error": 3},
|
|
@@ -413,18 +341,6 @@ _MANAGEMENT_FACTORS = {
|
|
|
413
341
|
EcoClimateZone.TROPICAL_WET: {"value": 1.1, "error": 5},
|
|
414
342
|
EcoClimateZone.TROPICAL_MOIST: {"value": 1.1, "error": 5},
|
|
415
343
|
EcoClimateZone.TROPICAL_DRY: {"value": 1.04, "error": 7}
|
|
416
|
-
},
|
|
417
|
-
IpccManagementCategory.OTHER: {
|
|
418
|
-
EcoClimateZone.WARM_TEMPERATE_MOIST: {"value": 1},
|
|
419
|
-
EcoClimateZone.WARM_TEMPERATE_DRY: {"value": 1},
|
|
420
|
-
EcoClimateZone.COOL_TEMPERATE_MOIST: {"value": 1},
|
|
421
|
-
EcoClimateZone.COOL_TEMPERATE_DRY: {"value": 1},
|
|
422
|
-
EcoClimateZone.BOREAL_MOIST: {"value": 1},
|
|
423
|
-
EcoClimateZone.BOREAL_DRY: {"value": 1},
|
|
424
|
-
EcoClimateZone.TROPICAL_MONTANE: {"value": 1},
|
|
425
|
-
EcoClimateZone.TROPICAL_WET: {"value": 1},
|
|
426
|
-
EcoClimateZone.TROPICAL_MOIST: {"value": 1},
|
|
427
|
-
EcoClimateZone.TROPICAL_DRY: {"value": 1}
|
|
428
344
|
}
|
|
429
345
|
}
|
|
430
346
|
|
|
@@ -441,18 +357,6 @@ _CARBON_INPUT_FACTORS = {
|
|
|
441
357
|
EcoClimateZone.TROPICAL_MOIST: {"value": 1.11, "error": 7},
|
|
442
358
|
EcoClimateZone.TROPICAL_DRY: {"value": 1.11, "error": 7}
|
|
443
359
|
},
|
|
444
|
-
IpccCarbonInputCategory.GRASSLAND_MEDIUM: {
|
|
445
|
-
EcoClimateZone.WARM_TEMPERATE_MOIST: {"value": 1},
|
|
446
|
-
EcoClimateZone.WARM_TEMPERATE_DRY: {"value": 1},
|
|
447
|
-
EcoClimateZone.COOL_TEMPERATE_MOIST: {"value": 1},
|
|
448
|
-
EcoClimateZone.COOL_TEMPERATE_DRY: {"value": 1},
|
|
449
|
-
EcoClimateZone.BOREAL_MOIST: {"value": 1},
|
|
450
|
-
EcoClimateZone.BOREAL_DRY: {"value": 1},
|
|
451
|
-
EcoClimateZone.TROPICAL_MONTANE: {"value": 1},
|
|
452
|
-
EcoClimateZone.TROPICAL_WET: {"value": 1},
|
|
453
|
-
EcoClimateZone.TROPICAL_MOIST: {"value": 1},
|
|
454
|
-
EcoClimateZone.TROPICAL_DRY: {"value": 1}
|
|
455
|
-
},
|
|
456
360
|
IpccCarbonInputCategory.CROPLAND_HIGH_WITH_MANURE: {
|
|
457
361
|
EcoClimateZone.WARM_TEMPERATE_MOIST: {"value": 1.44, "error": 13},
|
|
458
362
|
EcoClimateZone.WARM_TEMPERATE_DRY: {"value": 1.37, "error": 12},
|
|
@@ -477,18 +381,6 @@ _CARBON_INPUT_FACTORS = {
|
|
|
477
381
|
EcoClimateZone.TROPICAL_MOIST: {"value": 1.11, "error": 10},
|
|
478
382
|
EcoClimateZone.TROPICAL_DRY: {"value": 1.04, "error": 13}
|
|
479
383
|
},
|
|
480
|
-
IpccCarbonInputCategory.CROPLAND_MEDIUM: {
|
|
481
|
-
EcoClimateZone.WARM_TEMPERATE_MOIST: {"value": 1},
|
|
482
|
-
EcoClimateZone.WARM_TEMPERATE_DRY: {"value": 1},
|
|
483
|
-
EcoClimateZone.COOL_TEMPERATE_MOIST: {"value": 1},
|
|
484
|
-
EcoClimateZone.COOL_TEMPERATE_DRY: {"value": 1},
|
|
485
|
-
EcoClimateZone.BOREAL_MOIST: {"value": 1},
|
|
486
|
-
EcoClimateZone.BOREAL_DRY: {"value": 1},
|
|
487
|
-
EcoClimateZone.TROPICAL_MONTANE: {"value": 1},
|
|
488
|
-
EcoClimateZone.TROPICAL_WET: {"value": 1},
|
|
489
|
-
EcoClimateZone.TROPICAL_MOIST: {"value": 1},
|
|
490
|
-
EcoClimateZone.TROPICAL_DRY: {"value": 1}
|
|
491
|
-
},
|
|
492
384
|
IpccCarbonInputCategory.CROPLAND_LOW: {
|
|
493
385
|
EcoClimateZone.WARM_TEMPERATE_MOIST: {"value": 0.92, "error": 14},
|
|
494
386
|
EcoClimateZone.WARM_TEMPERATE_DRY: {"value": 0.95, "error": 13},
|
|
@@ -500,18 +392,6 @@ _CARBON_INPUT_FACTORS = {
|
|
|
500
392
|
EcoClimateZone.TROPICAL_WET: {"value": 0.92, "error": 14},
|
|
501
393
|
EcoClimateZone.TROPICAL_MOIST: {"value": 0.92, "error": 14},
|
|
502
394
|
EcoClimateZone.TROPICAL_DRY: {"value": 0.95, "error": 13}
|
|
503
|
-
},
|
|
504
|
-
IpccCarbonInputCategory.OTHER: {
|
|
505
|
-
EcoClimateZone.WARM_TEMPERATE_MOIST: {"value": 1},
|
|
506
|
-
EcoClimateZone.WARM_TEMPERATE_DRY: {"value": 1},
|
|
507
|
-
EcoClimateZone.COOL_TEMPERATE_MOIST: {"value": 1},
|
|
508
|
-
EcoClimateZone.COOL_TEMPERATE_DRY: {"value": 1},
|
|
509
|
-
EcoClimateZone.BOREAL_MOIST: {"value": 1},
|
|
510
|
-
EcoClimateZone.BOREAL_DRY: {"value": 1},
|
|
511
|
-
EcoClimateZone.TROPICAL_MONTANE: {"value": 1},
|
|
512
|
-
EcoClimateZone.TROPICAL_WET: {"value": 1},
|
|
513
|
-
EcoClimateZone.TROPICAL_MOIST: {"value": 1},
|
|
514
|
-
EcoClimateZone.TROPICAL_DRY: {"value": 1}
|
|
515
395
|
}
|
|
516
396
|
}
|
|
517
397
|
|
|
@@ -556,7 +436,7 @@ def _sample_parameter(
|
|
|
556
436
|
The sampled parameter as a numpy array with shape `(1, iterations)`.
|
|
557
437
|
"""
|
|
558
438
|
parameter_dict = _IPCC_CATEGORY_TO_FACTOR_DICT.get(type(parameter))
|
|
559
|
-
kwargs = parameter_dict.get(parameter, {}).get(eco_climate_zone, {})
|
|
439
|
+
kwargs = parameter_dict.get(parameter, {}).get(eco_climate_zone, {"value": 1})
|
|
560
440
|
func = _get_sample_func(kwargs)
|
|
561
441
|
return func(iterations=iterations, seed=seed, **kwargs)
|
|
562
442
|
|
|
@@ -1008,7 +888,7 @@ def _compile_inventory(
|
|
|
1008
888
|
|
|
1009
889
|
# If no `landCover` nodes in `site.management` use `site.siteType` to assign static `IpccLandUseCategory`.
|
|
1010
890
|
run_with_site_type = len(filter_list_term_type(management_nodes, [TermTermType.LANDCOVER])) == 0
|
|
1011
|
-
site_type_ipcc_land_use_category = SITE_TYPE_TO_IPCC_LAND_USE_CATEGORY.get(site_type, IpccLandUseCategory.
|
|
891
|
+
site_type_ipcc_land_use_category = SITE_TYPE_TO_IPCC_LAND_USE_CATEGORY.get(site_type, IpccLandUseCategory.UNKNOWN)
|
|
1012
892
|
|
|
1013
893
|
grouped_management = group_nodes_by_year(management_nodes)
|
|
1014
894
|
|
|
@@ -1213,7 +1093,7 @@ def _assign_ipcc_land_use_category(
|
|
|
1213
1093
|
Assigned IPCC land use category.
|
|
1214
1094
|
"""
|
|
1215
1095
|
DECISION_TREE = _LAND_USE_CATEGORY_DECISION_TREE
|
|
1216
|
-
DEFAULT = IpccLandUseCategory.
|
|
1096
|
+
DEFAULT = IpccLandUseCategory.UNKNOWN
|
|
1217
1097
|
|
|
1218
1098
|
cover_crop_nodes, land_cover_nodes = split_on_condition(
|
|
1219
1099
|
filter_list_term_type(management_nodes, [TermTermType.LANDCOVER]),
|
|
@@ -1389,7 +1269,7 @@ def _assign_ipcc_management_category(
|
|
|
1389
1269
|
"""
|
|
1390
1270
|
decision_tree = _IPCC_LAND_USE_CATEGORY_TO_DECISION_TREE.get(ipcc_land_use_category, {})
|
|
1391
1271
|
default = _IPCC_LAND_USE_CATEGORY_TO_DEFAULT_IPCC_MANAGEMENT_CATEGORY.get(
|
|
1392
|
-
ipcc_land_use_category, IpccManagementCategory.
|
|
1272
|
+
ipcc_land_use_category, IpccManagementCategory.NOT_RELEVANT
|
|
1393
1273
|
)
|
|
1394
1274
|
|
|
1395
1275
|
land_cover_nodes = filter_list_term_type(management_nodes, [TermTermType.LANDCOVER])
|
|
@@ -1431,10 +1311,10 @@ def _check_grassland_ipcc_management_category(
|
|
|
1431
1311
|
bool
|
|
1432
1312
|
`True` if the conditions match the specified management category, `False` otherwise.
|
|
1433
1313
|
"""
|
|
1434
|
-
|
|
1314
|
+
target_term_ids = IPCC_MANAGEMENT_CATEGORY_TO_GRASSLAND_MANAGEMENT_TERM_ID.get(key, None)
|
|
1435
1315
|
return cumulative_nodes_term_match(
|
|
1436
1316
|
land_cover_nodes,
|
|
1437
|
-
target_term_ids=
|
|
1317
|
+
target_term_ids=target_term_ids,
|
|
1438
1318
|
cumulative_threshold=MIN_AREA_THRESHOLD
|
|
1439
1319
|
)
|
|
1440
1320
|
|
|
@@ -1443,8 +1323,7 @@ _GRASSLAND_IPCC_MANAGEMENT_CATEGORY_DECISION_TREE = {
|
|
|
1443
1323
|
IpccManagementCategory.SEVERELY_DEGRADED: _check_grassland_ipcc_management_category,
|
|
1444
1324
|
IpccManagementCategory.IMPROVED_GRASSLAND: _check_grassland_ipcc_management_category,
|
|
1445
1325
|
IpccManagementCategory.HIGH_INTENSITY_GRAZING: _check_grassland_ipcc_management_category,
|
|
1446
|
-
IpccManagementCategory.NOMINALLY_MANAGED: _check_grassland_ipcc_management_category
|
|
1447
|
-
IpccManagementCategory.OTHER: _check_grassland_ipcc_management_category
|
|
1326
|
+
IpccManagementCategory.NOMINALLY_MANAGED: _check_grassland_ipcc_management_category
|
|
1448
1327
|
}
|
|
1449
1328
|
"""
|
|
1450
1329
|
Decision tree mapping IPCC management categories to corresponding check functions for grassland.
|
|
@@ -1508,9 +1387,9 @@ Value: Corresponding decision tree for IPCC management categories based on land
|
|
|
1508
1387
|
"""
|
|
1509
1388
|
|
|
1510
1389
|
_IPCC_LAND_USE_CATEGORY_TO_DEFAULT_IPCC_MANAGEMENT_CATEGORY = {
|
|
1511
|
-
IpccLandUseCategory.GRASSLAND: IpccManagementCategory.
|
|
1512
|
-
IpccLandUseCategory.ANNUAL_CROPS_WET: IpccManagementCategory.
|
|
1513
|
-
IpccLandUseCategory.ANNUAL_CROPS: IpccManagementCategory.
|
|
1390
|
+
IpccLandUseCategory.GRASSLAND: IpccManagementCategory.UNKNOWN,
|
|
1391
|
+
IpccLandUseCategory.ANNUAL_CROPS_WET: IpccManagementCategory.UNKNOWN,
|
|
1392
|
+
IpccLandUseCategory.ANNUAL_CROPS: IpccManagementCategory.UNKNOWN
|
|
1514
1393
|
}
|
|
1515
1394
|
"""
|
|
1516
1395
|
Mapping of default IPCC management categories for each IPCC land use category.
|
|
@@ -1540,7 +1419,9 @@ def _assign_ipcc_carbon_input_category(
|
|
|
1540
1419
|
Assigned IPCC Carbon Input Category.
|
|
1541
1420
|
"""
|
|
1542
1421
|
decision_tree = _DECISION_TREE_FROM_IPCC_MANAGEMENT_CATEGORY.get(ipcc_management_category, {})
|
|
1543
|
-
default = _DEFAULT_CARBON_INPUT_CATEGORY.get(
|
|
1422
|
+
default = _DEFAULT_CARBON_INPUT_CATEGORY.get(
|
|
1423
|
+
ipcc_management_category, IpccCarbonInputCategory.NOT_RELEVANT
|
|
1424
|
+
)
|
|
1544
1425
|
|
|
1545
1426
|
should_run_ = len(management_nodes) > 0
|
|
1546
1427
|
|
|
@@ -1577,7 +1458,7 @@ def _check_grassland_ipcc_carbon_input_category(
|
|
|
1577
1458
|
|
|
1578
1459
|
_GRASSLAND_IPCC_CARBON_INPUT_CATEGORY_TO_MIN_NUM_IMPROVEMENTS = {
|
|
1579
1460
|
IpccCarbonInputCategory.GRASSLAND_HIGH: 2,
|
|
1580
|
-
IpccCarbonInputCategory.GRASSLAND_MEDIUM:
|
|
1461
|
+
IpccCarbonInputCategory.GRASSLAND_MEDIUM: 0
|
|
1581
1462
|
}
|
|
1582
1463
|
"""
|
|
1583
1464
|
A mapping from IPCC Grassland Carbon Input Categories to the minimum number of improvements required.
|
|
@@ -1898,10 +1779,10 @@ Value: Decision tree for Carbon Input Categories corresponding to the management
|
|
|
1898
1779
|
"""
|
|
1899
1780
|
|
|
1900
1781
|
_DEFAULT_CARBON_INPUT_CATEGORY = {
|
|
1901
|
-
IpccManagementCategory.IMPROVED_GRASSLAND: IpccCarbonInputCategory.
|
|
1902
|
-
IpccManagementCategory.FULL_TILLAGE: IpccCarbonInputCategory.
|
|
1903
|
-
IpccManagementCategory.REDUCED_TILLAGE: IpccCarbonInputCategory.
|
|
1904
|
-
IpccManagementCategory.NO_TILLAGE: IpccCarbonInputCategory.
|
|
1782
|
+
IpccManagementCategory.IMPROVED_GRASSLAND: IpccCarbonInputCategory.UNKNOWN,
|
|
1783
|
+
IpccManagementCategory.FULL_TILLAGE: IpccCarbonInputCategory.UNKNOWN,
|
|
1784
|
+
IpccManagementCategory.REDUCED_TILLAGE: IpccCarbonInputCategory.UNKNOWN,
|
|
1785
|
+
IpccManagementCategory.NO_TILLAGE: IpccCarbonInputCategory.UNKNOWN
|
|
1905
1786
|
}
|
|
1906
1787
|
"""
|
|
1907
1788
|
A mapping from IPCC Management Categories to default Carbon Input Categories.
|
|
@@ -2030,8 +1911,10 @@ def _should_run_inventory_year(group: dict) -> bool:
|
|
|
2030
1911
|
"""
|
|
2031
1912
|
Determines whether there is sufficient data in an inventory year to run the tier 1 model.
|
|
2032
1913
|
|
|
2033
|
-
1. Check if
|
|
2034
|
-
2. Check if
|
|
1914
|
+
1. Check if all required keys are present.
|
|
1915
|
+
2. Check if the land use category is not "OTHER" or "UNKNOWN"
|
|
1916
|
+
3. Check if the management category is not "UNKNOWN"
|
|
1917
|
+
4. Check if the carbon input category is not "UNKNOWN"
|
|
2035
1918
|
|
|
2036
1919
|
Parameters
|
|
2037
1920
|
----------
|
|
@@ -2043,7 +1926,8 @@ def _should_run_inventory_year(group: dict) -> bool:
|
|
|
2043
1926
|
bool
|
|
2044
1927
|
True if the inventory year is valid, False otherwise.
|
|
2045
1928
|
"""
|
|
2046
|
-
return all([
|
|
2047
|
-
group.get(_InventoryKey.LU_CATEGORY)
|
|
2048
|
-
|
|
1929
|
+
return all(key in group.keys() for key in _REQUIRED_KEYS) and all([
|
|
1930
|
+
group.get(_InventoryKey.LU_CATEGORY) not in [IpccLandUseCategory.OTHER, IpccLandUseCategory.UNKNOWN],
|
|
1931
|
+
group.get(_InventoryKey.MG_CATEGORY) not in [IpccManagementCategory.UNKNOWN],
|
|
1932
|
+
group.get(_InventoryKey.CI_CATEGORY) not in [IpccCarbonInputCategory.UNKNOWN]
|
|
2049
1933
|
])
|
|
@@ -765,7 +765,7 @@ def _get_f_2_annual(
|
|
|
765
765
|
Get the value of `f_2` (the stabilisation efficiencies for structural decay products entering the active pool)
|
|
766
766
|
based on the tillage `IpccManagementCategory`.
|
|
767
767
|
|
|
768
|
-
If tillage regime is unknown, `IpccManagementCategory.
|
|
768
|
+
If tillage regime is unknown, `IpccManagementCategory.UNKNOWN` should be assumed.
|
|
769
769
|
|
|
770
770
|
Parameters
|
|
771
771
|
----------
|
|
@@ -793,7 +793,7 @@ def _get_f_2_annual(
|
|
|
793
793
|
IpccManagementCategory.FULL_TILLAGE: f_2_full_tillage,
|
|
794
794
|
IpccManagementCategory.REDUCED_TILLAGE: f_2_reduced_tillage,
|
|
795
795
|
IpccManagementCategory.NO_TILLAGE: f_2_no_tillage,
|
|
796
|
-
IpccManagementCategory.
|
|
796
|
+
IpccManagementCategory.UNKNOWN: f_2_unknown_tillage
|
|
797
797
|
}
|
|
798
798
|
default = f_2_unknown_tillage
|
|
799
799
|
return vstack([ipcc_tillage_management_category_to_f_2s.get(till, default) for till in tillage_category_annual])
|
|
@@ -1611,7 +1611,7 @@ def _get_grouped_tillage_categories(grouped_cycles):
|
|
|
1611
1611
|
|
|
1612
1612
|
def _assign_tier_2_ipcc_tillage_management_category(
|
|
1613
1613
|
cycles: list[dict],
|
|
1614
|
-
default: IpccManagementCategory = IpccManagementCategory.
|
|
1614
|
+
default: IpccManagementCategory = IpccManagementCategory.UNKNOWN
|
|
1615
1615
|
) -> IpccManagementCategory:
|
|
1616
1616
|
"""
|
|
1617
1617
|
Assigns a tillage `IpccManagementCategory` to a list of HESTIA `Cycle`s.
|
|
@@ -65,6 +65,7 @@ class IpccLandUseCategory(Enum):
|
|
|
65
65
|
FOREST = "forest"
|
|
66
66
|
NATIVE = "native"
|
|
67
67
|
OTHER = "other"
|
|
68
|
+
UNKNOWN = "unknown"
|
|
68
69
|
|
|
69
70
|
|
|
70
71
|
SITE_TYPE_TO_IPCC_LAND_USE_CATEGORY = {
|
|
@@ -84,7 +85,8 @@ IPCC_LAND_USE_CATEGORY_TO_LAND_COVER_LOOKUP_VALUE = {
|
|
|
84
85
|
IpccLandUseCategory.ANNUAL_CROPS: "Annual crops",
|
|
85
86
|
IpccLandUseCategory.SET_ASIDE: "Set aside",
|
|
86
87
|
IpccLandUseCategory.FOREST: "Forest",
|
|
87
|
-
IpccLandUseCategory.NATIVE: "Native"
|
|
88
|
+
IpccLandUseCategory.NATIVE: "Native",
|
|
89
|
+
IpccLandUseCategory.OTHER: "Other"
|
|
88
90
|
}
|
|
89
91
|
"""
|
|
90
92
|
A dictionary mapping IPCC land use categories to corresponding land cover lookup values in the
|
|
@@ -106,15 +108,15 @@ class IpccManagementCategory(Enum):
|
|
|
106
108
|
FULL_TILLAGE = "full tillage"
|
|
107
109
|
REDUCED_TILLAGE = "reduced tillage"
|
|
108
110
|
NO_TILLAGE = "no tillage"
|
|
109
|
-
|
|
111
|
+
UNKNOWN = "unknown"
|
|
112
|
+
NOT_RELEVANT = "not relevant"
|
|
110
113
|
|
|
111
114
|
|
|
112
115
|
IPCC_MANAGEMENT_CATEGORY_TO_GRASSLAND_MANAGEMENT_TERM_ID = {
|
|
113
116
|
IpccManagementCategory.SEVERELY_DEGRADED: "severelyDegradedPasture",
|
|
114
117
|
IpccManagementCategory.IMPROVED_GRASSLAND: "improvedPasture",
|
|
115
118
|
IpccManagementCategory.HIGH_INTENSITY_GRAZING: "highIntensityGrazingPasture",
|
|
116
|
-
IpccManagementCategory.NOMINALLY_MANAGED: "nominallyManagedPasture",
|
|
117
|
-
IpccManagementCategory.OTHER: "nativePasture"
|
|
119
|
+
IpccManagementCategory.NOMINALLY_MANAGED: ["nominallyManagedPasture", "nativePasture"]
|
|
118
120
|
}
|
|
119
121
|
"""
|
|
120
122
|
A dictionary mapping IPCC management categories to corresponding grassland management term IDs from the land cover
|
|
@@ -146,7 +148,8 @@ class IpccCarbonInputCategory(Enum):
|
|
|
146
148
|
CROPLAND_HIGH_WITHOUT_MANURE = "cropland high (without manure)"
|
|
147
149
|
CROPLAND_MEDIUM = "cropland medium"
|
|
148
150
|
CROPLAND_LOW = "cropland low"
|
|
149
|
-
|
|
151
|
+
UNKNOWN = "unknown"
|
|
152
|
+
NOT_RELEVANT = "not relevant"
|
|
150
153
|
|
|
151
154
|
|
|
152
155
|
CarbonSource = NamedTuple(
|
|
@@ -23,7 +23,9 @@ def _run_indicators(impact_assessment: dict, product: dict, term_id: str):
|
|
|
23
23
|
list_sum(value.get('input').get('value')) * value.get('indicator').get('value')
|
|
24
24
|
for value in values
|
|
25
25
|
])
|
|
26
|
-
value = convert_value_from_cycle(
|
|
26
|
+
value = convert_value_from_cycle(
|
|
27
|
+
impact_assessment, product, sum_values(values_from_cycle), model=MODEL, term_id=term_id
|
|
28
|
+
)
|
|
27
29
|
|
|
28
30
|
# show values per input in the logs
|
|
29
31
|
debugValues(impact_assessment, model=MODEL, term=term_id,
|