hestia-earth-models 0.74.17__py3-none-any.whl → 0.75.1__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/__init__.py +0 -3
- hestia_earth/models/aware/scarcityWeightedWaterUse.py +2 -4
- hestia_earth/models/aware2_0/scarcityWeightedWaterUse.py +2 -5
- hestia_earth/models/chaudharyBrooks2018/utils.py +2 -2
- hestia_earth/models/cml2001Baseline/abioticResourceDepletionFossilFuels.py +3 -2
- hestia_earth/models/cml2001Baseline/abioticResourceDepletionMineralsAndMetals.py +13 -6
- hestia_earth/models/ecoalimV9/utils.py +3 -3
- hestia_earth/models/ecoinventV3/utils.py +2 -2
- hestia_earth/models/ecoinventV3AndEmberClimate/utils.py +2 -2
- hestia_earth/models/emissionNotRelevant/__init__.py +2 -2
- hestia_earth/models/environmentalFootprintV3_1/environmentalFootprintSingleOverallScore.py +1 -2
- hestia_earth/models/environmentalFootprintV3_1/soilQualityIndexLandOccupation.py +8 -5
- hestia_earth/models/faostat2018/utils.py +3 -3
- hestia_earth/models/frischknechtEtAl2000/ionisingRadiationKbqU235Eq.py +5 -4
- hestia_earth/models/geospatialDatabase/ecoClimateZone.py +2 -2
- hestia_earth/models/hestia/landCover_utils.py +8 -12
- hestia_earth/models/hestia/management.py +3 -3
- hestia_earth/models/hestia/seed_emissions.py +2 -2
- hestia_earth/models/ipcc2019/ch4ToAirEntericFermentation.py +12 -9
- hestia_earth/models/ipcc2019/ch4ToAirExcreta.py +2 -2
- hestia_earth/models/ipcc2019/nonCo2EmissionsToAirNaturalVegetationBurning.py +2 -2
- hestia_earth/models/ipcc2019/pastureGrass_utils.py +6 -3
- hestia_earth/models/ipcc2019/utils.py +3 -2
- hestia_earth/models/linkedImpactAssessment/emissions.py +2 -2
- hestia_earth/models/mocking/search-results.json +1 -1
- hestia_earth/models/requirements.py +2 -2
- hestia_earth/models/utils/aggregated.py +2 -2
- hestia_earth/models/utils/background_emissions.py +6 -5
- hestia_earth/models/utils/ecoClimateZone.py +7 -8
- hestia_earth/models/utils/excretaManagement.py +3 -3
- hestia_earth/models/utils/feedipedia.py +7 -7
- hestia_earth/models/utils/input.py +2 -2
- hestia_earth/models/utils/liveAnimal.py +4 -4
- hestia_earth/models/utils/lookup.py +15 -20
- hestia_earth/models/utils/property.py +3 -3
- hestia_earth/models/utils/term.py +5 -5
- hestia_earth/models/version.py +1 -1
- hestia_earth/orchestrator/__init__.py +0 -3
- hestia_earth/orchestrator/models/transformations.py +2 -2
- {hestia_earth_models-0.74.17.dist-info → hestia_earth_models-0.75.1.dist-info}/METADATA +10 -14
- {hestia_earth_models-0.74.17.dist-info → hestia_earth_models-0.75.1.dist-info}/RECORD +44 -668
- {hestia_earth_models-0.74.17.dist-info → hestia_earth_models-0.75.1.dist-info}/WHEEL +1 -1
- {hestia_earth_models-0.74.17.dist-info → hestia_earth_models-0.75.1.dist-info}/top_level.txt +0 -1
- hestia_earth/__init__.py +0 -1
- tests/models/__init__.py +0 -0
- tests/models/agribalyse2016/__init__.py +0 -0
- tests/models/agribalyse2016/test_fuelElectricity.py +0 -42
- tests/models/agribalyse2016/test_machineryInfrastructureDepreciatedAmountPerCycle.py +0 -36
- tests/models/akagiEtAl2011/__init__.py +0 -0
- tests/models/akagiEtAl2011/test_ch4ToAirCropResidueBurning.py +0 -33
- tests/models/akagiEtAl2011/test_nh3ToAirCropResidueBurning.py +0 -33
- tests/models/akagiEtAl2011/test_noxToAirCropResidueBurning.py +0 -33
- tests/models/akagiEtAl2011/test_pm25ToAirCropResidueBurning.py +0 -33
- tests/models/akagiEtAl2011/test_so2ToAirCropResidueBurning.py +0 -33
- tests/models/akagiEtAl2011/test_utils.py +0 -19
- tests/models/aware/__init__.py +0 -0
- tests/models/aware/test_scarcityWeightedWaterUse.py +0 -57
- tests/models/aware2_0/__init__.py +0 -0
- tests/models/aware2_0/test_scarcityWeightedWaterUse.py +0 -58
- tests/models/chaudharyBrooks2018/__init__.py +0 -0
- tests/models/chaudharyBrooks2018/test_damageToTerrestrialEcosystemsLandOccupation.py +0 -58
- tests/models/chaudharyBrooks2018/test_damageToTerrestrialEcosystemsLandTransformation.py +0 -58
- tests/models/chaudharyBrooks2018/test_damageToTerrestrialEcosystemsTotalLandUseEffects.py +0 -20
- tests/models/cml2001Baseline/__init__.py +0 -0
- tests/models/cml2001Baseline/test_abioticResourceDepletionFossilFuels.py +0 -141
- tests/models/cml2001Baseline/test_abioticResourceDepletionMineralsAndMetals.py +0 -105
- tests/models/cml2001Baseline/test_eutrophicationPotentialExcludingFate.py +0 -23
- tests/models/cml2001Baseline/test_resourceUseEnergyDepletionDuringCycle.py +0 -136
- tests/models/cml2001Baseline/test_resourceUseEnergyDepletionInputsProduction.py +0 -23
- tests/models/cml2001Baseline/test_resourceUseMineralsAndMetalsDuringCycle.py +0 -58
- tests/models/cml2001Baseline/test_resourceUseMineralsAndMetalsInputsProduction.py +0 -23
- tests/models/cml2001Baseline/test_terrestrialAcidificationPotentialIncludingFateAverageEurope.py +0 -25
- tests/models/cml2001NonBaseline/__init__.py +0 -0
- tests/models/cml2001NonBaseline/test_eutrophicationPotentialIncludingFateAverageEurope.py +0 -23
- tests/models/cml2001NonBaseline/test_terrestrialAcidificationPotentialExcludingFate.py +0 -23
- tests/models/cycle/__init__.py +0 -0
- tests/models/cycle/animal/__init__.py +0 -0
- tests/models/cycle/animal/input/__init__.py +0 -0
- tests/models/cycle/animal/input/test_hestiaAggregatedData.py +0 -40
- tests/models/cycle/animal/input/test_properties.py +0 -55
- tests/models/cycle/animal/test_milkYield.py +0 -30
- tests/models/cycle/animal/test_properties.py +0 -20
- tests/models/cycle/completeness/__init__.py +0 -0
- tests/models/cycle/completeness/test_animalFeed.py +0 -14
- tests/models/cycle/completeness/test_cropResidue.py +0 -19
- tests/models/cycle/completeness/test_electricityFuel.py +0 -21
- tests/models/cycle/completeness/test_excretaManagement.py +0 -14
- tests/models/cycle/completeness/test_freshForage.py +0 -21
- tests/models/cycle/completeness/test_material.py +0 -18
- tests/models/cycle/completeness/test_seed.py +0 -36
- tests/models/cycle/completeness/test_soilAmendment.py +0 -23
- tests/models/cycle/input/__init__.py +0 -0
- tests/models/cycle/input/test_hestiaAggregatedData.py +0 -91
- tests/models/cycle/input/test_properties.py +0 -55
- tests/models/cycle/input/test_value.py +0 -41
- tests/models/cycle/post_checks/__init__.py +0 -0
- tests/models/cycle/post_checks/test_cache.py +0 -8
- tests/models/cycle/post_checks/test_otherSites.py +0 -15
- tests/models/cycle/post_checks/test_site.py +0 -26
- tests/models/cycle/practice/__init__.py +0 -0
- tests/models/cycle/practice/test_landCover.py +0 -27
- tests/models/cycle/practice/test_value.py +0 -52
- tests/models/cycle/pre_checks/__init__.py +0 -0
- tests/models/cycle/pre_checks/test_otherSites.py +0 -21
- tests/models/cycle/pre_checks/test_site.py +0 -33
- tests/models/cycle/product/__init__.py +0 -0
- tests/models/cycle/product/test_currency.py +0 -41
- tests/models/cycle/product/test_economicValueShare.py +0 -158
- tests/models/cycle/product/test_price.py +0 -29
- tests/models/cycle/product/test_primary.py +0 -75
- tests/models/cycle/product/test_properties.py +0 -32
- tests/models/cycle/product/test_revenue.py +0 -32
- tests/models/cycle/product/test_value.py +0 -41
- tests/models/cycle/test_aboveGroundCropResidueTotal.py +0 -20
- tests/models/cycle/test_completeness.py +0 -51
- tests/models/cycle/test_cycleDuration.py +0 -31
- tests/models/cycle/test_endDate.py +0 -38
- tests/models/cycle/test_otherSitesArea.py +0 -68
- tests/models/cycle/test_otherSitesUnusedDuration.py +0 -54
- tests/models/cycle/test_post_checks.py +0 -11
- tests/models/cycle/test_pre_checks.py +0 -11
- tests/models/cycle/test_siteArea.py +0 -51
- tests/models/cycle/test_siteDuration.py +0 -83
- tests/models/cycle/test_siteUnusedDuration.py +0 -55
- tests/models/cycle/test_startDate.py +0 -58
- tests/models/cycle/test_startDateDefinition.py +0 -31
- tests/models/cycle/test_transformations.py +0 -17
- tests/models/dammgen2009/__init__.py +0 -0
- tests/models/dammgen2009/test_noxToAirExcreta.py +0 -58
- tests/models/data/__init__.py +0 -0
- tests/models/data/test_hestiaAggregatedData.py +0 -32
- tests/models/deRuijterEtAl2010/__init__.py +0 -0
- tests/models/deRuijterEtAl2010/test_nh3ToAirCropResidueDecomposition.py +0 -57
- tests/models/ecoalimV9/__init__.py +0 -0
- tests/models/ecoalimV9/test_cycle.py +0 -22
- tests/models/ecoalimV9/test_impact_assessment.py +0 -24
- tests/models/ecoinventV3/__init__.py +0 -0
- tests/models/ecoinventV3/test_cycle.py +0 -69
- tests/models/ecoinventV3AndEmberClimate/__init__.py +0 -0
- tests/models/ecoinventV3AndEmberClimate/test_cycle.py +0 -28
- tests/models/edip2003/__init__.py +0 -0
- tests/models/edip2003/test_ozoneDepletionPotential.py +0 -21
- tests/models/emepEea2019/__init__.py +0 -0
- tests/models/emepEea2019/test_co2ToAirFuelCombustion.py +0 -34
- tests/models/emepEea2019/test_n2OToAirFuelCombustionDirect.py +0 -34
- tests/models/emepEea2019/test_nh3ToAirExcreta.py +0 -36
- tests/models/emepEea2019/test_nh3ToAirFuelCombustion.py +0 -34
- tests/models/emepEea2019/test_nh3ToAirInorganicFertiliser.py +0 -64
- tests/models/emepEea2019/test_noxToAirFuelCombustion.py +0 -34
- tests/models/emepEea2019/test_pm10ToAirAnimalHousing.py +0 -21
- tests/models/emepEea2019/test_pm25ToAirAnimalHousing.py +0 -21
- tests/models/emepEea2019/test_so2ToAirFuelCombustion.py +0 -34
- tests/models/emepEea2019/test_tspToAirAnimalHousing.py +0 -21
- tests/models/emepEea2019/test_utils.py +0 -204
- tests/models/environmentalFootprintV3_1/__init__.py +0 -0
- tests/models/environmentalFootprintV3_1/test_environmentalFootprintSingleOverallScore.py +0 -138
- tests/models/environmentalFootprintV3_1/test_freshwaterEcotoxicityPotentialCtue.py +0 -26
- tests/models/environmentalFootprintV3_1/test_marineEutrophicationPotential.py +0 -21
- tests/models/environmentalFootprintV3_1/test_photochemicalOzoneCreationPotentialHumanHealthNmvocEq.py +0 -30
- tests/models/environmentalFootprintV3_1/test_scarcityWeightedWaterUse.py +0 -27
- tests/models/environmentalFootprintV3_1/test_soilQualityIndexLandOccupation.py +0 -160
- tests/models/environmentalFootprintV3_1/test_soilQualityIndexLandTransformation.py +0 -184
- tests/models/environmentalFootprintV3_1/test_soilQualityIndexTotalLandUseEffects.py +0 -78
- tests/models/epa2014/__init__.py +0 -0
- tests/models/epa2014/test_no3ToGroundwaterExcreta.py +0 -38
- tests/models/fantkeEtAl2016/__init__.py +0 -0
- tests/models/fantkeEtAl2016/test_damageToHumanHealthParticulateMatterFormation.py +0 -20
- tests/models/faostat2018/__init__.py +0 -0
- tests/models/faostat2018/product/__init__.py +0 -0
- tests/models/faostat2018/product/test_price.py +0 -117
- tests/models/faostat2018/test_coldCarcassWeightPerHead.py +0 -58
- tests/models/faostat2018/test_coldDressedCarcassWeightPerHead.py +0 -54
- tests/models/faostat2018/test_faostat_utils.py +0 -64
- tests/models/faostat2018/test_liveweightPerHead.py +0 -134
- tests/models/faostat2018/test_readyToCookWeightPerHead.py +0 -54
- tests/models/faostat2018/test_seed.py +0 -50
- tests/models/faostat2018/test_utils.py +0 -28
- tests/models/frischknechtEtAl2000/__init__.py +0 -0
- tests/models/frischknechtEtAl2000/test_ionisingRadiationKbqU235Eq.py +0 -138
- tests/models/geospatialDatabase/__init__.py +0 -0
- tests/models/geospatialDatabase/test_awareWaterBasinId.py +0 -27
- tests/models/geospatialDatabase/test_clayContent.py +0 -49
- tests/models/geospatialDatabase/test_croppingIntensity.py +0 -33
- tests/models/geospatialDatabase/test_drainageClass.py +0 -29
- tests/models/geospatialDatabase/test_ecoClimateZone.py +0 -32
- tests/models/geospatialDatabase/test_ecoregion.py +0 -27
- tests/models/geospatialDatabase/test_erodibility.py +0 -29
- tests/models/geospatialDatabase/test_heavyWinterPrecipitation.py +0 -29
- tests/models/geospatialDatabase/test_histosol.py +0 -33
- tests/models/geospatialDatabase/test_longFallowRatio.py +0 -33
- tests/models/geospatialDatabase/test_nutrientLossToAquaticEnvironment.py +0 -29
- tests/models/geospatialDatabase/test_organicCarbonPerKgSoil.py +0 -43
- tests/models/geospatialDatabase/test_potentialEvapotranspirationAnnual.py +0 -19
- tests/models/geospatialDatabase/test_potentialEvapotranspirationLongTermAnnualMean.py +0 -30
- tests/models/geospatialDatabase/test_potentialEvapotranspirationMonthly.py +0 -20
- tests/models/geospatialDatabase/test_precipitationAnnual.py +0 -20
- tests/models/geospatialDatabase/test_precipitationLongTermAnnualMean.py +0 -29
- tests/models/geospatialDatabase/test_precipitationMonthly.py +0 -20
- tests/models/geospatialDatabase/test_region.py +0 -27
- tests/models/geospatialDatabase/test_sandContent.py +0 -49
- tests/models/geospatialDatabase/test_siltContent.py +0 -37
- tests/models/geospatialDatabase/test_slope.py +0 -29
- tests/models/geospatialDatabase/test_slopeLength.py +0 -29
- tests/models/geospatialDatabase/test_soilPh.py +0 -43
- tests/models/geospatialDatabase/test_temperatureAnnual.py +0 -20
- tests/models/geospatialDatabase/test_temperatureLongTermAnnualMean.py +0 -29
- tests/models/geospatialDatabase/test_temperatureMonthly.py +0 -20
- tests/models/geospatialDatabase/test_totalNitrogenPerKgSoil.py +0 -43
- tests/models/geospatialDatabase/test_totalPhosphorusPerKgSoil.py +0 -29
- tests/models/geospatialDatabase/test_utils.py +0 -39
- tests/models/geospatialDatabase/test_waterDepth.py +0 -28
- tests/models/globalCropWaterModel2008/__init__.py +0 -0
- tests/models/globalCropWaterModel2008/test_rootingDepth.py +0 -84
- tests/models/haversineFormula/__init__.py +0 -0
- tests/models/haversineFormula/transport/__init__.py +0 -0
- tests/models/haversineFormula/transport/test_distance.py +0 -28
- tests/models/hestia/__init__.py +0 -0
- tests/models/hestia/test_aboveGroundCropResidue.py +0 -40
- tests/models/hestia/test_aboveGroundCropResidueTotal.py +0 -41
- tests/models/hestia/test_brackishWater.py +0 -32
- tests/models/hestia/test_cationExchangeCapacityPerKgSoil.py +0 -34
- tests/models/hestia/test_coldCarcassWeightPerHead.py +0 -47
- tests/models/hestia/test_coldDressedCarcassWeightPerHead.py +0 -47
- tests/models/hestia/test_concentrateFeed.py +0 -52
- tests/models/hestia/test_cropResidueManagement.py +0 -53
- tests/models/hestia/test_croppingIntensity.py +0 -53
- tests/models/hestia/test_default_emissions.py +0 -32
- tests/models/hestia/test_default_resourceUse.py +0 -32
- tests/models/hestia/test_energyContentLowerHeatingValue.py +0 -40
- tests/models/hestia/test_excretaKgMass.py +0 -97
- tests/models/hestia/test_excretaKgN.py +0 -36
- tests/models/hestia/test_excretaKgVs.py +0 -36
- tests/models/hestia/test_feedConversionRatio.py +0 -64
- tests/models/hestia/test_flowingWater.py +0 -44
- tests/models/hestia/test_freshWater.py +0 -32
- tests/models/hestia/test_histosol.py +0 -24
- tests/models/hestia/test_inorganicFertiliser.py +0 -20
- tests/models/hestia/test_irrigatedTypeUnspecified.py +0 -59
- tests/models/hestia/test_landCover.py +0 -100
- tests/models/hestia/test_landCover_utils.py +0 -233
- tests/models/hestia/test_landOccupationDuringCycle.py +0 -75
- tests/models/hestia/test_landTransformation100YearAverageDuringCycle.py +0 -30
- tests/models/hestia/test_landTransformation20YearAverageDuringCycle.py +0 -29
- tests/models/hestia/test_liveAnimal.py +0 -64
- tests/models/hestia/test_longFallowRatio.py +0 -49
- tests/models/hestia/test_management.py +0 -80
- tests/models/hestia/test_materialsAndSubstrate.py +0 -49
- tests/models/hestia/test_milkYield.py +0 -58
- tests/models/hestia/test_netPrimaryProduction.py +0 -38
- tests/models/hestia/test_organicCarbonPerHa.py +0 -104
- tests/models/hestia/test_organicCarbonPerKgSoil.py +0 -34
- tests/models/hestia/test_organicCarbonPerM3Soil.py +0 -34
- tests/models/hestia/test_organicMatterPerKgSoil.py +0 -34
- tests/models/hestia/test_organicMatterPerM3Soil.py +0 -34
- tests/models/hestia/test_pToSurfaceWaterAquacultureSystems.py +0 -56
- tests/models/hestia/test_pastureGrass.py +0 -31
- tests/models/hestia/test_pastureSystem.py +0 -47
- tests/models/hestia/test_potentialEvapotranspirationAnnual.py +0 -32
- tests/models/hestia/test_potentialEvapotranspirationMonthly.py +0 -32
- tests/models/hestia/test_precipitationAnnual.py +0 -32
- tests/models/hestia/test_precipitationMonthly.py +0 -32
- tests/models/hestia/test_rainfallAnnual.py +0 -32
- tests/models/hestia/test_rainfallMonthly.py +0 -32
- tests/models/hestia/test_readyToCookWeightPerHead.py +0 -47
- tests/models/hestia/test_residueBurnt.py +0 -37
- tests/models/hestia/test_residueIncorporated.py +0 -48
- tests/models/hestia/test_residueLeftOnField.py +0 -37
- tests/models/hestia/test_residueRemoved.py +0 -32
- tests/models/hestia/test_salineWater.py +0 -32
- tests/models/hestia/test_seed_emissions.py +0 -27
- tests/models/hestia/test_slope.py +0 -23
- tests/models/hestia/test_slopeLength.py +0 -23
- tests/models/hestia/test_soilClassification.py +0 -72
- tests/models/hestia/test_soilMeasurement.py +0 -156
- tests/models/hestia/test_stockingDensityAnimalHousingAverage.py +0 -42
- tests/models/hestia/test_temperatureAnnual.py +0 -32
- tests/models/hestia/test_temperatureMonthly.py +0 -32
- tests/models/hestia/test_totalNitrogenPerKgSoil.py +0 -36
- tests/models/hestia/test_unknownPreSeasonWaterRegime.py +0 -36
- tests/models/hestia/test_waterDepth.py +0 -34
- tests/models/hestia/test_waterSalinity.py +0 -38
- tests/models/impact_assessment/__init__.py +0 -0
- tests/models/impact_assessment/post_checks/__init__.py +0 -0
- tests/models/impact_assessment/post_checks/test_cycle.py +0 -28
- tests/models/impact_assessment/post_checks/test_remove_cache_fields.py +0 -6
- tests/models/impact_assessment/post_checks/test_remove_no_value.py +0 -17
- tests/models/impact_assessment/post_checks/test_site.py +0 -28
- tests/models/impact_assessment/pre_checks/__init__.py +0 -0
- tests/models/impact_assessment/pre_checks/test_cycle.py +0 -39
- tests/models/impact_assessment/pre_checks/test_site.py +0 -37
- tests/models/impact_assessment/product/__init__.py +0 -0
- tests/models/impact_assessment/product/test_economicValueShare.py +0 -36
- tests/models/impact_assessment/product/test_value.py +0 -36
- tests/models/impact_assessment/test_allocationMethod.py +0 -48
- tests/models/impact_assessment/test_emissions.py +0 -31
- tests/models/impact_assessment/test_irrigated.py +0 -14
- tests/models/impact_assessment/test_oganic.py +0 -14
- tests/models/impact_assessment/test_post_checks.py +0 -11
- tests/models/impact_assessment/test_pre_checks.py +0 -11
- tests/models/ipcc2006/__init__.py +0 -0
- tests/models/ipcc2006/test_aboveGroundCropResidueRemoved.py +0 -36
- tests/models/ipcc2006/test_aboveGroundCropResidueTotal.py +0 -48
- tests/models/ipcc2006/test_belowGroundCropResidue.py +0 -45
- tests/models/ipcc2006/test_n2OToAirCropResidueDecompositionDirect.py +0 -53
- tests/models/ipcc2006/test_n2OToAirCropResidueDecompositionIndirect.py +0 -45
- tests/models/ipcc2006/test_n2OToAirExcretaDirect.py +0 -68
- tests/models/ipcc2006/test_n2OToAirExcretaIndirect.py +0 -45
- tests/models/ipcc2006/test_n2OToAirInorganicFertiliserDirect.py +0 -55
- tests/models/ipcc2006/test_n2OToAirInorganicFertiliserIndirect.py +0 -43
- tests/models/ipcc2006/test_n2OToAirOrganicFertiliserDirect.py +0 -55
- tests/models/ipcc2006/test_n2OToAirOrganicFertiliserIndirect.py +0 -55
- tests/models/ipcc2013ExcludingFeedbacks/__init__.py +0 -0
- tests/models/ipcc2013ExcludingFeedbacks/test_gwp100.py +0 -23
- tests/models/ipcc2013IncludingFeedbacks/__init__.py +0 -0
- tests/models/ipcc2013IncludingFeedbacks/test_gwp100.py +0 -23
- tests/models/ipcc2019/__init__.py +0 -0
- tests/models/ipcc2019/animal/__init__.py +0 -0
- tests/models/ipcc2019/animal/test_fatContent.py +0 -22
- tests/models/ipcc2019/animal/test_hoursWorkedPerDay.py +0 -22
- tests/models/ipcc2019/animal/test_liveweightGain.py +0 -22
- tests/models/ipcc2019/animal/test_liveweightPerHead.py +0 -22
- tests/models/ipcc2019/animal/test_milkYieldPerAnimal.py +0 -21
- tests/models/ipcc2019/animal/test_pastureGrass.py +0 -47
- tests/models/ipcc2019/animal/test_pregnancyRateTotal.py +0 -22
- tests/models/ipcc2019/animal/test_trueProteinContent.py +0 -22
- tests/models/ipcc2019/animal/test_weightAtMaturity.py +0 -21
- tests/models/ipcc2019/test_aboveGroundBiomass.py +0 -189
- tests/models/ipcc2019/test_aboveGroundCropResidueTotal.py +0 -51
- tests/models/ipcc2019/test_belowGroundBiomass.py +0 -189
- tests/models/ipcc2019/test_belowGroundCropResidue.py +0 -77
- tests/models/ipcc2019/test_biocharOrganicCarbonPerHa.py +0 -132
- tests/models/ipcc2019/test_biomass_utils.py +0 -115
- tests/models/ipcc2019/test_carbonContent.py +0 -119
- tests/models/ipcc2019/test_ch4ToAirAquacultureSystems.py +0 -60
- tests/models/ipcc2019/test_ch4ToAirEntericFermentation.py +0 -199
- tests/models/ipcc2019/test_ch4ToAirExcreta.py +0 -83
- tests/models/ipcc2019/test_ch4ToAirFloodedRice.py +0 -25
- tests/models/ipcc2019/test_ch4ToAirOrganicSoilCultivation.py +0 -62
- tests/models/ipcc2019/test_co2ToAirAboveGroundBiomassStockChange.py +0 -120
- tests/models/ipcc2019/test_co2ToAirBelowGroundBiomassStockChange.py +0 -118
- tests/models/ipcc2019/test_co2ToAirBiocharStockChange.py +0 -90
- tests/models/ipcc2019/test_co2ToAirCarbonStockChange_utils.py +0 -50
- tests/models/ipcc2019/test_co2ToAirLimeHydrolysis.py +0 -49
- tests/models/ipcc2019/test_co2ToAirOrganicSoilCultivation.py +0 -63
- tests/models/ipcc2019/test_co2ToAirSoilOrganicCarbonStockChange.py +0 -151
- tests/models/ipcc2019/test_co2ToAirUreaHydrolysis.py +0 -30
- tests/models/ipcc2019/test_croppingDuration.py +0 -55
- tests/models/ipcc2019/test_ligninContent.py +0 -119
- tests/models/ipcc2019/test_n2OToAirAquacultureSystemsIndirect.py +0 -45
- tests/models/ipcc2019/test_n2OToAirCropResidueBurningDirect.py +0 -46
- tests/models/ipcc2019/test_n2OToAirCropResidueBurningIndirect.py +0 -45
- tests/models/ipcc2019/test_n2OToAirCropResidueDecompositionDirect.py +0 -79
- tests/models/ipcc2019/test_n2OToAirCropResidueDecompositionIndirect.py +0 -45
- tests/models/ipcc2019/test_n2OToAirExcretaDirect.py +0 -50
- tests/models/ipcc2019/test_n2OToAirExcretaIndirect.py +0 -45
- tests/models/ipcc2019/test_n2OToAirFuelCombustionIndirect.py +0 -45
- tests/models/ipcc2019/test_n2OToAirInorganicFertiliserDirect.py +0 -79
- tests/models/ipcc2019/test_n2OToAirInorganicFertiliserIndirect.py +0 -45
- tests/models/ipcc2019/test_n2OToAirNaturalVegetationBurningIndirect.py +0 -45
- tests/models/ipcc2019/test_n2OToAirOrganicFertiliserDirect.py +0 -79
- tests/models/ipcc2019/test_n2OToAirOrganicFertiliserIndirect.py +0 -45
- tests/models/ipcc2019/test_n2OToAirOrganicSoilBurningIndirect.py +0 -45
- tests/models/ipcc2019/test_n2OToAirOrganicSoilCultivationDirect.py +0 -62
- tests/models/ipcc2019/test_n2OToAirOrganicSoilCultivationIndirect.py +0 -45
- tests/models/ipcc2019/test_n2OToAir_indirect_emissions_utils.py +0 -19
- tests/models/ipcc2019/test_nh3ToAirInorganicFertiliser.py +0 -47
- tests/models/ipcc2019/test_nh3ToAirOrganicFertiliser.py +0 -35
- tests/models/ipcc2019/test_nitrogenContent.py +0 -107
- tests/models/ipcc2019/test_no3ToGroundwaterCropResidueDecomposition.py +0 -51
- tests/models/ipcc2019/test_no3ToGroundwaterExcreta.py +0 -64
- tests/models/ipcc2019/test_no3ToGroundwaterInorganicFertiliser.py +0 -48
- tests/models/ipcc2019/test_no3ToGroundwaterOrganicFertiliser.py +0 -48
- tests/models/ipcc2019/test_nonCo2EmissionsToAirNaturalVegetationBurning.py +0 -97
- tests/models/ipcc2019/test_noxToAirInorganicFertiliser.py +0 -47
- tests/models/ipcc2019/test_noxToAirOrganicFertiliser.py +0 -35
- tests/models/ipcc2019/test_organicCarbonPerHa.py +0 -415
- tests/models/ipcc2019/test_organicCarbonPerHa_tier_1.py +0 -465
- tests/models/ipcc2019/test_organicCarbonPerHa_tier_2.py +0 -148
- tests/models/ipcc2019/test_organicCarbonPerHa_utils.py +0 -31
- tests/models/ipcc2019/test_pastureGrass.py +0 -68
- tests/models/ipcc2021/__init__.py +0 -0
- tests/models/ipcc2021/test_gwp100.py +0 -23
- tests/models/jarvisAndPain1994/__init__.py +0 -0
- tests/models/jarvisAndPain1994/test_n2ToAirExcreta.py +0 -37
- tests/models/koble2014/__init__.py +0 -0
- tests/models/koble2014/test_cropResidueManagement.py +0 -19
- tests/models/koble2014/test_residueBurnt.py +0 -20
- tests/models/koble2014/test_residueLeftOnField.py +0 -21
- tests/models/koble2014/test_residueRemoved.py +0 -20
- tests/models/koble2014/test_utils.py +0 -52
- tests/models/lcImpactAllEffects100Years/__init__.py +0 -0
- tests/models/lcImpactAllEffects100Years/test_damageToFreshwaterEcosystemsClimateChange.py +0 -23
- tests/models/lcImpactAllEffects100Years/test_damageToFreshwaterEcosystemsFreshwaterEcotoxicity.py +0 -25
- tests/models/lcImpactAllEffects100Years/test_damageToFreshwaterEcosystemsFreshwaterEutrophication.py +0 -25
- tests/models/lcImpactAllEffects100Years/test_damageToFreshwaterEcosystemsPdfYear.py +0 -20
- tests/models/lcImpactAllEffects100Years/test_damageToFreshwaterEcosystemsWaterStress.py +0 -21
- tests/models/lcImpactAllEffects100Years/test_damageToHumanHealth.py +0 -20
- tests/models/lcImpactAllEffects100Years/test_damageToHumanHealthClimateChange.py +0 -23
- tests/models/lcImpactAllEffects100Years/test_damageToHumanHealthHumanToxicityCancerogenic.py +0 -25
- tests/models/lcImpactAllEffects100Years/test_damageToHumanHealthHumanToxicityNonCancerogenic.py +0 -25
- tests/models/lcImpactAllEffects100Years/test_damageToHumanHealthParticulateMatterFormation.py +0 -25
- tests/models/lcImpactAllEffects100Years/test_damageToHumanHealthPhotochemicalOzoneFormation.py +0 -25
- tests/models/lcImpactAllEffects100Years/test_damageToHumanHealthStratosphericOzoneDepletion.py +0 -25
- tests/models/lcImpactAllEffects100Years/test_damageToHumanHealthWaterStress.py +0 -32
- tests/models/lcImpactAllEffects100Years/test_damageToMarineEcosystemsMarineEcotoxicity.py +0 -25
- tests/models/lcImpactAllEffects100Years/test_damageToMarineEcosystemsMarineEutrophication.py +0 -25
- tests/models/lcImpactAllEffects100Years/test_damageToMarineEcosystemsPdfYear.py +0 -20
- tests/models/lcImpactAllEffects100Years/test_damageToTerrestrialEcosystemsClimateChange.py +0 -25
- tests/models/lcImpactAllEffects100Years/test_damageToTerrestrialEcosystemsPdfYear.py +0 -20
- tests/models/lcImpactAllEffects100Years/test_damageToTerrestrialEcosystemsPhotochemicalOzoneFormation.py +0 -25
- tests/models/lcImpactAllEffects100Years/test_damageToTerrestrialEcosystemsTerrestrialAcidification.py +0 -25
- tests/models/lcImpactAllEffects100Years/test_damageToTerrestrialEcosystemsTerrestrialEcotoxicity.py +0 -25
- tests/models/lcImpactAllEffectsInfinite/__init__.py +0 -0
- tests/models/lcImpactAllEffectsInfinite/test_damageToFreshwaterEcosystemsClimateChange.py +0 -23
- tests/models/lcImpactAllEffectsInfinite/test_damageToFreshwaterEcosystemsFreshwaterEcotoxicity.py +0 -25
- tests/models/lcImpactAllEffectsInfinite/test_damageToFreshwaterEcosystemsFreshwaterEutrophication.py +0 -25
- tests/models/lcImpactAllEffectsInfinite/test_damageToFreshwaterEcosystemsPdfYear.py +0 -20
- tests/models/lcImpactAllEffectsInfinite/test_damageToFreshwaterEcosystemsWaterStress.py +0 -21
- tests/models/lcImpactAllEffectsInfinite/test_damageToHumanHealth.py +0 -20
- tests/models/lcImpactAllEffectsInfinite/test_damageToHumanHealthClimateChange.py +0 -23
- tests/models/lcImpactAllEffectsInfinite/test_damageToHumanHealthHumanToxicityCancerogenic.py +0 -25
- tests/models/lcImpactAllEffectsInfinite/test_damageToHumanHealthHumanToxicityNonCancerogenic.py +0 -25
- tests/models/lcImpactAllEffectsInfinite/test_damageToHumanHealthParticulateMatterFormation.py +0 -25
- tests/models/lcImpactAllEffectsInfinite/test_damageToHumanHealthPhotochemicalOzoneFormation.py +0 -25
- tests/models/lcImpactAllEffectsInfinite/test_damageToHumanHealthStratosphericOzoneDepletion.py +0 -25
- tests/models/lcImpactAllEffectsInfinite/test_damageToHumanHealthWaterStress.py +0 -32
- tests/models/lcImpactAllEffectsInfinite/test_damageToMarineEcosystemsMarineEcotoxicity.py +0 -25
- tests/models/lcImpactAllEffectsInfinite/test_damageToMarineEcosystemsMarineEutrophication.py +0 -25
- tests/models/lcImpactAllEffectsInfinite/test_damageToMarineEcosystemsPdfYear.py +0 -20
- tests/models/lcImpactAllEffectsInfinite/test_damageToTerrestrialEcosystemsClimateChange.py +0 -25
- tests/models/lcImpactAllEffectsInfinite/test_damageToTerrestrialEcosystemsPdfYear.py +0 -20
- tests/models/lcImpactAllEffectsInfinite/test_damageToTerrestrialEcosystemsPhotochemicalOzoneFormation.py +0 -25
- tests/models/lcImpactAllEffectsInfinite/test_damageToTerrestrialEcosystemsTerrestrialAcidification.py +0 -25
- tests/models/lcImpactAllEffectsInfinite/test_damageToTerrestrialEcosystemsTerrestrialEcotoxicity.py +0 -25
- tests/models/lcImpactCertainEffects100Years/__init__.py +0 -0
- tests/models/lcImpactCertainEffects100Years/test_damageToFreshwaterEcosystemsFreshwaterEcotoxicity.py +0 -25
- tests/models/lcImpactCertainEffects100Years/test_damageToFreshwaterEcosystemsFreshwaterEutrophication.py +0 -25
- tests/models/lcImpactCertainEffects100Years/test_damageToFreshwaterEcosystemsPdfYear.py +0 -20
- tests/models/lcImpactCertainEffects100Years/test_damageToFreshwaterEcosystemsWaterStress.py +0 -21
- tests/models/lcImpactCertainEffects100Years/test_damageToHumanHealth.py +0 -20
- tests/models/lcImpactCertainEffects100Years/test_damageToHumanHealthClimateChange.py +0 -23
- tests/models/lcImpactCertainEffects100Years/test_damageToHumanHealthHumanToxicityCancerogenic.py +0 -25
- tests/models/lcImpactCertainEffects100Years/test_damageToHumanHealthHumanToxicityNonCancerogenic.py +0 -25
- tests/models/lcImpactCertainEffects100Years/test_damageToHumanHealthParticulateMatterFormation.py +0 -25
- tests/models/lcImpactCertainEffects100Years/test_damageToHumanHealthPhotochemicalOzoneFormation.py +0 -25
- tests/models/lcImpactCertainEffects100Years/test_damageToHumanHealthStratosphericOzoneDepletion.py +0 -25
- tests/models/lcImpactCertainEffects100Years/test_damageToHumanHealthWaterStress.py +0 -32
- tests/models/lcImpactCertainEffects100Years/test_damageToMarineEcosystemsMarineEcotoxicity.py +0 -25
- tests/models/lcImpactCertainEffects100Years/test_damageToMarineEcosystemsMarineEutrophication.py +0 -25
- tests/models/lcImpactCertainEffects100Years/test_damageToMarineEcosystemsPdfYear.py +0 -20
- tests/models/lcImpactCertainEffects100Years/test_damageToTerrestrialEcosystemsClimateChange.py +0 -25
- tests/models/lcImpactCertainEffects100Years/test_damageToTerrestrialEcosystemsPdfYear.py +0 -20
- tests/models/lcImpactCertainEffects100Years/test_damageToTerrestrialEcosystemsPhotochemicalOzoneFormation.py +0 -25
- tests/models/lcImpactCertainEffects100Years/test_damageToTerrestrialEcosystemsTerrestrialAcidification.py +0 -25
- tests/models/lcImpactCertainEffects100Years/test_damageToTerrestrialEcosystemsTerrestrialEcotoxicity.py +0 -25
- tests/models/lcImpactCertainEffectsInfinite/__init__.py +0 -0
- tests/models/lcImpactCertainEffectsInfinite/test_damageToFreshwaterEcosystemsFreshwaterEcotoxicity.py +0 -25
- tests/models/lcImpactCertainEffectsInfinite/test_damageToFreshwaterEcosystemsFreshwaterEutrophication.py +0 -25
- tests/models/lcImpactCertainEffectsInfinite/test_damageToFreshwaterEcosystemsPdfYear.py +0 -20
- tests/models/lcImpactCertainEffectsInfinite/test_damageToFreshwaterEcosystemsWaterStress.py +0 -21
- tests/models/lcImpactCertainEffectsInfinite/test_damageToHumanHealth.py +0 -20
- tests/models/lcImpactCertainEffectsInfinite/test_damageToHumanHealthClimateChange.py +0 -23
- tests/models/lcImpactCertainEffectsInfinite/test_damageToHumanHealthHumanToxicityCancerogenic.py +0 -25
- tests/models/lcImpactCertainEffectsInfinite/test_damageToHumanHealthHumanToxicityNonCancerogenic.py +0 -25
- tests/models/lcImpactCertainEffectsInfinite/test_damageToHumanHealthParticulateMatterFormation.py +0 -25
- tests/models/lcImpactCertainEffectsInfinite/test_damageToHumanHealthPhotochemicalOzoneFormation.py +0 -25
- tests/models/lcImpactCertainEffectsInfinite/test_damageToHumanHealthStratosphericOzoneDepletion.py +0 -25
- tests/models/lcImpactCertainEffectsInfinite/test_damageToHumanHealthWaterStress.py +0 -32
- tests/models/lcImpactCertainEffectsInfinite/test_damageToMarineEcosystemsMarineEcotoxicity.py +0 -25
- tests/models/lcImpactCertainEffectsInfinite/test_damageToMarineEcosystemsMarineEutrophication.py +0 -25
- tests/models/lcImpactCertainEffectsInfinite/test_damageToMarineEcosystemsPdfYear.py +0 -20
- tests/models/lcImpactCertainEffectsInfinite/test_damageToTerrestrialEcosystemsClimateChange.py +0 -25
- tests/models/lcImpactCertainEffectsInfinite/test_damageToTerrestrialEcosystemsPdfYear.py +0 -20
- tests/models/lcImpactCertainEffectsInfinite/test_damageToTerrestrialEcosystemsPhotochemicalOzoneFormation.py +0 -25
- tests/models/lcImpactCertainEffectsInfinite/test_damageToTerrestrialEcosystemsTerrestrialAcidification.py +0 -25
- tests/models/lcImpactCertainEffectsInfinite/test_damageToTerrestrialEcosystemsTerrestrialEcotoxicity.py +0 -25
- tests/models/linkedImpactAssessment/__init__.py +0 -0
- tests/models/linkedImpactAssessment/test_emissions.py +0 -22
- tests/models/linkedImpactAssessment/test_freshwaterWithdrawalsInputsProduction.py +0 -23
- tests/models/linkedImpactAssessment/test_landOccupationInputsProduction.py +0 -23
- tests/models/linkedImpactAssessment/test_landTransformation100YearAverageInputsProduction.py +0 -25
- tests/models/linkedImpactAssessment/test_landTransformation20YearAverageInputsProduction.py +0 -25
- tests/models/pooreNemecek2018/__init__.py +0 -0
- tests/models/pooreNemecek2018/test_aboveGroundCropResidueTotal.py +0 -45
- tests/models/pooreNemecek2018/test_belowGroundCropResidue.py +0 -45
- tests/models/pooreNemecek2018/test_ch4ToAirAquacultureSystems.py +0 -79
- tests/models/pooreNemecek2018/test_excretaKgN.py +0 -124
- tests/models/pooreNemecek2018/test_excretaKgVs.py +0 -107
- tests/models/pooreNemecek2018/test_freshwaterWithdrawalsDuringCycle.py +0 -60
- tests/models/pooreNemecek2018/test_landOccupationDuringCycle.py +0 -51
- tests/models/pooreNemecek2018/test_longFallowDuration.py +0 -29
- tests/models/pooreNemecek2018/test_n2OToAirAquacultureSystemsDirect.py +0 -59
- tests/models/pooreNemecek2018/test_n2ToAirAquacultureSystems.py +0 -59
- tests/models/pooreNemecek2018/test_nh3ToAirAquacultureSystems.py +0 -80
- tests/models/pooreNemecek2018/test_no3ToGroundwaterCropResidueDecomposition.py +0 -23
- tests/models/pooreNemecek2018/test_no3ToGroundwaterExcreta.py +0 -23
- tests/models/pooreNemecek2018/test_no3ToGroundwaterInorganicFertiliser.py +0 -23
- tests/models/pooreNemecek2018/test_no3ToGroundwaterOrganicFertiliser.py +0 -23
- tests/models/pooreNemecek2018/test_noxToAirAquacultureSystems.py +0 -59
- tests/models/pooreNemecek2018/test_nurseryDensity.py +0 -29
- tests/models/pooreNemecek2018/test_nurseryDuration.py +0 -29
- tests/models/pooreNemecek2018/test_plantationDensity.py +0 -29
- tests/models/pooreNemecek2018/test_plantationLifespan.py +0 -29
- tests/models/pooreNemecek2018/test_plantationProductiveLifespan.py +0 -29
- tests/models/pooreNemecek2018/test_rotationDuration.py +0 -29
- tests/models/pooreNemecek2018/test_saplingsDepreciatedAmountPerCycle.py +0 -46
- tests/models/pooreNemecek2018/test_utils.py +0 -26
- tests/models/poschEtAl2008/__init__.py +0 -0
- tests/models/poschEtAl2008/test_terrestrialAcidificationPotentialAccumulatedExceedance.py +0 -39
- tests/models/poschEtAl2008/test_terrestrialEutrophicationPotentialAccumulatedExceedance.py +0 -39
- tests/models/recipe2016Egalitarian/__init__.py +0 -0
- tests/models/recipe2016Egalitarian/test_damageToFreshwaterEcosystemsSpeciesYear.py +0 -20
- tests/models/recipe2016Egalitarian/test_damageToHumanHealth.py +0 -20
- tests/models/recipe2016Egalitarian/test_damageToMarineEcosystemsSpeciesYear.py +0 -20
- tests/models/recipe2016Egalitarian/test_damageToResourceAvailability.py +0 -23
- tests/models/recipe2016Egalitarian/test_damageToTerrestrialEcosystemsSpeciesYear.py +0 -20
- tests/models/recipe2016Egalitarian/test_ecosystemDamageOzoneFormation.py +0 -26
- tests/models/recipe2016Egalitarian/test_fossilResourceScarcity.py +0 -23
- tests/models/recipe2016Egalitarian/test_freshwaterAquaticEcotoxicityPotential14Dcbeq.py +0 -23
- tests/models/recipe2016Egalitarian/test_freshwaterEutrophicationPotential.py +0 -23
- tests/models/recipe2016Egalitarian/test_humanCarcinogenicToxicity.py +0 -23
- tests/models/recipe2016Egalitarian/test_humanDamageOzoneFormation.py +0 -26
- tests/models/recipe2016Egalitarian/test_humanNonCarcinogenicToxicity.py +0 -23
- tests/models/recipe2016Egalitarian/test_marineAquaticEcotoxicityPotential14Dcbeq.py +0 -23
- tests/models/recipe2016Egalitarian/test_marineEutrophicationPotential.py +0 -23
- tests/models/recipe2016Egalitarian/test_ozoneDepletionPotential.py +0 -26
- tests/models/recipe2016Egalitarian/test_terrestrialAcidificationPotential.py +0 -23
- tests/models/recipe2016Egalitarian/test_terrestrialEcotoxicityPotential14Dcbeq.py +0 -23
- tests/models/recipe2016Hierarchist/__init__.py +0 -0
- tests/models/recipe2016Hierarchist/test_damageToFreshwaterEcosystemsSpeciesYear.py +0 -20
- tests/models/recipe2016Hierarchist/test_damageToHumanHealth.py +0 -20
- tests/models/recipe2016Hierarchist/test_damageToMarineEcosystemsSpeciesYear.py +0 -20
- tests/models/recipe2016Hierarchist/test_damageToResourceAvailability.py +0 -23
- tests/models/recipe2016Hierarchist/test_damageToTerrestrialEcosystemsSpeciesYear.py +0 -20
- tests/models/recipe2016Hierarchist/test_ecosystemDamageOzoneFormation.py +0 -26
- tests/models/recipe2016Hierarchist/test_fossilResourceScarcity.py +0 -23
- tests/models/recipe2016Hierarchist/test_freshwaterAquaticEcotoxicityPotential14Dcbeq.py +0 -23
- tests/models/recipe2016Hierarchist/test_freshwaterEutrophicationPotential.py +0 -23
- tests/models/recipe2016Hierarchist/test_humanCarcinogenicToxicity.py +0 -23
- tests/models/recipe2016Hierarchist/test_humanDamageOzoneFormation.py +0 -26
- tests/models/recipe2016Hierarchist/test_humanNonCarcinogenicToxicity.py +0 -23
- tests/models/recipe2016Hierarchist/test_marineAquaticEcotoxicityPotential14Dcbeq.py +0 -23
- tests/models/recipe2016Hierarchist/test_marineEutrophicationPotential.py +0 -23
- tests/models/recipe2016Hierarchist/test_ozoneDepletionPotential.py +0 -26
- tests/models/recipe2016Hierarchist/test_terrestrialAcidificationPotential.py +0 -23
- tests/models/recipe2016Hierarchist/test_terrestrialEcotoxicityPotential14Dcbeq.py +0 -23
- tests/models/recipe2016Individualist/__init__.py +0 -0
- tests/models/recipe2016Individualist/test_damageToFreshwaterEcosystemsSpeciesYear.py +0 -20
- tests/models/recipe2016Individualist/test_damageToHumanHealth.py +0 -20
- tests/models/recipe2016Individualist/test_damageToMarineEcosystemsSpeciesYear.py +0 -20
- tests/models/recipe2016Individualist/test_damageToResourceAvailability.py +0 -23
- tests/models/recipe2016Individualist/test_damageToTerrestrialEcosystemsSpeciesYear.py +0 -20
- tests/models/recipe2016Individualist/test_ecosystemDamageOzoneFormation.py +0 -26
- tests/models/recipe2016Individualist/test_fossilResourceScarcity.py +0 -23
- tests/models/recipe2016Individualist/test_freshwaterAquaticEcotoxicityPotential14Dcbeq.py +0 -23
- tests/models/recipe2016Individualist/test_freshwaterEutrophicationPotential.py +0 -23
- tests/models/recipe2016Individualist/test_humanCarcinogenicToxicity.py +0 -23
- tests/models/recipe2016Individualist/test_humanDamageOzoneFormation.py +0 -26
- tests/models/recipe2016Individualist/test_humanNonCarcinogenicToxicity.py +0 -23
- tests/models/recipe2016Individualist/test_marineAquaticEcotoxicityPotential14Dcbeq.py +0 -23
- tests/models/recipe2016Individualist/test_marineEutrophicationPotential.py +0 -23
- tests/models/recipe2016Individualist/test_ozoneDepletionPotential.py +0 -26
- tests/models/recipe2016Individualist/test_terrestrialAcidificationPotential.py +0 -23
- tests/models/recipe2016Individualist/test_terrestrialEcotoxicityPotential14Dcbeq.py +0 -23
- tests/models/schererPfister2015/__init__.py +0 -0
- tests/models/schererPfister2015/test_nErosionSoilFlux.py +0 -70
- tests/models/schererPfister2015/test_pErosionSoilFlux.py +0 -70
- tests/models/schererPfister2015/test_pToDrainageWaterSoilFlux.py +0 -33
- tests/models/schererPfister2015/test_pToGroundwaterSoilFlux.py +0 -33
- tests/models/schererPfister2015/test_pToSurfaceWaterSoilFlux.py +0 -45
- tests/models/schmidt2007/__init__.py +0 -0
- tests/models/schmidt2007/test_ch4ToAirWasteTreatment.py +0 -45
- tests/models/schmidt2007/test_h2SToAirWasteTreatment.py +0 -45
- tests/models/schmidt2007/test_n2OToAirWasteTreatmentDirect.py +0 -45
- tests/models/schmidt2007/test_nh3ToAirWasteTreatment.py +0 -45
- tests/models/schmidt2007/test_utils.py +0 -39
- tests/models/site/__init__.py +0 -0
- tests/models/site/measurement/__init__.py +0 -0
- tests/models/site/measurement/test_value.py +0 -41
- tests/models/site/post_checks/__init__.py +0 -0
- tests/models/site/post_checks/test_cache.py +0 -8
- tests/models/site/post_checks/test_country.py +0 -6
- tests/models/site/pre_checks/__init__.py +0 -0
- tests/models/site/pre_checks/test_cache_geospatialDatabase.py +0 -22
- tests/models/site/pre_checks/test_cache_years.py +0 -25
- tests/models/site/pre_checks/test_country.py +0 -13
- tests/models/site/test_defaultMethodClassification.py +0 -24
- tests/models/site/test_defaultMethodClassificationDescription.py +0 -24
- tests/models/site/test_grouped_measurement.py +0 -20
- tests/models/stehfestBouwman2006/__init__.py +0 -0
- tests/models/stehfestBouwman2006/test_n2OToAirCropResidueDecompositionDirect.py +0 -20
- tests/models/stehfestBouwman2006/test_n2OToAirExcretaDirect.py +0 -20
- tests/models/stehfestBouwman2006/test_n2OToAirInorganicFertiliserDirect.py +0 -20
- tests/models/stehfestBouwman2006/test_n2OToAirOrganicFertiliserDirect.py +0 -20
- tests/models/stehfestBouwman2006/test_noxToAirCropResidueDecomposition.py +0 -20
- tests/models/stehfestBouwman2006/test_noxToAirExcreta.py +0 -20
- tests/models/stehfestBouwman2006/test_noxToAirInorganicFertiliser.py +0 -20
- tests/models/stehfestBouwman2006/test_noxToAirOrganicFertiliser.py +0 -20
- tests/models/stehfestBouwman2006GisImplementation/__init__.py +0 -0
- tests/models/stehfestBouwman2006GisImplementation/test_noxToAirCropResidueDecomposition.py +0 -22
- tests/models/stehfestBouwman2006GisImplementation/test_noxToAirExcreta.py +0 -20
- tests/models/stehfestBouwman2006GisImplementation/test_noxToAirInorganicFertiliser.py +0 -20
- tests/models/stehfestBouwman2006GisImplementation/test_noxToAirOrganicFertiliser.py +0 -20
- tests/models/test_cache_nodes.py +0 -31
- tests/models/test_cache_sites.py +0 -93
- tests/models/test_config.py +0 -170
- tests/models/test_emissionNotRelevant.py +0 -32
- tests/models/test_log.py +0 -128
- tests/models/test_resourceUseNotRelevant.py +0 -27
- tests/models/test_utils.py +0 -6
- tests/models/transformation/__init__.py +0 -0
- tests/models/transformation/input/__init__.py +0 -0
- tests/models/transformation/input/test_excreta.py +0 -49
- tests/models/transformation/input/test_max.py +0 -34
- tests/models/transformation/input/test_min.py +0 -34
- tests/models/transformation/input/test_properties.py +0 -34
- tests/models/transformation/input/test_sd.py +0 -34
- tests/models/transformation/input/test_value.py +0 -34
- tests/models/transformation/product/__init__.py +0 -0
- tests/models/transformation/product/test_excreta.py +0 -54
- tests/models/usetoxV2/__init__.py +0 -0
- tests/models/usetoxV2/test_freshwaterEcotoxicityPotentialCtue.py +0 -23
- tests/models/utils/__init__.py +0 -0
- tests/models/utils/test_array_builders.py +0 -314
- tests/models/utils/test_background_emissions.py +0 -13
- tests/models/utils/test_blank_node.py +0 -1081
- tests/models/utils/test_cache_sources.py +0 -21
- tests/models/utils/test_crop.py +0 -27
- tests/models/utils/test_cropResidue.py +0 -26
- tests/models/utils/test_cropResidueManagement.py +0 -24
- tests/models/utils/test_currency.py +0 -13
- tests/models/utils/test_dataCompleteness.py +0 -52
- tests/models/utils/test_ecoClimateZone.py +0 -152
- tests/models/utils/test_emission.py +0 -74
- tests/models/utils/test_feedipedia.py +0 -26
- tests/models/utils/test_impact_assessment.py +0 -48
- tests/models/utils/test_indicator.py +0 -26
- tests/models/utils/test_input.py +0 -88
- tests/models/utils/test_liveAnimal.py +0 -34
- tests/models/utils/test_measurement.py +0 -116
- tests/models/utils/test_practice.py +0 -24
- tests/models/utils/test_product.py +0 -73
- tests/models/utils/test_property.py +0 -24
- tests/models/utils/test_site.py +0 -70
- tests/models/utils/test_source.py +0 -42
- tests/models/utils/test_term.py +0 -115
- tests/models/utils/test_time_series.py +0 -88
- tests/models/webbEtAl2012AndSintermannEtAl2012/__init__.py +0 -0
- tests/models/webbEtAl2012AndSintermannEtAl2012/test_nh3ToAirOrganicFertiliser.py +0 -79
- tests/orchestrator/__init__.py +0 -0
- tests/orchestrator/models/__init__.py +0 -0
- tests/orchestrator/models/emissions/__init__.py +0 -0
- tests/orchestrator/models/emissions/test_deleted.py +0 -21
- tests/orchestrator/models/test_transformations.py +0 -32
- tests/orchestrator/strategies/__init__.py +0 -0
- tests/orchestrator/strategies/merge/__init__.py +0 -0
- tests/orchestrator/strategies/merge/test_merge_append.py +0 -33
- tests/orchestrator/strategies/merge/test_merge_default.py +0 -7
- tests/orchestrator/strategies/merge/test_merge_list.py +0 -342
- tests/orchestrator/strategies/merge/test_merge_node.py +0 -95
- tests/orchestrator/strategies/run/__init__.py +0 -0
- tests/orchestrator/strategies/run/test_add_blank_node_if_missing.py +0 -109
- tests/orchestrator/strategies/run/test_add_key_if_missing.py +0 -14
- tests/orchestrator/strategies/run/test_always.py +0 -5
- tests/orchestrator/test_models.py +0 -70
- tests/orchestrator/test_orchestrator.py +0 -27
- tests/orchestrator/test_utils.py +0 -109
- {hestia_earth_models-0.74.17.dist-info → hestia_earth_models-0.75.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,1081 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import json
|
|
3
|
-
from datetime import datetime
|
|
4
|
-
import pytest
|
|
5
|
-
from pytest import mark
|
|
6
|
-
from unittest.mock import patch
|
|
7
|
-
from tests.utils import fixtures_path
|
|
8
|
-
|
|
9
|
-
from hestia_earth.schema import SiteSiteType
|
|
10
|
-
from hestia_earth.utils.tools import parse
|
|
11
|
-
from hestia_earth.models.utils.blank_node import (
|
|
12
|
-
condense_nodes,
|
|
13
|
-
_calc_datetime_range_intersection_duration,
|
|
14
|
-
_gapfill_datestr,
|
|
15
|
-
_get_datestr_format,
|
|
16
|
-
_run_required,
|
|
17
|
-
_run_model_required,
|
|
18
|
-
cumulative_nodes_match,
|
|
19
|
-
DatestrFormat,
|
|
20
|
-
DatestrGapfillMode,
|
|
21
|
-
DatetimeRange,
|
|
22
|
-
group_nodes_by_year,
|
|
23
|
-
group_nodes_by_year_and_month,
|
|
24
|
-
GroupNodesByYearMode,
|
|
25
|
-
split_node_by_dates,
|
|
26
|
-
_most_recent_nodes,
|
|
27
|
-
_shallowest_node,
|
|
28
|
-
validate_start_date_end_date, _str_dates_match
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
class_path = "hestia_earth.models.utils.blank_node"
|
|
33
|
-
fixtures_folder = os.path.join(fixtures_path, 'utils', 'blank_node')
|
|
34
|
-
measurement_fixtures_folder = os.path.join(fixtures_path, 'utils', 'measurement')
|
|
35
|
-
|
|
36
|
-
condense_fixtures_folder = os.path.join(fixtures_folder, 'condense-nodes')
|
|
37
|
-
condense_folders = [
|
|
38
|
-
d for d in os.listdir(condense_fixtures_folder) if os.path.isdir(os.path.join(condense_fixtures_folder, d))
|
|
39
|
-
]
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
@pytest.mark.parametrize('folder', condense_folders)
|
|
43
|
-
def test_condense_nodes(folder: str):
|
|
44
|
-
fixture_path = os.path.join(condense_fixtures_folder, folder)
|
|
45
|
-
|
|
46
|
-
with open(f"{fixture_path}/original.jsonld", encoding='utf-8') as f:
|
|
47
|
-
original = json.load(f)
|
|
48
|
-
with open(f"{fixture_path}/result.jsonld", encoding='utf-8') as f:
|
|
49
|
-
expected = json.load(f)
|
|
50
|
-
|
|
51
|
-
value = condense_nodes(original)
|
|
52
|
-
assert value == expected, folder
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
def test_run_required():
|
|
56
|
-
assert not _run_required('model', 'ch4ToAirAquacultureSystems', {
|
|
57
|
-
'site': {'siteType': SiteSiteType.CROPLAND.value}
|
|
58
|
-
})
|
|
59
|
-
assert _run_required('model', 'ch4ToAirAquacultureSystems', {
|
|
60
|
-
'site': {'siteType': SiteSiteType.POND.value}
|
|
61
|
-
}) is True
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
def test_run_model_required():
|
|
65
|
-
assert _run_model_required('pooreNemecek2018', 'netPrimaryProduction', {
|
|
66
|
-
'site': {'siteType': SiteSiteType.POND.value}
|
|
67
|
-
}) is True
|
|
68
|
-
assert not _run_model_required('pooreNemecek2018', 'netPrimaryProduction', {
|
|
69
|
-
'site': {'siteType': SiteSiteType.CROPLAND.value}
|
|
70
|
-
})
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
# --- test cumulative_nodes_match ---
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
CROP_RESIDUE_NODES = [
|
|
77
|
-
{
|
|
78
|
-
"@type": "Product",
|
|
79
|
-
"term": {
|
|
80
|
-
"@type": "Term",
|
|
81
|
-
"@id": "aboveGroundCropResidueBurnt"
|
|
82
|
-
},
|
|
83
|
-
"value": [20, 25, 30]
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
"@type": "Product",
|
|
87
|
-
"term": {
|
|
88
|
-
"@type": "Term",
|
|
89
|
-
"@id": "aboveGroundCropResidueRemoved"
|
|
90
|
-
},
|
|
91
|
-
"value": [10, 15, 20]
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
"@type": "Product",
|
|
95
|
-
"term": {
|
|
96
|
-
"@type": "Term",
|
|
97
|
-
"@id": "aboveGroundCropResidueLeftOnField"
|
|
98
|
-
},
|
|
99
|
-
"value": [50]
|
|
100
|
-
},
|
|
101
|
-
]
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
def test_cumulative_nodes_match_true(*args):
|
|
105
|
-
result = cumulative_nodes_match(
|
|
106
|
-
lambda node: node.get("term", {}).get("@id") in [
|
|
107
|
-
"aboveGroundCropResidueBurnt", "aboveGroundCropResidueRemoved"
|
|
108
|
-
],
|
|
109
|
-
CROP_RESIDUE_NODES,
|
|
110
|
-
cumulative_threshold=35
|
|
111
|
-
)
|
|
112
|
-
assert result is True
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
def test_cumulative_nodes_match_false(*args):
|
|
116
|
-
result = cumulative_nodes_match(
|
|
117
|
-
lambda node: node.get("term", {}).get("@id") in ["aboveGroundCropResidueLeftOnField"],
|
|
118
|
-
CROP_RESIDUE_NODES,
|
|
119
|
-
cumulative_threshold=100
|
|
120
|
-
)
|
|
121
|
-
assert result is False
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
def test_cumulative_nodes_match_additional_args():
|
|
125
|
-
with pytest.raises(TypeError):
|
|
126
|
-
cumulative_nodes_match(
|
|
127
|
-
lambda node: node.get("term", {}).get("@id") in ["aboveGroundCropResidueBurnt"],
|
|
128
|
-
CROP_RESIDUE_NODES,
|
|
129
|
-
{"random": True},
|
|
130
|
-
cumulative_threshold=10
|
|
131
|
-
)
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
# --- test _get_datestr_format ---
|
|
135
|
-
|
|
136
|
-
DATESTR_YEAR = "2000"
|
|
137
|
-
DATESTR_YEAR_MONTH = "2000-01"
|
|
138
|
-
DATESTR_YEAR_MONTH_DAY = "2000-01-01"
|
|
139
|
-
DATESTR_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND = "2000-01-01T00:00:00"
|
|
140
|
-
DATESTR_MONTH = "--01"
|
|
141
|
-
DATESTR_MONTH_DAY = "--01-01"
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
def test_get_date_year():
|
|
145
|
-
"""
|
|
146
|
-
Test datestr format `YYYY`.
|
|
147
|
-
"""
|
|
148
|
-
assert _get_datestr_format(DATESTR_YEAR) == DatestrFormat.YEAR
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
def test_get_date_year_month():
|
|
152
|
-
"""
|
|
153
|
-
Test datestr format `YYYY-MM`.
|
|
154
|
-
"""
|
|
155
|
-
assert _get_datestr_format(DATESTR_YEAR_MONTH) == DatestrFormat.YEAR_MONTH
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
def test_get_date_year_month_day():
|
|
159
|
-
"""
|
|
160
|
-
Test datestr format `YYYY-MM-DD`.
|
|
161
|
-
"""
|
|
162
|
-
assert _get_datestr_format(DATESTR_YEAR_MONTH_DAY) == DatestrFormat.YEAR_MONTH_DAY
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
def test_get_date_year_month_day_hour_minute_second():
|
|
166
|
-
"""
|
|
167
|
-
Test datestr format `YYYY-MM-DDTHH:mm:ss`.
|
|
168
|
-
"""
|
|
169
|
-
assert (
|
|
170
|
-
_get_datestr_format(DATESTR_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) ==
|
|
171
|
-
DatestrFormat.YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
|
|
172
|
-
)
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
def test_get_date_month():
|
|
176
|
-
"""
|
|
177
|
-
Test datestr format `--MM`.
|
|
178
|
-
|
|
179
|
-
Should only be found in blank node `dates` field. (Format not permitted in `startDate` or `endDate` fields.)
|
|
180
|
-
"""
|
|
181
|
-
assert _get_datestr_format(DATESTR_MONTH) == DatestrFormat.MONTH
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
def test_get_date_month_day():
|
|
185
|
-
"""
|
|
186
|
-
Test datestr format `--MM-DD`.
|
|
187
|
-
|
|
188
|
-
Should only be found in blank node `dates` field. (Format not permitted in `startDate` or `endDate` fields.)
|
|
189
|
-
"""
|
|
190
|
-
assert _get_datestr_format(DATESTR_MONTH_DAY) == DatestrFormat.MONTH_DAY
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
def test_get_datestr_format_no_zero_padding():
|
|
194
|
-
DATE_STR = "2000-1"
|
|
195
|
-
assert _get_datestr_format(DATE_STR) is None
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
def test_str_dates_match():
|
|
199
|
-
assert _str_dates_match("2010", "2010-12-31") is True
|
|
200
|
-
assert _str_dates_match("2010", "2010-01-01") is False
|
|
201
|
-
assert _str_dates_match("2010", "2010-12-31") is True
|
|
202
|
-
assert _str_dates_match("2010", "2010-01") is False
|
|
203
|
-
|
|
204
|
-
assert _str_dates_match("2010", "2010-12-31", mode=DatestrGapfillMode.START) is False
|
|
205
|
-
assert _str_dates_match("2010", "2010-01-01", mode=DatestrGapfillMode.START) is True
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
# --- test _gapfill_datestr ---
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
def test_complete_datestr_year():
|
|
212
|
-
assert _gapfill_datestr(DATESTR_YEAR) == "2000-01-01T00:00:00"
|
|
213
|
-
assert _gapfill_datestr(DATESTR_YEAR, DatestrGapfillMode.MIDDLE) == "2000-07-01T23:59:59"
|
|
214
|
-
assert _gapfill_datestr(DATESTR_YEAR, DatestrGapfillMode.END) == "2000-12-31T23:59:59"
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
def test_complete_datestr_year_month():
|
|
218
|
-
assert _gapfill_datestr(DATESTR_YEAR_MONTH) == "2000-01-01T00:00:00"
|
|
219
|
-
assert _gapfill_datestr(DATESTR_YEAR_MONTH, DatestrGapfillMode.MIDDLE) == "2000-01-16T11:59:59"
|
|
220
|
-
assert _gapfill_datestr(DATESTR_YEAR_MONTH, DatestrGapfillMode.END) == "2000-01-31T23:59:59"
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
def test_complete_datestr_year_month_day():
|
|
224
|
-
assert _gapfill_datestr(DATESTR_YEAR_MONTH_DAY) == "2000-01-01T00:00:00"
|
|
225
|
-
assert _gapfill_datestr(DATESTR_YEAR_MONTH_DAY, DatestrGapfillMode.MIDDLE) == "2000-01-01T11:59:59"
|
|
226
|
-
assert _gapfill_datestr(DATESTR_YEAR_MONTH_DAY, DatestrGapfillMode.END) == "2000-01-01T23:59:59"
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
def test_gapfill_datestr_feburary():
|
|
230
|
-
"""
|
|
231
|
-
Gapfilling February datestrings should take into account leap years
|
|
232
|
-
"""
|
|
233
|
-
# Non-leap year
|
|
234
|
-
assert _gapfill_datestr("1981-02") == "1981-02-01T00:00:00"
|
|
235
|
-
assert _gapfill_datestr("1981-02", DatestrGapfillMode.MIDDLE) == "1981-02-14T23:59:59"
|
|
236
|
-
assert _gapfill_datestr("1981-02", DatestrGapfillMode.END) == "1981-02-28T23:59:59"
|
|
237
|
-
|
|
238
|
-
# Leap year
|
|
239
|
-
assert _gapfill_datestr("2024-02", DatestrGapfillMode.MIDDLE) == "2024-02-15T11:59:59"
|
|
240
|
-
assert _gapfill_datestr("2024-02", DatestrGapfillMode.END) == "2024-02-29T23:59:59"
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
def test_complete_datestr_should_not_run():
|
|
244
|
-
"""
|
|
245
|
-
Completion should not run, therefore the function should return the datestr without
|
|
246
|
-
modification.
|
|
247
|
-
"""
|
|
248
|
-
assert _gapfill_datestr(DATESTR_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) == DATESTR_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
|
|
249
|
-
assert _gapfill_datestr(DATESTR_MONTH) == DATESTR_MONTH
|
|
250
|
-
assert _gapfill_datestr(DATESTR_MONTH_DAY) == DATESTR_MONTH_DAY
|
|
251
|
-
assert _gapfill_datestr("") == ""
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
# --- test _calc_datetime_range_intersection_duration ---
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
def test_calc_datetime_range_intersection_duration():
|
|
258
|
-
r1 = DatetimeRange(
|
|
259
|
-
start=datetime(2000, 1, 1),
|
|
260
|
-
end=datetime(2002, 1, 1)
|
|
261
|
-
)
|
|
262
|
-
r2 = DatetimeRange(
|
|
263
|
-
start=datetime(2001, 1, 1),
|
|
264
|
-
end=datetime(2003, 1, 1)
|
|
265
|
-
)
|
|
266
|
-
|
|
267
|
-
result = _calc_datetime_range_intersection_duration(r1, r2)
|
|
268
|
-
assert result == 31536000
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
def test_calc_datetime_range_intersection_duration_no_intersection():
|
|
272
|
-
r1 = DatetimeRange(
|
|
273
|
-
start=datetime(2000, 1, 1),
|
|
274
|
-
end=datetime(2000, 12, 31)
|
|
275
|
-
)
|
|
276
|
-
r2 = DatetimeRange(
|
|
277
|
-
start=datetime(2001, 1, 1),
|
|
278
|
-
end=datetime(2001, 12, 31)
|
|
279
|
-
)
|
|
280
|
-
|
|
281
|
-
result = _calc_datetime_range_intersection_duration(r1, r2)
|
|
282
|
-
assert result == 0
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
# --- test group_nodes_by_year ---
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
def test_group_nodes_by_year_empty_list():
|
|
289
|
-
CYCLES = []
|
|
290
|
-
EXPECTED = {}
|
|
291
|
-
result = group_nodes_by_year(CYCLES)
|
|
292
|
-
assert result == EXPECTED
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
GROUP_NODES_BY_YEAR_SCENARIO_A_CYCLES = [
|
|
296
|
-
{"@id": "cycle-1a", "endDate": "2002"},
|
|
297
|
-
{"@id": "cycle-2a", "endDate": "2003"},
|
|
298
|
-
{"@id": "cycle-3a", "endDate": "2006", "startDate": "2004"}
|
|
299
|
-
]
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
@mark.parametrize(
|
|
303
|
-
"system_datetime",
|
|
304
|
-
[
|
|
305
|
-
datetime(2024, 5, 1), # Closes issue 772
|
|
306
|
-
datetime(2024, 1, 1), # Jan 1st
|
|
307
|
-
datetime(2024, 2, 29), # Leap year
|
|
308
|
-
datetime(2024, 12, 31), # Dec 31st
|
|
309
|
-
# 3 random dates...
|
|
310
|
-
datetime(2030, 5, 4),
|
|
311
|
-
datetime(2035, 7, 22),
|
|
312
|
-
datetime(2047, 8, 14)
|
|
313
|
-
],
|
|
314
|
-
ids=lambda system_datetime: f"system_datetime = {datetime.strftime(system_datetime, r'%Y-%m-%d')}"
|
|
315
|
-
)
|
|
316
|
-
@patch("hestia_earth.utils.tools.parse")
|
|
317
|
-
def test_group_nodes_by_year_scenario_a(mock_parse, system_datetime):
|
|
318
|
-
"""
|
|
319
|
-
Datestr in format `YYYY`. Some nodes missing `startDate` field. One multi-year cycle.
|
|
320
|
-
|
|
321
|
-
Incomplete datestrs are gapfilled by default; with `endDate` datestrs snapping to the end
|
|
322
|
-
of the calendar year, and `startDate` datestrs snapping to the beginning of the calendar
|
|
323
|
-
year.
|
|
324
|
-
|
|
325
|
-
A bug used to occur in this function when it was run on the first day of a calendar month (e.g., 2024-04-01). To
|
|
326
|
-
verify that the bug is fixed we have simulated running the function on a variety of different dates.
|
|
327
|
-
"""
|
|
328
|
-
|
|
329
|
-
EXPECTED = {
|
|
330
|
-
2002: [{
|
|
331
|
-
"@id": "cycle-1a",
|
|
332
|
-
"endDate": "2002",
|
|
333
|
-
"fraction_of_group_duration": 1.0,
|
|
334
|
-
"fraction_of_node_duration": 1.0
|
|
335
|
-
}],
|
|
336
|
-
2003: [{
|
|
337
|
-
"@id": "cycle-2a",
|
|
338
|
-
"endDate": "2003",
|
|
339
|
-
"fraction_of_group_duration": 1.0,
|
|
340
|
-
"fraction_of_node_duration": 1.0
|
|
341
|
-
}],
|
|
342
|
-
2004: [{
|
|
343
|
-
"@id": "cycle-3a",
|
|
344
|
-
"endDate": "2006",
|
|
345
|
-
"startDate": "2004",
|
|
346
|
-
"fraction_of_group_duration": 1.0,
|
|
347
|
-
"fraction_of_node_duration": 0.33394160583941607
|
|
348
|
-
}],
|
|
349
|
-
2005: [{
|
|
350
|
-
"@id": "cycle-3a",
|
|
351
|
-
"endDate": "2006",
|
|
352
|
-
"startDate": "2004",
|
|
353
|
-
"fraction_of_group_duration": 1.0,
|
|
354
|
-
"fraction_of_node_duration": 0.333029197080292
|
|
355
|
-
}],
|
|
356
|
-
2006: [{
|
|
357
|
-
"@id": "cycle-3a",
|
|
358
|
-
"endDate": "2006",
|
|
359
|
-
"startDate": "2004",
|
|
360
|
-
"fraction_of_group_duration": 1.0,
|
|
361
|
-
"fraction_of_node_duration": 0.333029197080292
|
|
362
|
-
}]
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
# As we can't mock builtin method datetime.now(), we have to pass our test system_datetime into the parse function.
|
|
366
|
-
mock_parse.side_effect = lambda *args, **kwargs: parse(*args, default=system_datetime, **kwargs)
|
|
367
|
-
|
|
368
|
-
result = group_nodes_by_year(GROUP_NODES_BY_YEAR_SCENARIO_A_CYCLES)
|
|
369
|
-
assert result == EXPECTED
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
def test_group_nodes_by_year_scenario_a_with_inner_key():
|
|
373
|
-
|
|
374
|
-
INNER_KEY = "inner_key"
|
|
375
|
-
EXPECTED = {
|
|
376
|
-
2002: {
|
|
377
|
-
INNER_KEY: [{
|
|
378
|
-
"@id": "cycle-1a",
|
|
379
|
-
"endDate": "2002",
|
|
380
|
-
"fraction_of_group_duration": 1.0,
|
|
381
|
-
"fraction_of_node_duration": 1.0
|
|
382
|
-
}]
|
|
383
|
-
},
|
|
384
|
-
2003: {
|
|
385
|
-
INNER_KEY: [{
|
|
386
|
-
"@id": "cycle-2a",
|
|
387
|
-
"endDate": "2003",
|
|
388
|
-
"fraction_of_group_duration": 1.0,
|
|
389
|
-
"fraction_of_node_duration": 1.0
|
|
390
|
-
}]
|
|
391
|
-
},
|
|
392
|
-
2004: {
|
|
393
|
-
INNER_KEY: [{
|
|
394
|
-
"@id": "cycle-3a",
|
|
395
|
-
"endDate": "2006",
|
|
396
|
-
"startDate": "2004",
|
|
397
|
-
"fraction_of_group_duration": 1.0,
|
|
398
|
-
"fraction_of_node_duration": 0.33394160583941607
|
|
399
|
-
}]
|
|
400
|
-
},
|
|
401
|
-
2005: {
|
|
402
|
-
INNER_KEY: [{
|
|
403
|
-
"@id": "cycle-3a",
|
|
404
|
-
"endDate": "2006",
|
|
405
|
-
"startDate": "2004",
|
|
406
|
-
"fraction_of_group_duration": 1.0,
|
|
407
|
-
"fraction_of_node_duration": 0.333029197080292
|
|
408
|
-
}]
|
|
409
|
-
},
|
|
410
|
-
2006: {
|
|
411
|
-
INNER_KEY: [{
|
|
412
|
-
"@id": "cycle-3a",
|
|
413
|
-
"endDate": "2006",
|
|
414
|
-
"startDate": "2004",
|
|
415
|
-
"fraction_of_group_duration": 1.0,
|
|
416
|
-
"fraction_of_node_duration": 0.333029197080292
|
|
417
|
-
}]
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
result = group_nodes_by_year(GROUP_NODES_BY_YEAR_SCENARIO_A_CYCLES, inner_key=INNER_KEY)
|
|
422
|
-
assert result == EXPECTED
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
def test_group_nodes_by_year_scenario_b():
|
|
426
|
-
"""
|
|
427
|
-
Datestr in format `YYYY-MM-DD`. Two concurrent cycles (`cycle-3b` & `cycle-4b`).
|
|
428
|
-
"""
|
|
429
|
-
|
|
430
|
-
CYCLES = [
|
|
431
|
-
{"@id": "cycle-1b", "endDate": "2000-12-31", "startDate": "2000-01-01"},
|
|
432
|
-
{"@id": "cycle-2b", "endDate": "2001-12-31", "startDate": "2001-01-01"},
|
|
433
|
-
{"@id": "cycle-3b", "endDate": "2002-12-31", "startDate": "2002-01-01"},
|
|
434
|
-
{"@id": "cycle-4b", "endDate": "2002-12-31", "startDate": "2002-01-01"}
|
|
435
|
-
]
|
|
436
|
-
|
|
437
|
-
EXPECTED = {
|
|
438
|
-
2000: [
|
|
439
|
-
{
|
|
440
|
-
"@id": "cycle-1b",
|
|
441
|
-
"endDate": "2000-12-31",
|
|
442
|
-
"startDate": "2000-01-01",
|
|
443
|
-
"fraction_of_group_duration": 1.0,
|
|
444
|
-
"fraction_of_node_duration": 1.0
|
|
445
|
-
}
|
|
446
|
-
],
|
|
447
|
-
2001: [
|
|
448
|
-
{
|
|
449
|
-
"@id": "cycle-2b",
|
|
450
|
-
"endDate": "2001-12-31",
|
|
451
|
-
"startDate": "2001-01-01",
|
|
452
|
-
"fraction_of_group_duration": 1.0,
|
|
453
|
-
"fraction_of_node_duration": 1.0
|
|
454
|
-
}
|
|
455
|
-
],
|
|
456
|
-
2002: [
|
|
457
|
-
{
|
|
458
|
-
"@id": "cycle-3b",
|
|
459
|
-
"endDate": "2002-12-31",
|
|
460
|
-
"startDate": "2002-01-01",
|
|
461
|
-
"fraction_of_group_duration": 1.0,
|
|
462
|
-
"fraction_of_node_duration": 1.0
|
|
463
|
-
},
|
|
464
|
-
{
|
|
465
|
-
"@id": "cycle-4b",
|
|
466
|
-
"endDate": "2002-12-31",
|
|
467
|
-
"startDate": "2002-01-01",
|
|
468
|
-
"fraction_of_group_duration": 1.0,
|
|
469
|
-
"fraction_of_node_duration": 1.0
|
|
470
|
-
}
|
|
471
|
-
]
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
result = group_nodes_by_year(CYCLES)
|
|
475
|
-
assert result == EXPECTED
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
def test_group_nodes_by_year_scenario_c():
|
|
479
|
-
"""
|
|
480
|
-
Multiple overlapping 6 month and 12 month cycles.
|
|
481
|
-
"""
|
|
482
|
-
|
|
483
|
-
CYCLES = [
|
|
484
|
-
{"@id": "cycle-1c", "endDate": "2000-06", "startDate": "2000-01"},
|
|
485
|
-
{"@id": "cycle-2c", "endDate": "2001-12", "startDate": "2000-07"},
|
|
486
|
-
{"@id": "cycle-3c", "endDate": "2001-06", "startDate": "2001-01"},
|
|
487
|
-
{"@id": "cycle-4c", "endDate": "2002-06", "startDate": "2001-07"},
|
|
488
|
-
{"@id": "cycle-5c", "endDate": "2002-12", "startDate": "2002-01"}
|
|
489
|
-
]
|
|
490
|
-
|
|
491
|
-
EXPECTED = {
|
|
492
|
-
2000: [
|
|
493
|
-
{
|
|
494
|
-
"@id": "cycle-1c",
|
|
495
|
-
"endDate": "2000-06",
|
|
496
|
-
"startDate": "2000-01",
|
|
497
|
-
"fraction_of_group_duration": 0.4972677595628415,
|
|
498
|
-
"fraction_of_node_duration": 1.0
|
|
499
|
-
},
|
|
500
|
-
{
|
|
501
|
-
"@id": "cycle-2c",
|
|
502
|
-
"endDate": "2001-12",
|
|
503
|
-
"startDate": "2000-07",
|
|
504
|
-
"fraction_of_group_duration": 0.5027322404371585,
|
|
505
|
-
"fraction_of_node_duration": 0.33515482695810567
|
|
506
|
-
}
|
|
507
|
-
],
|
|
508
|
-
2001: [
|
|
509
|
-
{
|
|
510
|
-
"@id": "cycle-2c",
|
|
511
|
-
"endDate": "2001-12",
|
|
512
|
-
"startDate": "2000-07",
|
|
513
|
-
"fraction_of_group_duration": 1.0,
|
|
514
|
-
"fraction_of_node_duration": 0.6648451730418944
|
|
515
|
-
},
|
|
516
|
-
{
|
|
517
|
-
"@id": "cycle-3c",
|
|
518
|
-
"endDate": "2001-06",
|
|
519
|
-
"startDate": "2001-01",
|
|
520
|
-
"fraction_of_group_duration": 0.4958904109589041,
|
|
521
|
-
"fraction_of_node_duration": 1.0
|
|
522
|
-
},
|
|
523
|
-
{
|
|
524
|
-
"@id": "cycle-4c",
|
|
525
|
-
"endDate": "2002-06",
|
|
526
|
-
"startDate": "2001-07",
|
|
527
|
-
"fraction_of_group_duration": 0.5041095890410959,
|
|
528
|
-
"fraction_of_node_duration": 0.5041095890410959
|
|
529
|
-
}
|
|
530
|
-
],
|
|
531
|
-
2002: [
|
|
532
|
-
{
|
|
533
|
-
"@id": "cycle-4c",
|
|
534
|
-
"endDate": "2002-06",
|
|
535
|
-
"startDate": "2001-07",
|
|
536
|
-
"fraction_of_group_duration": 0.4958904109589041,
|
|
537
|
-
"fraction_of_node_duration": 0.4958904109589041
|
|
538
|
-
},
|
|
539
|
-
{
|
|
540
|
-
"@id": "cycle-5c",
|
|
541
|
-
"endDate": "2002-12",
|
|
542
|
-
"startDate": "2002-01",
|
|
543
|
-
"fraction_of_group_duration": 1.0,
|
|
544
|
-
"fraction_of_node_duration": 1.0
|
|
545
|
-
}
|
|
546
|
-
]
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
result = group_nodes_by_year(CYCLES)
|
|
550
|
-
assert result == EXPECTED
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
def test_group_nodes_by_year_scenario_d():
|
|
554
|
-
"""
|
|
555
|
-
Cases where nodes only overlap with year groups by a small amount.
|
|
556
|
-
Overlaps of less than 30% of a year should be not be included in a
|
|
557
|
-
year group, unless that majority (<50%) of their duration takes place
|
|
558
|
-
within that year.
|
|
559
|
-
"""
|
|
560
|
-
|
|
561
|
-
MANAGEMENT = [
|
|
562
|
-
{
|
|
563
|
-
"term.@id": "fullTillage",
|
|
564
|
-
"endDate": "2000-11",
|
|
565
|
-
"value": 100
|
|
566
|
-
},
|
|
567
|
-
{
|
|
568
|
-
"term.@id": "fullTillage",
|
|
569
|
-
"endDate": "2001-07",
|
|
570
|
-
"startDate": "2000-12",
|
|
571
|
-
"value": 50
|
|
572
|
-
},
|
|
573
|
-
{
|
|
574
|
-
"term.@id": "noTillage",
|
|
575
|
-
"endDate": "2001-07",
|
|
576
|
-
"startDate": "2000-12",
|
|
577
|
-
"value": 50
|
|
578
|
-
},
|
|
579
|
-
{
|
|
580
|
-
"term.@id": "noTillage",
|
|
581
|
-
"endDate": "2002-01",
|
|
582
|
-
"startDate": "2001-08",
|
|
583
|
-
"value": 100
|
|
584
|
-
},
|
|
585
|
-
{
|
|
586
|
-
"term.@id": "organicFertiliserUsed",
|
|
587
|
-
"endDate": "2000-11",
|
|
588
|
-
"startDate": "2000-09",
|
|
589
|
-
"value": True
|
|
590
|
-
},
|
|
591
|
-
{
|
|
592
|
-
"term.@id": "organicFertiliserUsed",
|
|
593
|
-
"endDate": "2002-06",
|
|
594
|
-
"startDate": "2001-07",
|
|
595
|
-
"value": True
|
|
596
|
-
}
|
|
597
|
-
]
|
|
598
|
-
|
|
599
|
-
EXPECTED = {
|
|
600
|
-
2000: [
|
|
601
|
-
{
|
|
602
|
-
"term.@id": "fullTillage",
|
|
603
|
-
"endDate": "2000-11",
|
|
604
|
-
"value": 100,
|
|
605
|
-
"fraction_of_group_duration": 0.9153005464480874,
|
|
606
|
-
"fraction_of_node_duration": 0.9153005464480874
|
|
607
|
-
},
|
|
608
|
-
{
|
|
609
|
-
"term.@id": "organicFertiliserUsed",
|
|
610
|
-
"endDate": "2000-11",
|
|
611
|
-
"startDate": "2000-09",
|
|
612
|
-
"value": True,
|
|
613
|
-
"fraction_of_group_duration": 0.24863387978142076,
|
|
614
|
-
"fraction_of_node_duration": 1.0
|
|
615
|
-
}
|
|
616
|
-
],
|
|
617
|
-
2001: [
|
|
618
|
-
{
|
|
619
|
-
"term.@id": "fullTillage",
|
|
620
|
-
"endDate": "2001-07",
|
|
621
|
-
"startDate": "2000-12",
|
|
622
|
-
"value": 50,
|
|
623
|
-
"fraction_of_group_duration": 0.5808219178082191,
|
|
624
|
-
"fraction_of_node_duration": 0.8724279835390947
|
|
625
|
-
},
|
|
626
|
-
{
|
|
627
|
-
"term.@id": "noTillage",
|
|
628
|
-
"endDate": "2001-07",
|
|
629
|
-
"startDate": "2000-12",
|
|
630
|
-
"value": 50,
|
|
631
|
-
"fraction_of_group_duration": 0.5808219178082191,
|
|
632
|
-
"fraction_of_node_duration": 0.8724279835390947
|
|
633
|
-
},
|
|
634
|
-
{
|
|
635
|
-
"term.@id": "noTillage",
|
|
636
|
-
"endDate": "2002-01",
|
|
637
|
-
"startDate": "2001-08",
|
|
638
|
-
"value": 100,
|
|
639
|
-
"fraction_of_group_duration": 0.4191780821917808,
|
|
640
|
-
"fraction_of_node_duration": 0.8315217391304348
|
|
641
|
-
},
|
|
642
|
-
{
|
|
643
|
-
"term.@id": "organicFertiliserUsed",
|
|
644
|
-
"endDate": "2002-06",
|
|
645
|
-
"startDate": "2001-07",
|
|
646
|
-
"value": True,
|
|
647
|
-
"fraction_of_group_duration": 0.5041095890410959,
|
|
648
|
-
"fraction_of_node_duration": 0.5041095890410959
|
|
649
|
-
}
|
|
650
|
-
],
|
|
651
|
-
2002: [
|
|
652
|
-
{
|
|
653
|
-
"term.@id": "organicFertiliserUsed",
|
|
654
|
-
"endDate": "2002-06",
|
|
655
|
-
"startDate": "2001-07",
|
|
656
|
-
"value": True,
|
|
657
|
-
"fraction_of_group_duration": 0.4958904109589041,
|
|
658
|
-
"fraction_of_node_duration": 0.4958904109589041
|
|
659
|
-
}
|
|
660
|
-
]
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
result = group_nodes_by_year(MANAGEMENT)
|
|
664
|
-
assert result == EXPECTED
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
def test_group_nodes_by_year_scenario_e():
|
|
668
|
-
"""
|
|
669
|
-
Edge case where nodes with short durations are equally split between two
|
|
670
|
-
year groups. In this case, they should be categorised as the later of the
|
|
671
|
-
two potential groups.
|
|
672
|
-
"""
|
|
673
|
-
|
|
674
|
-
MANAGEMENT = [
|
|
675
|
-
{
|
|
676
|
-
"term.@id": "fullTillage",
|
|
677
|
-
"endDate": "2001-01",
|
|
678
|
-
"startDate": "2000-12",
|
|
679
|
-
"value": 100
|
|
680
|
-
}
|
|
681
|
-
]
|
|
682
|
-
|
|
683
|
-
EXPECTED = {
|
|
684
|
-
2001: [
|
|
685
|
-
{
|
|
686
|
-
"term.@id": "fullTillage",
|
|
687
|
-
"endDate": "2001-01",
|
|
688
|
-
"startDate": "2000-12",
|
|
689
|
-
"value": 100,
|
|
690
|
-
"fraction_of_group_duration": 0.08493150684931507,
|
|
691
|
-
"fraction_of_node_duration": 0.50
|
|
692
|
-
}
|
|
693
|
-
]
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
result = group_nodes_by_year(MANAGEMENT)
|
|
697
|
-
assert result == EXPECTED
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
def test_group_nodes_by_year_missing_dates():
|
|
701
|
-
|
|
702
|
-
NODES = [
|
|
703
|
-
{"value": [0], "endDate": "2000-12-31", "startDate": "2000-01-01"},
|
|
704
|
-
{"value": [1], "endDate": "2000-12-31", "startDate": "2000-01-01"},
|
|
705
|
-
{"value": [2], "endDate": "2001-12-31", "startDate": "2001-01-01"},
|
|
706
|
-
{"value": [3], "dates": ["2001-12-31"]},
|
|
707
|
-
{"value": [4], "dates": ["2002"]},
|
|
708
|
-
{"value": [5], "dates": ["2003-06"]}
|
|
709
|
-
]
|
|
710
|
-
|
|
711
|
-
EXPECTED = {
|
|
712
|
-
2001: [{
|
|
713
|
-
"value": [3],
|
|
714
|
-
"dates": ["2001-12-31"],
|
|
715
|
-
"fraction_of_group_duration": 0.0027397260273972603,
|
|
716
|
-
"fraction_of_node_duration": 1.0
|
|
717
|
-
}],
|
|
718
|
-
2002: [{
|
|
719
|
-
"value": [4],
|
|
720
|
-
"dates": ["2002"],
|
|
721
|
-
"fraction_of_group_duration": 1.0,
|
|
722
|
-
"fraction_of_node_duration": 1.0
|
|
723
|
-
}],
|
|
724
|
-
2003: [{
|
|
725
|
-
"value": [5],
|
|
726
|
-
"dates": ["2003-06"],
|
|
727
|
-
"fraction_of_group_duration": 0.0821917808219178,
|
|
728
|
-
"fraction_of_node_duration": 1.0
|
|
729
|
-
}]
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
result = group_nodes_by_year(NODES, mode=GroupNodesByYearMode.DATES)
|
|
733
|
-
assert result == EXPECTED
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
def test_group_nodes_by_year_incorrect_dates():
|
|
737
|
-
|
|
738
|
-
NODES = [
|
|
739
|
-
{"value": [0], "endDate": "2000-09-14", "startDate": "2000-09-15"},
|
|
740
|
-
]
|
|
741
|
-
|
|
742
|
-
EXPECTED = {}
|
|
743
|
-
|
|
744
|
-
result = group_nodes_by_year(NODES, mode=GroupNodesByYearMode.START_AND_END_DATE)
|
|
745
|
-
assert result == EXPECTED
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
@mark.parametrize(
|
|
749
|
-
"system_datetime",
|
|
750
|
-
[
|
|
751
|
-
datetime(2024, 5, 1), # Closes issue 772
|
|
752
|
-
datetime(2024, 1, 1), # Jan 1st
|
|
753
|
-
datetime(2024, 2, 29), # Leap year
|
|
754
|
-
datetime(2024, 12, 31), # Dec 31st
|
|
755
|
-
# 3 random dates...
|
|
756
|
-
datetime(2026, 5, 14),
|
|
757
|
-
datetime(2032, 10, 10),
|
|
758
|
-
datetime(2043, 8, 22)
|
|
759
|
-
],
|
|
760
|
-
ids=lambda system_datetime: f"system_datetime = {datetime.strftime(system_datetime, r'%Y-%m-%d')}"
|
|
761
|
-
)
|
|
762
|
-
@patch("hestia_earth.utils.tools.parse")
|
|
763
|
-
def test_group_nodes_by_year_multiple_values_and_dates(mock_parse, system_datetime):
|
|
764
|
-
"""
|
|
765
|
-
A bug used to occur in this function when it was run on the first day of a calendar month (e.g., 2024-04-01). To
|
|
766
|
-
verify that the bug is fixed we have simulated running the function on a variety of different dates.
|
|
767
|
-
"""
|
|
768
|
-
|
|
769
|
-
NODES = [{
|
|
770
|
-
"value": [1, 2, 3, 4, 5],
|
|
771
|
-
"dates": [
|
|
772
|
-
"2000-01",
|
|
773
|
-
"2000-06",
|
|
774
|
-
"2001-02",
|
|
775
|
-
"2002-03",
|
|
776
|
-
"2003-01"
|
|
777
|
-
],
|
|
778
|
-
"sd": [
|
|
779
|
-
0.8, 0.9, 1.0, 0.9, 0.8
|
|
780
|
-
],
|
|
781
|
-
"observations": [
|
|
782
|
-
100, 100, 100, 100, 100
|
|
783
|
-
]
|
|
784
|
-
}]
|
|
785
|
-
|
|
786
|
-
EXPECTED = {
|
|
787
|
-
2000: [
|
|
788
|
-
{
|
|
789
|
-
"dates": ["2000-01"],
|
|
790
|
-
"fraction_of_node_duration": 1.0,
|
|
791
|
-
"fraction_of_group_duration": 0.08469945355191257,
|
|
792
|
-
"value": [1],
|
|
793
|
-
"sd": [0.8],
|
|
794
|
-
"observations": [
|
|
795
|
-
100
|
|
796
|
-
]
|
|
797
|
-
},
|
|
798
|
-
{
|
|
799
|
-
"dates": ["2000-06"],
|
|
800
|
-
"fraction_of_node_duration": 1.0,
|
|
801
|
-
"fraction_of_group_duration": 0.08196721311475409,
|
|
802
|
-
"value": [2],
|
|
803
|
-
"sd": [0.9],
|
|
804
|
-
"observations": [
|
|
805
|
-
100
|
|
806
|
-
]
|
|
807
|
-
}
|
|
808
|
-
],
|
|
809
|
-
2001: [{
|
|
810
|
-
"dates": ["2001-02"],
|
|
811
|
-
"fraction_of_node_duration": 1.0,
|
|
812
|
-
"fraction_of_group_duration": 0.07671232876712329,
|
|
813
|
-
"value": [3],
|
|
814
|
-
"sd": [1.0],
|
|
815
|
-
"observations": [
|
|
816
|
-
100
|
|
817
|
-
]
|
|
818
|
-
}],
|
|
819
|
-
2002: [{
|
|
820
|
-
"dates": ["2002-03"],
|
|
821
|
-
"fraction_of_node_duration": 1.0,
|
|
822
|
-
"fraction_of_group_duration": 0.08493150684931507,
|
|
823
|
-
"value": [4],
|
|
824
|
-
"sd": [0.9],
|
|
825
|
-
"observations": [
|
|
826
|
-
100
|
|
827
|
-
]
|
|
828
|
-
}],
|
|
829
|
-
2003: [{
|
|
830
|
-
"dates": ["2003-01"],
|
|
831
|
-
"fraction_of_node_duration": 1.0,
|
|
832
|
-
"fraction_of_group_duration": 0.08493150684931507,
|
|
833
|
-
"value": [5],
|
|
834
|
-
"sd": [0.8],
|
|
835
|
-
"observations": [
|
|
836
|
-
100
|
|
837
|
-
]
|
|
838
|
-
}]
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
# As we can't mock builtin method datetime.now(), we have to pass our test system_datetime into the parse function.
|
|
842
|
-
mock_parse.side_effect = lambda *args, **kwargs: parse(*args, default=system_datetime, **kwargs)
|
|
843
|
-
|
|
844
|
-
result = group_nodes_by_year(NODES, mode=GroupNodesByYearMode.DATES)
|
|
845
|
-
assert result == EXPECTED
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
@mark.parametrize(
|
|
849
|
-
"system_datetime",
|
|
850
|
-
[
|
|
851
|
-
datetime(2024, 5, 1), # Closes issue 772
|
|
852
|
-
datetime(2024, 1, 1), # Jan 1st
|
|
853
|
-
datetime(2024, 2, 29), # Leap year
|
|
854
|
-
datetime(2024, 12, 31), # Dec 31st
|
|
855
|
-
# 3 random dates...
|
|
856
|
-
datetime(2026, 4, 6),
|
|
857
|
-
datetime(2034, 7, 24),
|
|
858
|
-
datetime(2049, 10, 10)
|
|
859
|
-
],
|
|
860
|
-
ids=lambda system_datetime: f"system_datetime = {datetime.strftime(system_datetime, r'%Y-%m-%d')}"
|
|
861
|
-
)
|
|
862
|
-
@patch("hestia_earth.utils.tools.parse")
|
|
863
|
-
def test_group_nodes_by_year_and_month(mock_parse, system_datetime):
|
|
864
|
-
"""
|
|
865
|
-
A bug used to occur in this function when it was run on the first day of a calendar month (e.g., 2024-04-01). To
|
|
866
|
-
verify that the bug is fixed we have simulated running the function on a variety of different dates.
|
|
867
|
-
"""
|
|
868
|
-
|
|
869
|
-
MANAGEMENT = [
|
|
870
|
-
{
|
|
871
|
-
"term.@id": "fullTillage",
|
|
872
|
-
"endDate": "2001-01",
|
|
873
|
-
"startDate": "2000-12",
|
|
874
|
-
"value": 100
|
|
875
|
-
},
|
|
876
|
-
{
|
|
877
|
-
"term.@id": "reducedTillage",
|
|
878
|
-
"endDate": "2001-10",
|
|
879
|
-
"startDate": "2001-09",
|
|
880
|
-
"value": 100
|
|
881
|
-
}
|
|
882
|
-
]
|
|
883
|
-
|
|
884
|
-
EXPECTED = {
|
|
885
|
-
2000: {
|
|
886
|
-
12: [
|
|
887
|
-
{
|
|
888
|
-
"term.@id": "fullTillage",
|
|
889
|
-
"endDate": "2001-01",
|
|
890
|
-
"startDate": "2000-12",
|
|
891
|
-
"value": 100,
|
|
892
|
-
}
|
|
893
|
-
]
|
|
894
|
-
},
|
|
895
|
-
2001: {
|
|
896
|
-
1: [
|
|
897
|
-
{
|
|
898
|
-
"term.@id": "fullTillage",
|
|
899
|
-
"endDate": "2001-01",
|
|
900
|
-
"startDate": "2000-12",
|
|
901
|
-
"value": 100,
|
|
902
|
-
}
|
|
903
|
-
],
|
|
904
|
-
9: [
|
|
905
|
-
{
|
|
906
|
-
"term.@id": "reducedTillage",
|
|
907
|
-
"endDate": "2001-10",
|
|
908
|
-
"startDate": "2001-09",
|
|
909
|
-
"value": 100,
|
|
910
|
-
}
|
|
911
|
-
],
|
|
912
|
-
10: [
|
|
913
|
-
{
|
|
914
|
-
"term.@id": "reducedTillage",
|
|
915
|
-
"endDate": "2001-10",
|
|
916
|
-
"startDate": "2001-09",
|
|
917
|
-
"value": 100,
|
|
918
|
-
}
|
|
919
|
-
],
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
# As we can't mock builtin method datetime.now(), we have to pass our test system date into the parse function.
|
|
924
|
-
mock_parse.side_effect = lambda *args, **kwargs: parse(*args, default=system_datetime, **kwargs)
|
|
925
|
-
|
|
926
|
-
result = group_nodes_by_year_and_month(MANAGEMENT)
|
|
927
|
-
assert result == EXPECTED
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
# node, expected
|
|
931
|
-
PARAMS_SPLIT_NODE = [
|
|
932
|
-
(
|
|
933
|
-
{},
|
|
934
|
-
[{}]
|
|
935
|
-
),
|
|
936
|
-
(
|
|
937
|
-
{"value": [1, 2, 3], "dates": ["2000"]},
|
|
938
|
-
[{"value": [1, 2, 3], "dates": ["2000"]}]
|
|
939
|
-
),
|
|
940
|
-
(
|
|
941
|
-
{"value": [1, 2, 3], "startDate": "2000", "endDate": "2001"},
|
|
942
|
-
[{"value": [1, 2, 3], "startDate": "2000", "endDate": "2001"}]
|
|
943
|
-
),
|
|
944
|
-
(
|
|
945
|
-
{"value": 1, "startDate": "2000", "endDate": "2001"},
|
|
946
|
-
[{"value": 1, "startDate": "2000", "endDate": "2001"}]
|
|
947
|
-
),
|
|
948
|
-
(
|
|
949
|
-
{"value": None},
|
|
950
|
-
[{"value": None}]
|
|
951
|
-
),
|
|
952
|
-
(
|
|
953
|
-
{"value": [1, 2, 3], "dates": ["2000", "2001", "2002"]},
|
|
954
|
-
[
|
|
955
|
-
{"value": [1], "dates": ["2000"]},
|
|
956
|
-
{"value": [2], "dates": ["2001"]},
|
|
957
|
-
{"value": [3], "dates": ["2002"]}
|
|
958
|
-
]
|
|
959
|
-
),
|
|
960
|
-
(
|
|
961
|
-
{
|
|
962
|
-
"value": [1, 2],
|
|
963
|
-
"dates": ["2000", "2001"],
|
|
964
|
-
"sd": [0.816496, 0.816496],
|
|
965
|
-
"min": [0, 1],
|
|
966
|
-
"max": [2, 3],
|
|
967
|
-
"observations": [3, 3]
|
|
968
|
-
},
|
|
969
|
-
[
|
|
970
|
-
{
|
|
971
|
-
"value": [1],
|
|
972
|
-
"dates": ["2000"],
|
|
973
|
-
"sd": [0.816496],
|
|
974
|
-
"min": [0],
|
|
975
|
-
"max": [2],
|
|
976
|
-
"observations": [3]
|
|
977
|
-
},
|
|
978
|
-
{
|
|
979
|
-
"value": [2],
|
|
980
|
-
"dates": ["2001"],
|
|
981
|
-
"sd": [0.816496],
|
|
982
|
-
"min": [1],
|
|
983
|
-
"max": [3],
|
|
984
|
-
"observations": [3]
|
|
985
|
-
}
|
|
986
|
-
]
|
|
987
|
-
),
|
|
988
|
-
(
|
|
989
|
-
{
|
|
990
|
-
"value": [1, 2],
|
|
991
|
-
"dates": ["2000", "2001"],
|
|
992
|
-
"sd": [0.816496, 0.816496],
|
|
993
|
-
"min": [0, 1],
|
|
994
|
-
"max": [2, 3],
|
|
995
|
-
"observations": [3]
|
|
996
|
-
},
|
|
997
|
-
[
|
|
998
|
-
{
|
|
999
|
-
"value": [1],
|
|
1000
|
-
"dates": ["2000"],
|
|
1001
|
-
"sd": [0.816496],
|
|
1002
|
-
"min": [0],
|
|
1003
|
-
"max": [2],
|
|
1004
|
-
"observations": [3]
|
|
1005
|
-
},
|
|
1006
|
-
{
|
|
1007
|
-
"value": [2],
|
|
1008
|
-
"dates": ["2001"],
|
|
1009
|
-
"sd": [0.816496],
|
|
1010
|
-
"min": [1],
|
|
1011
|
-
"max": [3],
|
|
1012
|
-
"observations": [3]
|
|
1013
|
-
}
|
|
1014
|
-
]
|
|
1015
|
-
)
|
|
1016
|
-
]
|
|
1017
|
-
IDS_SPLIT_NODE = [
|
|
1018
|
-
"no split - empty node",
|
|
1019
|
-
"no split - not enough dates", # len(value) and len(dates) MUST match
|
|
1020
|
-
"no split - startDate & endDate",
|
|
1021
|
-
"no split - non-iterable value", # i.e., on a Management or Animal node.
|
|
1022
|
-
"no split - null value", # i.e., on a Animal node where value is not required.
|
|
1023
|
-
"value & dates",
|
|
1024
|
-
"descriptive statistics",
|
|
1025
|
-
"descriptive statistics w/ bad key" # if descriptive statistic keys have wrong length, don't split them
|
|
1026
|
-
]
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
@mark.parametrize("node, expected", PARAMS_SPLIT_NODE, ids=IDS_SPLIT_NODE)
|
|
1030
|
-
def test_split_node_by_dates(node, expected):
|
|
1031
|
-
assert split_node_by_dates(node) == expected
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
def test_most_recent_measurements():
|
|
1035
|
-
with open(f"{measurement_fixtures_folder}/measurements.jsonld", encoding='utf-8') as f:
|
|
1036
|
-
measurements = json.load(f)
|
|
1037
|
-
|
|
1038
|
-
with open(f"{measurement_fixtures_folder}/most-recent/measurements.jsonld", encoding='utf-8') as f:
|
|
1039
|
-
expected = json.load(f)
|
|
1040
|
-
|
|
1041
|
-
assert _most_recent_nodes(measurements, '2011') == expected
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
def test_shallowest_measurement():
|
|
1045
|
-
with open(f"{measurement_fixtures_folder}/most-recent/measurements.jsonld", encoding='utf-8') as f:
|
|
1046
|
-
measurements = json.load(f)
|
|
1047
|
-
|
|
1048
|
-
with open(f"{measurement_fixtures_folder}/shallowest/measurement.jsonld", encoding='utf-8') as f:
|
|
1049
|
-
expected = json.load(f)
|
|
1050
|
-
|
|
1051
|
-
assert _shallowest_node(measurements) == expected
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
@mark.parametrize(
|
|
1055
|
-
"node, expected",
|
|
1056
|
-
[
|
|
1057
|
-
(
|
|
1058
|
-
{"startDate": "2000", "endDate": "2001"},
|
|
1059
|
-
True
|
|
1060
|
-
),
|
|
1061
|
-
(
|
|
1062
|
-
{"startDate": "2001", "endDate": "2000"},
|
|
1063
|
-
False
|
|
1064
|
-
),
|
|
1065
|
-
(
|
|
1066
|
-
{"startDate": "2000-01-01T00:00:00", "endDate": "2000-01-01T00:00:00"},
|
|
1067
|
-
False
|
|
1068
|
-
),
|
|
1069
|
-
(
|
|
1070
|
-
{"endDate": "2000"},
|
|
1071
|
-
True
|
|
1072
|
-
),
|
|
1073
|
-
(
|
|
1074
|
-
{},
|
|
1075
|
-
True
|
|
1076
|
-
),
|
|
1077
|
-
],
|
|
1078
|
-
ids=["correct", "reversed", "equal", "no start date", "no start date, no end date"])
|
|
1079
|
-
def test_validate_start_date_end_date(node: dict, expected: bool):
|
|
1080
|
-
# Closes #972
|
|
1081
|
-
assert validate_start_date_end_date(node) == expected
|