hestia-earth-models 0.74.16__py3-none-any.whl → 0.74.17__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.

@@ -1,3 +1,4 @@
1
+ from functools import lru_cache
1
2
  from hestia_earth.schema import SchemaType, TermTermType
2
3
  from hestia_earth.utils.lookup import download_lookup, extract_grouped_data, get_table_value, column_name
3
4
  from hestia_earth.utils.model import find_term_match, linked_node
@@ -99,11 +100,10 @@ def node_has_property(term_id: str):
99
100
  return lambda product: find_term_match(product.get('properties', []), term_id, None) is not None
100
101
 
101
102
 
102
- def node_property_lookup_value(model: str, node_term: dict, prop_id: str, default=None, **log_args):
103
- # as the lookup table might not exist, we are making sure we return `0` in thise case
103
+ @lru_cache()
104
+ def node_property_lookup_value(model: str, term_id: str, term_type: str, prop_id: str, default=None, **log_args):
104
105
  try:
105
- lookup_name = f"{node_term.get('termType')}-property.csv"
106
- term_id = node_term.get('@id')
106
+ lookup_name = f"{term_type}-property.csv"
107
107
  lookup_value = get_table_value(download_lookup(lookup_name), 'termid', term_id, column_name(prop_id))
108
108
  value = extract_grouped_data(lookup_value, 'Avg') if (
109
109
  isinstance(lookup_value, str) and 'Avg' in lookup_value
@@ -111,16 +111,18 @@ def node_property_lookup_value(model: str, node_term: dict, prop_id: str, defaul
111
111
  debugMissingLookup(lookup_name, 'termid', term_id, prop_id, value, model=model, **log_args)
112
112
  return safe_parse_float(value, default=None)
113
113
  except Exception:
114
- return default
114
+ value = get_lookup_value({'@id': term_id, 'termType': term_type}, prop_id, skip_debug=True)
115
+ return default if value is None else value
115
116
 
116
117
 
117
118
  def get_node_property_value(model: str, node: dict, prop_id: str, default=None, handle_percents=True, **log_args):
118
119
  prop = get_node_property(node, prop_id, download_from_hestia=True)
119
120
  term = prop.get('term')
121
+ node_term = node.get('term', {})
120
122
  units = (term or {}).get('units')
121
123
  value = (
122
124
  prop['value'] if 'value' in prop else
123
- node_property_lookup_value(model, node.get('term', {}), prop_id, **log_args)
125
+ node_property_lookup_value(model, node_term.get('@id'), node_term.get('termType'), prop_id, **log_args)
124
126
  )
125
127
  return default if value is None else (value / 100 if units == '%' and handle_percents else value)
126
128
 
@@ -1 +1 @@
1
- VERSION = '0.74.16'
1
+ VERSION = '0.74.17'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hestia_earth_models
3
- Version: 0.74.16
3
+ Version: 0.74.17
4
4
  Summary: HESTIA's set of modules for filling gaps in the activity data using external datasets (e.g. populating soil properties with a geospatial dataset using provided coordinates) and internal lookups (e.g. populating machinery use from fuel use). Includes rules for when gaps should be filled versus not (e.g. never gap fill yield, gap fill crop residue if yield provided etc.).
5
5
  Home-page: https://gitlab.com/hestia-earth/hestia-engine-models
6
6
  Author: HESTIA Team
@@ -5,7 +5,7 @@ hestia_earth/models/cache_sites.py,sha256=0TK08ewVobQkXQ-qph_uB_mfoOhEqcPr4KKwlP
5
5
  hestia_earth/models/log.py,sha256=8rZGVAztD5Cy-w9MJWVN7U3pKyxuYHTYnrtn_LmGebI,6524
6
6
  hestia_earth/models/preload_requests.py,sha256=-eb4TA4m-A4bLcdAwbKqr3TIsDteVSXhJGCp95mQCew,2504
7
7
  hestia_earth/models/requirements.py,sha256=eU4yT443fx7BnaokhrLB_PCizJI7Y6m4auyo8vQauNg,17363
8
- hestia_earth/models/version.py,sha256=pAjI0uPlS9PobHdqZ_gfWUEgMfjtQh6Isw1ziaZ56XM,20
8
+ hestia_earth/models/version.py,sha256=n9M5qoRbC1ljXdVuxsbtDxipj4mxNKYZTh_Uz-hBdFk,20
9
9
  hestia_earth/models/agribalyse2016/__init__.py,sha256=WvK0qCQbnYtg9oZxrACd1wGormZyXibPtpCnIQeDqbw,415
10
10
  hestia_earth/models/agribalyse2016/fuelElectricity.py,sha256=FraWAl06a8OSqbAiHYYLv9e4fYZkVw42S9wikfjeTdw,4377
11
11
  hestia_earth/models/agribalyse2016/machineryInfrastructureDepreciatedAmountPerCycle.py,sha256=qRkDqpEt3WwleMfHdxMi2nezLmCAxa1TlJZ0IPHDTtI,2584
@@ -304,6 +304,7 @@ hestia_earth/models/ipcc2019/belowGroundBiomass.py,sha256=NOp8WaX1NJk0TawwJRGzdr
304
304
  hestia_earth/models/ipcc2019/belowGroundCropResidue.py,sha256=M9--7akmPWo7gfxEYnKobsJ0HyDzfAzRxLmrCt3Pg1Y,3505
305
305
  hestia_earth/models/ipcc2019/biocharOrganicCarbonPerHa.py,sha256=1N4dsiRY_pyLvPcq3g8uBiAiVwSScLFocS9FFBxRW1s,12580
306
306
  hestia_earth/models/ipcc2019/biomass_utils.py,sha256=NkTPGMl-0tqvhUZKZ1rxW0XTBnZOvgFJki_IPzEEyu0,15796
307
+ hestia_earth/models/ipcc2019/burning_utils.py,sha256=uq3ndASMuyMjDZLCqIcIRo2gHZnh0yi01HnLWhleaTA,1822
307
308
  hestia_earth/models/ipcc2019/carbonContent.py,sha256=XhXDu6DRQxANBsRsCEgw4f0UJDOgWsvhVyEwK1-4YT0,7263
308
309
  hestia_earth/models/ipcc2019/ch4ToAirAquacultureSystems.py,sha256=n1hG-p67BTXkJATvX1em6255WY0mJxk7SojzBwebtnQ,3385
309
310
  hestia_earth/models/ipcc2019/ch4ToAirEntericFermentation.py,sha256=piSmwF1G5mYO32_WWncq_k5PaJ0EWrYguVEl_vns6-Q,12167
@@ -344,7 +345,7 @@ hestia_earth/models/ipcc2019/no3ToGroundwaterCropResidueDecomposition.py,sha256=
344
345
  hestia_earth/models/ipcc2019/no3ToGroundwaterExcreta.py,sha256=BV7kdeGlDbSQASBtYZuLNTQktrteaMWGJzIbG97flH0,4319
345
346
  hestia_earth/models/ipcc2019/no3ToGroundwaterInorganicFertiliser.py,sha256=zww-PDlLdz3XbrlXfW7F8nWzP3Iud1uLW-mRo8HZf2o,3250
346
347
  hestia_earth/models/ipcc2019/no3ToGroundwaterOrganicFertiliser.py,sha256=AHCYaj_al-cLFtvWHhxZLlrZfpjIyWg2rKR435qqGxM,3184
347
- hestia_earth/models/ipcc2019/nonCo2EmissionsToAirNaturalVegetationBurning.py,sha256=Yja5IxLgc-oRnKHCW7f1Yezr4Kb0uvjG3U5YBG_gCI8,33472
348
+ hestia_earth/models/ipcc2019/nonCo2EmissionsToAirNaturalVegetationBurning.py,sha256=SFBZqhczOKsEQEm-xURnFwL9qL1a4W_JZgyiMR9cnhU,32446
348
349
  hestia_earth/models/ipcc2019/noxToAirInorganicFertiliser.py,sha256=nBBiKzGMUYtHkU49AKBxQ7OdD61cb9_Ehe7ixFWKHR4,4336
349
350
  hestia_earth/models/ipcc2019/noxToAirOrganicFertiliser.py,sha256=yONOR8ppiOXQlPPz68GQ2_3MFzvnOQTJTHpJ956ubW0,4008
350
351
  hestia_earth/models/ipcc2019/organicCarbonPerHa.py,sha256=qYR1iB95Uz841xPe727ZYUtrRhg_Unbktf1YEjZHqyU,8000
@@ -353,7 +354,7 @@ hestia_earth/models/ipcc2019/organicCarbonPerHa_tier_2.py,sha256=2kw9bhkR4o4ZSeC
353
354
  hestia_earth/models/ipcc2019/organicCarbonPerHa_utils.py,sha256=DDP3nY-QVRU10FkFihNbnF66-Oa6O6Tkn7ycnetN110,9924
354
355
  hestia_earth/models/ipcc2019/organicSoilCultivation_utils.py,sha256=S5XaM7142_ShxFFXPZ4HaOdofRzMYucWc--5udxuin4,5361
355
356
  hestia_earth/models/ipcc2019/pastureGrass.py,sha256=V1PRJ17dYw0p9lvuyRVFuYzJrpmNOs0FjhNUXOuUkyU,10202
356
- hestia_earth/models/ipcc2019/pastureGrass_utils.py,sha256=so5AFrr_0eKXkUoyBpYhHgSXhTQ5z2XADahm2At4RR0,14285
357
+ hestia_earth/models/ipcc2019/pastureGrass_utils.py,sha256=hAZQvG6VdY3KxVe2yiHoYNpGHRdnHApUZSuxUAZcGi0,14310
357
358
  hestia_earth/models/ipcc2019/utils.py,sha256=s3khA5nJ0rpFsrwWoIGW0y3OYrYA5Iw2GTxN86gO_K8,5890
358
359
  hestia_earth/models/ipcc2019/animal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
359
360
  hestia_earth/models/ipcc2019/animal/fatContent.py,sha256=rnFergteN5rwH9KLyVQR7iolh5Onj2gF785DnLIbIHI,994
@@ -472,7 +473,7 @@ hestia_earth/models/linkedImpactAssessment/utils.py,sha256=uxRu5thfTDGpCNIuv3Nak
472
473
  hestia_earth/models/mocking/__init__.py,sha256=-mJ_zrVWZSGc3awWW2YJfXAK3Nku77sAUgmmFa99Xmo,733
473
474
  hestia_earth/models/mocking/build_mock_search.py,sha256=p15ccEUmkmLp1RiGNznxMz3OFHbI8P1-29ExuohiQN8,1355
474
475
  hestia_earth/models/mocking/mock_search.py,sha256=uvklojTAbjDI7Jw43jGAUDcTHk1R3A3CWiYBJZI6rao,1493
475
- hestia_earth/models/mocking/search-results.json,sha256=p952Ct-tBlBsZZCWvszxcEg2Fkv2UpbLLE3QBoZrZtc,103986
476
+ hestia_earth/models/mocking/search-results.json,sha256=ZwHwW0gAsv9_R3lbPXty_PqIRlytWx9UA5Qme2zZdL4,104039
476
477
  hestia_earth/models/pooreNemecek2018/__init__.py,sha256=nPboL7ULJzL5nJD5q7q9VOZt_fxbKVm8fmn1Az5YkVY,417
477
478
  hestia_earth/models/pooreNemecek2018/aboveGroundCropResidueTotal.py,sha256=FoiRk-bULfC9VbhT7L-wgjehrUkG_74XiG2WnW1Rc-U,2402
478
479
  hestia_earth/models/pooreNemecek2018/belowGroundCropResidue.py,sha256=r7Wqo5v29NrKfhDd0g1QCharR2k6H5XFyAsKZ6pvYKY,2321
@@ -649,7 +650,7 @@ hestia_earth/models/utils/pesticideAI.py,sha256=DQIAjgkWjKPyuMLUvnEgVkeQGCEOBjyJ
649
650
  hestia_earth/models/utils/practice.py,sha256=EceuaGZjClr6fvgIV2MvsuD9jXJayTBTKCzp98oTGnU,1079
650
651
  hestia_earth/models/utils/product.py,sha256=MfkTtuitTUbBJoM3AHymcjnYzWux6FxnIzS-Q4xXtkY,11767
651
652
  hestia_earth/models/utils/productivity.py,sha256=KIyrIuGcf8QgdBY54i7i038ZPXGqArM6mCzi2vwU3pI,601
652
- hestia_earth/models/utils/property.py,sha256=bgQNSXNdJsc0iqmm96LCHrq7In75xZyzYrnhcy8iHr8,5457
653
+ hestia_earth/models/utils/property.py,sha256=bJlMTCbxrH_WIo16h6uX_OdRAjJH7KAdNUOQj7jJZLE,5562
653
654
  hestia_earth/models/utils/site.py,sha256=5S-53PHQnstr4LVveRuNhk4kpvGJtR8oc-t3OsxRyms,4128
654
655
  hestia_earth/models/utils/source.py,sha256=D_QlW7Ul_NV1iOucMNE3szT64b1RdSdecIEm6OukYhw,2459
655
656
  hestia_earth/models/utils/temperature.py,sha256=ljlG4-yCgFFb6LRZweb18cZKLrr7K2mqd4E4Hz_D1f8,476
@@ -675,7 +676,7 @@ hestia_earth/orchestrator/strategies/run/__init__.py,sha256=At0V8CI4vyiSY-Vh2PHM
675
676
  hestia_earth/orchestrator/strategies/run/add_blank_node_if_missing.py,sha256=lAfL-NK-gh2YQnTis2lIyb1uI_fsnwFWS10qwbga43M,2756
676
677
  hestia_earth/orchestrator/strategies/run/add_key_if_missing.py,sha256=t3U-v87XpbtpsvjA_r0Ftm7MhNkGB0kcUSGFlKBIK_I,352
677
678
  hestia_earth/orchestrator/strategies/run/always.py,sha256=D0In6_kr28s-fgqspawgvj5cgFClxGvepZYqtYsjWVE,217
678
- hestia_earth_models-0.74.16.dist-info/licenses/LICENSE,sha256=TD25LoiRJsA5CPUNrcyt1PXlGcbUGFMAeZoBcfCrCNE,1154
679
+ hestia_earth_models-0.74.17.dist-info/licenses/LICENSE,sha256=TD25LoiRJsA5CPUNrcyt1PXlGcbUGFMAeZoBcfCrCNE,1154
679
680
  tests/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
680
681
  tests/models/test_cache_nodes.py,sha256=lSSoBGFVXpNv_TePSetls6QbnhfLC7dNLmfiFqT6WuY,1043
681
682
  tests/models/test_cache_sites.py,sha256=eZkbgAhfA-67GhPgE4lk8byHnYvX2Ate1KPsE6jH1-c,2954
@@ -1299,7 +1300,7 @@ tests/orchestrator/strategies/run/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeR
1299
1300
  tests/orchestrator/strategies/run/test_add_blank_node_if_missing.py,sha256=K4xg4UAXfNhSaLyknKVPO7MGBF44Z_gD7CuZ_pe28gU,3512
1300
1301
  tests/orchestrator/strategies/run/test_add_key_if_missing.py,sha256=hKwvk1ohcBVnQUCTiDhRW99J0xEa29BpwFi1KC0yWLE,329
1301
1302
  tests/orchestrator/strategies/run/test_always.py,sha256=w5-Dhp6yLzgZGAeMRz3OrqZbbAed9gZ1O266a3z9k7w,134
1302
- hestia_earth_models-0.74.16.dist-info/METADATA,sha256=ycs7RzeRYtoGzBHHnfIw5MRX0sEEkYYcXRGbAznZPlY,4254
1303
- hestia_earth_models-0.74.16.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
1304
- hestia_earth_models-0.74.16.dist-info/top_level.txt,sha256=1dqA9TqpOLTEgpqa-YBsmbCmmNU1y56AtfFGEceZ2A0,19
1305
- hestia_earth_models-0.74.16.dist-info/RECORD,,
1303
+ hestia_earth_models-0.74.17.dist-info/METADATA,sha256=MQMZ5cIrnNeiLTJgCFHQEyOz_QJje2X7T_0ae25iK_U,4254
1304
+ hestia_earth_models-0.74.17.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
1305
+ hestia_earth_models-0.74.17.dist-info/top_level.txt,sha256=1dqA9TqpOLTEgpqa-YBsmbCmmNU1y56AtfFGEceZ2A0,19
1306
+ hestia_earth_models-0.74.17.dist-info/RECORD,,