hestia-earth-models 0.65.4__py3-none-any.whl → 0.65.5__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/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 +31 -46
- 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 +779 -763
- 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/utils/blank_node.py +28 -0
- 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.5.dist-info}/METADATA +2 -2
- {hestia_earth_models-0.65.4.dist-info → hestia_earth_models-0.65.5.dist-info}/RECORD +47 -41
- 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.5.dist-info}/LICENSE +0 -0
- {hestia_earth_models-0.65.4.dist-info → hestia_earth_models-0.65.5.dist-info}/WHEEL +0 -0
- {hestia_earth_models-0.65.4.dist-info → hestia_earth_models-0.65.5.dist-info}/top_level.txt +0 -0
|
@@ -41,7 +41,9 @@ RUN_SCENARIOS = [
|
|
|
41
41
|
("non-soil-based-gohac-system", 3), # Closes issue #848
|
|
42
42
|
("soil-based-gohac-system", 3), # Closes issue #848
|
|
43
43
|
("with-gapfilled-start-date-end-date", 1), # Closes issue #972
|
|
44
|
-
("forest-to-orchard-with-ground-cover", 3)
|
|
44
|
+
("forest-to-orchard-with-ground-cover", 3), # Closes issue #989
|
|
45
|
+
("orchard-data-complete", 3), # Closes issue #1011
|
|
46
|
+
("orchard-data-partially-complete", 3) # Closes issue #1011
|
|
45
47
|
]
|
|
46
48
|
"""List of (subfolder: str, num_cycles: int)."""
|
|
47
49
|
|
|
@@ -40,7 +40,9 @@ RUN_SCENARIOS = [
|
|
|
40
40
|
("multiple-method-classifications", 5), # Closes issue #764
|
|
41
41
|
("non-soil-based-gohac-system", 3), # Closes issue #848
|
|
42
42
|
("with-gapfilled-start-date-end-date", 1), # Closes issue #972
|
|
43
|
-
("forest-to-orchard-with-ground-cover", 3)
|
|
43
|
+
("forest-to-orchard-with-ground-cover", 3), # Closes issue #989
|
|
44
|
+
("orchard-data-complete", 3), # Closes issue #1011
|
|
45
|
+
("orchard-data-partially-complete", 3) # Closes issue #1011
|
|
44
46
|
]
|
|
45
47
|
"""List of (subfolder: str, num_cycles: int)."""
|
|
46
48
|
|
|
@@ -64,7 +64,9 @@ RUN_SCENARIOS = [
|
|
|
64
64
|
("multiple-method-classifications", 5), # Closes issue #764
|
|
65
65
|
("non-soil-based-gohac-system", 3), # Closes issue #848
|
|
66
66
|
("with-gapfilled-start-date-end-date", 1), # Closes issue #972
|
|
67
|
-
("forest-to-orchard-with-ground-cover", 3)
|
|
67
|
+
("forest-to-orchard-with-ground-cover", 3), # Closes issue #989
|
|
68
|
+
("orchard-data-complete", 3), # Closes issue #1011
|
|
69
|
+
("orchard-data-partially-complete", 3) # Closes issue #1011
|
|
68
70
|
]
|
|
69
71
|
"""List of (subfolder: str, num_cycles: int)."""
|
|
70
72
|
|
|
@@ -105,7 +105,7 @@ PARAMS_SHOULD_RUN = [
|
|
|
105
105
|
("tier-1/should-not-run", False),
|
|
106
106
|
("tier-1/without-management-with-measured-soc", False),
|
|
107
107
|
("tier-1/land-use-change", True), # Closes issue 755
|
|
108
|
-
("tier-1/run-with-site-type",
|
|
108
|
+
("tier-1/run-with-site-type", False), # Closes issue 755
|
|
109
109
|
("tier-1/cropland-polar", False), # Closes issue 794
|
|
110
110
|
("tier-1/cropland-with-system-increasing-c-input", True), # Closes issue 851
|
|
111
111
|
("tier-1/with-gapfilled-start-date-end-date", False), # Closes issue 972
|
|
@@ -122,7 +122,8 @@ PARAMS_SHOULD_RUN = [
|
|
|
122
122
|
("tier-2/with-irrigation-dates", True), # Closes issue 716
|
|
123
123
|
("tier-2/with-paddy-rice", False), # Closes issue 718
|
|
124
124
|
("tier-2/with-sand-without-date", True), # Closes issue 739
|
|
125
|
-
("tier-2/with-irrigated-upland-rice", False)
|
|
125
|
+
("tier-2/with-irrigated-upland-rice", False), # Closes issue 718
|
|
126
|
+
("tier-1/land-use-change-with-unknown-management", True) # Closes issue 1007
|
|
126
127
|
]
|
|
127
128
|
IDS_SHOULD_RUN = [p[0] for p in PARAMS_SHOULD_RUN]
|
|
128
129
|
|
|
@@ -154,6 +154,7 @@ LAND_USE_CATEGORY_PARAMS = [
|
|
|
154
154
|
("set-aside", IpccSoilCategory.LOW_ACTIVITY_CLAY_SOILS, IpccLandUseCategory.SET_ASIDE),
|
|
155
155
|
("set-aside-override", IpccSoilCategory.LOW_ACTIVITY_CLAY_SOILS, IpccLandUseCategory.SET_ASIDE),
|
|
156
156
|
("upland-rice", IpccSoilCategory.LOW_ACTIVITY_CLAY_SOILS, IpccLandUseCategory.ANNUAL_CROPS),
|
|
157
|
+
("unknown", IpccSoilCategory.LOW_ACTIVITY_CLAY_SOILS, IpccLandUseCategory.UNKNOWN)
|
|
157
158
|
]
|
|
158
159
|
|
|
159
160
|
|
|
@@ -194,14 +195,14 @@ MANAGEMENT_CATEGORY_PARAMS = [
|
|
|
194
195
|
("full-tillage", IpccLandUseCategory.ANNUAL_CROPS, IpccManagementCategory.FULL_TILLAGE),
|
|
195
196
|
("high-intensity-grazing", IpccLandUseCategory.GRASSLAND, IpccManagementCategory.HIGH_INTENSITY_GRAZING),
|
|
196
197
|
("improved-grassland", IpccLandUseCategory.GRASSLAND, IpccManagementCategory.IMPROVED_GRASSLAND),
|
|
197
|
-
("no-management/annual-crops", IpccLandUseCategory.ANNUAL_CROPS, IpccManagementCategory.FULL_TILLAGE),
|
|
198
|
-
("no-management/annual-crops-wet", IpccLandUseCategory.ANNUAL_CROPS_WET, IpccManagementCategory.FULL_TILLAGE),
|
|
199
|
-
("no-management/grassland", IpccLandUseCategory.GRASSLAND, IpccManagementCategory.NOMINALLY_MANAGED),
|
|
200
198
|
("no-tillage", IpccLandUseCategory.ANNUAL_CROPS, IpccManagementCategory.NO_TILLAGE),
|
|
201
199
|
("nominally-managed", IpccLandUseCategory.GRASSLAND, IpccManagementCategory.NOMINALLY_MANAGED),
|
|
202
|
-
("
|
|
200
|
+
("not-relevant", IpccLandUseCategory.OTHER, IpccManagementCategory.NOT_RELEVANT),
|
|
203
201
|
("reduced-tillage", IpccLandUseCategory.ANNUAL_CROPS, IpccManagementCategory.REDUCED_TILLAGE),
|
|
204
202
|
("severely-degraded", IpccLandUseCategory.GRASSLAND, IpccManagementCategory.SEVERELY_DEGRADED),
|
|
203
|
+
("unknown/annual-crops", IpccLandUseCategory.ANNUAL_CROPS, IpccManagementCategory.UNKNOWN),
|
|
204
|
+
("unknown/annual-crops-wet", IpccLandUseCategory.ANNUAL_CROPS_WET, IpccManagementCategory.UNKNOWN),
|
|
205
|
+
("unknown/grassland", IpccLandUseCategory.GRASSLAND, IpccManagementCategory.UNKNOWN)
|
|
205
206
|
]
|
|
206
207
|
|
|
207
208
|
|
|
@@ -310,7 +311,10 @@ CARBON_INPUT_CATEGORY_PARAMS = [
|
|
|
310
311
|
"grassland-medium/1-improvements",
|
|
311
312
|
IpccManagementCategory.IMPROVED_GRASSLAND,
|
|
312
313
|
IpccCarbonInputCategory.GRASSLAND_MEDIUM
|
|
313
|
-
)
|
|
314
|
+
),
|
|
315
|
+
("not-relevant", IpccManagementCategory.NOT_RELEVANT, IpccCarbonInputCategory.NOT_RELEVANT),
|
|
316
|
+
("unknown/cropland", IpccManagementCategory.FULL_TILLAGE, IpccCarbonInputCategory.UNKNOWN),
|
|
317
|
+
("unknown/grassland", IpccManagementCategory.IMPROVED_GRASSLAND, IpccCarbonInputCategory.UNKNOWN)
|
|
314
318
|
]
|
|
315
319
|
|
|
316
320
|
|
|
@@ -395,18 +399,18 @@ def test_calc_soc_stocks(regime_start_years, soc_equilibriums, expected):
|
|
|
395
399
|
TEST_INVENTORY = {
|
|
396
400
|
1960: {
|
|
397
401
|
_InventoryKey.LU_CATEGORY: IpccLandUseCategory.FOREST,
|
|
398
|
-
_InventoryKey.MG_CATEGORY: IpccManagementCategory.
|
|
399
|
-
_InventoryKey.CI_CATEGORY: IpccCarbonInputCategory.
|
|
402
|
+
_InventoryKey.MG_CATEGORY: IpccManagementCategory.NOT_RELEVANT,
|
|
403
|
+
_InventoryKey.CI_CATEGORY: IpccCarbonInputCategory.NOT_RELEVANT
|
|
400
404
|
},
|
|
401
405
|
1965: {
|
|
402
406
|
_InventoryKey.LU_CATEGORY: IpccLandUseCategory.FOREST,
|
|
403
|
-
_InventoryKey.MG_CATEGORY: IpccManagementCategory.
|
|
404
|
-
_InventoryKey.CI_CATEGORY: IpccCarbonInputCategory.
|
|
407
|
+
_InventoryKey.MG_CATEGORY: IpccManagementCategory.NOT_RELEVANT,
|
|
408
|
+
_InventoryKey.CI_CATEGORY: IpccCarbonInputCategory.NOT_RELEVANT
|
|
405
409
|
},
|
|
406
410
|
1970: {
|
|
407
411
|
_InventoryKey.LU_CATEGORY: IpccLandUseCategory.GRASSLAND,
|
|
408
412
|
_InventoryKey.MG_CATEGORY: IpccManagementCategory.NOMINALLY_MANAGED,
|
|
409
|
-
_InventoryKey.CI_CATEGORY: IpccCarbonInputCategory.
|
|
413
|
+
_InventoryKey.CI_CATEGORY: IpccCarbonInputCategory.NOT_RELEVANT
|
|
410
414
|
},
|
|
411
415
|
1995: {
|
|
412
416
|
_InventoryKey.LU_CATEGORY: IpccLandUseCategory.ANNUAL_CROPS,
|
|
@@ -434,7 +438,7 @@ EXPECTED_MISSING_YEARS = {
|
|
|
434
438
|
1990: {
|
|
435
439
|
_InventoryKey.LU_CATEGORY: IpccLandUseCategory.GRASSLAND,
|
|
436
440
|
_InventoryKey.MG_CATEGORY: IpccManagementCategory.NOMINALLY_MANAGED,
|
|
437
|
-
_InventoryKey.CI_CATEGORY: IpccCarbonInputCategory.
|
|
441
|
+
_InventoryKey.CI_CATEGORY: IpccCarbonInputCategory.NOT_RELEVANT
|
|
438
442
|
},
|
|
439
443
|
2023: {
|
|
440
444
|
_InventoryKey.LU_CATEGORY: IpccLandUseCategory.ANNUAL_CROPS,
|
|
@@ -25,7 +25,7 @@ from hestia_earth.models.utils.blank_node import (
|
|
|
25
25
|
split_node_by_dates,
|
|
26
26
|
_most_recent_nodes,
|
|
27
27
|
_shallowest_node,
|
|
28
|
-
validate_start_date_end_date
|
|
28
|
+
validate_start_date_end_date, _str_dates_match
|
|
29
29
|
)
|
|
30
30
|
|
|
31
31
|
|
|
@@ -338,7 +338,7 @@ def test_get_date_month():
|
|
|
338
338
|
|
|
339
339
|
Should only be found in blank node `dates` field. (Format not permitted in `startDate` or `endDate` fields.)
|
|
340
340
|
"""
|
|
341
|
-
assert _get_datestr_format(DATESTR_MONTH)
|
|
341
|
+
assert _get_datestr_format(DATESTR_MONTH) == DatestrFormat.MONTH
|
|
342
342
|
|
|
343
343
|
|
|
344
344
|
def test_get_date_month_day():
|
|
@@ -347,7 +347,7 @@ def test_get_date_month_day():
|
|
|
347
347
|
|
|
348
348
|
Should only be found in blank node `dates` field. (Format not permitted in `startDate` or `endDate` fields.)
|
|
349
349
|
"""
|
|
350
|
-
assert _get_datestr_format(DATESTR_MONTH_DAY)
|
|
350
|
+
assert _get_datestr_format(DATESTR_MONTH_DAY) == DatestrFormat.MONTH_DAY
|
|
351
351
|
|
|
352
352
|
|
|
353
353
|
def test_get_datestr_format_no_zero_padding():
|
|
@@ -355,21 +355,34 @@ def test_get_datestr_format_no_zero_padding():
|
|
|
355
355
|
assert _get_datestr_format(DATE_STR) is None
|
|
356
356
|
|
|
357
357
|
|
|
358
|
+
def test_str_dates_match():
|
|
359
|
+
assert _str_dates_match("2010", "2010-12-31") is True
|
|
360
|
+
assert _str_dates_match("2010", "2010-01-01") is False
|
|
361
|
+
assert _str_dates_match("2010", "2010-12-31") is True
|
|
362
|
+
assert _str_dates_match("2010", "2010-01") is False
|
|
363
|
+
|
|
364
|
+
assert _str_dates_match("2010", "2010-12-31", mode=DatestrGapfillMode.START) is False
|
|
365
|
+
assert _str_dates_match("2010", "2010-01-01", mode=DatestrGapfillMode.START) is True
|
|
366
|
+
|
|
367
|
+
|
|
358
368
|
# --- test _gapfill_datestr ---
|
|
359
369
|
|
|
360
370
|
|
|
361
371
|
def test_complete_datestr_year():
|
|
362
|
-
assert _gapfill_datestr(DATESTR_YEAR)
|
|
363
|
-
assert _gapfill_datestr(DATESTR_YEAR, DatestrGapfillMode.
|
|
372
|
+
assert _gapfill_datestr(DATESTR_YEAR) == "2000-01-01T00:00:00"
|
|
373
|
+
assert _gapfill_datestr(DATESTR_YEAR, DatestrGapfillMode.MIDDLE) == "2000-07-01T23:59:59"
|
|
374
|
+
assert _gapfill_datestr(DATESTR_YEAR, DatestrGapfillMode.END) == "2000-12-31T23:59:59"
|
|
364
375
|
|
|
365
376
|
|
|
366
377
|
def test_complete_datestr_year_month():
|
|
367
|
-
assert _gapfill_datestr(DATESTR_YEAR_MONTH)
|
|
378
|
+
assert _gapfill_datestr(DATESTR_YEAR_MONTH) == "2000-01-01T00:00:00"
|
|
379
|
+
assert _gapfill_datestr(DATESTR_YEAR_MONTH, DatestrGapfillMode.MIDDLE) == "2000-01-16T11:59:59"
|
|
368
380
|
assert _gapfill_datestr(DATESTR_YEAR_MONTH, DatestrGapfillMode.END) == "2000-01-31T23:59:59"
|
|
369
381
|
|
|
370
382
|
|
|
371
383
|
def test_complete_datestr_year_month_day():
|
|
372
|
-
assert _gapfill_datestr(DATESTR_YEAR_MONTH_DAY)
|
|
384
|
+
assert _gapfill_datestr(DATESTR_YEAR_MONTH_DAY) == "2000-01-01T00:00:00"
|
|
385
|
+
assert _gapfill_datestr(DATESTR_YEAR_MONTH_DAY, DatestrGapfillMode.MIDDLE) == "2000-01-01T11:59:59"
|
|
373
386
|
assert _gapfill_datestr(DATESTR_YEAR_MONTH_DAY, DatestrGapfillMode.END) == "2000-01-01T23:59:59"
|
|
374
387
|
|
|
375
388
|
|
|
@@ -379,9 +392,11 @@ def test_gapfill_datestr_feburary():
|
|
|
379
392
|
"""
|
|
380
393
|
# Non-leap year
|
|
381
394
|
assert _gapfill_datestr("1981-02") == "1981-02-01T00:00:00"
|
|
395
|
+
assert _gapfill_datestr("1981-02", DatestrGapfillMode.MIDDLE) == "1981-02-14T23:59:59"
|
|
382
396
|
assert _gapfill_datestr("1981-02", DatestrGapfillMode.END) == "1981-02-28T23:59:59"
|
|
383
397
|
|
|
384
398
|
# Leap year
|
|
399
|
+
assert _gapfill_datestr("2024-02", DatestrGapfillMode.MIDDLE) == "2024-02-15T11:59:59"
|
|
385
400
|
assert _gapfill_datestr("2024-02", DatestrGapfillMode.END) == "2024-02-29T23:59:59"
|
|
386
401
|
|
|
387
402
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|