Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📊 Living Planet Report 2024 #3336

Merged
merged 25 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions dag/biodiversity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,23 @@ steps:
- data://meadow/biodiversity/2024-08-12/invasive_species
data://grapher/biodiversity/2024-08-12/invasive_species:
- data://garden/biodiversity/2024-08-12/invasive_species

# Living Planet Index
data://meadow/biodiversity/2024-09-30/living_planet_index:
- snapshot://biodiversity/2024-09-30/living_planet_index.xlsx
data://garden/biodiversity/2024-09-30/living_planet_index:
- data://meadow/biodiversity/2024-09-30/living_planet_index
data://grapher/biodiversity/2024-09-30/living_planet_index:
- data://garden/biodiversity/2024-09-30/living_planet_index

# LPI - Share of populations increasing or decreasing
data://garden/biodiversity/2024-09-30/living_planet_index_share:
- snapshot://biodiversity/2024-09-30/living_planet_index_share.csv
data://grapher/biodiversity/2024-09-30/living_planet_index_share:
- data://garden/biodiversity/2024-09-30/living_planet_index_share

# LPI - Share of populations increasing or decreasing
data://garden/biodiversity/2024-09-30/living_planet_index_completeness:
- snapshot://biodiversity/2024-09-30/living_planet_index_completeness.csv
data://grapher/biodiversity/2024-09-30/living_planet_index_completeness:
- data://garden/biodiversity/2024-09-30/living_planet_index_completeness
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Africa": "Africa",
"Global": "World",
"AsiaPacific": "Asia and Pacific",
"EuropeCentralAsia": "Europe and Central Asia",
"Freshwater": "Freshwater",
"LatinAmerica&Carib": "Latin America and the Caribbean",
"NorthAmerica": "North America"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# NOTE: To learn more about the fields, hover over their names.
definitions:
common:
presentation:
topic_tags:
- Biodiversity


# Learn more about the available fields:
# http://docs.owid.io/projects/etl/architecture/metadata/reference/
dataset:
update_period_days: 730


tables:
living_planet_index:
variables:
lpi_final:
title: Living Planet Index
description_short: The Living Planet Index (LPI) is a measure of the state of global biological diversity based on population trends of vertebrate species from around the world. The index value is measured relative to species' populations in 1970 (i.e. 1970 = 1).
unit: (1970 = 1)
ci_low:
title: Lower confidence interval of Living Planet Index
unit: (1970 = 1)
ci_high:
title: Upper confidence interval of Living Planet Index
unit: (1970 = 1)
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""Load a meadow dataset and create a garden dataset."""

from etl.data_helpers import geo
from etl.helpers import PathFinder, create_dataset

# Get paths and naming conventions for current step.
paths = PathFinder(__file__)


def run(dest_dir: str) -> None:
#
# Load inputs.
#
# Load meadow dataset.
ds_meadow = paths.load_dataset("living_planet_index")

# Read table from meadow dataset.
tb = ds_meadow["living_planet_index"].reset_index()

#
# Process data.
#
tb = geo.harmonize_countries(df=tb, countries_file=paths.country_mapping_path)
tb = tb.format(["country", "year"])

#
# Save outputs.
#
# Create a new garden dataset with the same metadata as the meadow dataset.
ds_garden = create_dataset(
dest_dir, tables=[tb], check_variables_metadata=True, default_metadata=ds_meadow.metadata
)

# Save changes in the new garden dataset.
ds_garden.save()
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# NOTE: To learn more about the fields, hover over their names.
definitions:
common:
presentation:
topic_tags:
- Biodiversity

# Learn more about the available fields:
# http://docs.owid.io/projects/etl/architecture/metadata/reference/
dataset:
update_period_days: 730


tables:
living_planet_index_completeness:
variables:
species_in_lpi:
title: Number of species included in the LPI
unit: species
species_total:
title: Number of species in the taxonomic group
unit: species
species_not_in_lpi:
title: Number of species not included in the LPI
unit: species
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""Load a meadow dataset and create a garden dataset."""

from etl.helpers import PathFinder, create_dataset

# Get paths and naming conventions for current step.
paths = PathFinder(__file__)


def run(dest_dir: str) -> None:
#
# Load inputs.
#
# Load meadow dataset.
snap = paths.load_snapshot("living_planet_index_completeness")

# Read table from meadow dataset.
tb = snap.read()
#
# Process data.
#
tb = tb.rename(columns={"taxon": "country"})
tb = tb.format(["country", "year"])

#
# Save outputs.
#
# Create a new garden dataset with the same metadata as the meadow dataset.
ds_garden = create_dataset(dest_dir, tables=[tb], check_variables_metadata=True)

# Save changes in the new garden dataset.
ds_garden.save()
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# NOTE: To learn more about the fields, hover over their names.
definitions:
common:
presentation:
topic_tags:
- Biodiversity
unit: "%"
short_unit: "%"
display:
numDecimalPlaces: 1


# Learn more about the available fields:
# http://docs.owid.io/projects/etl/architecture/metadata/reference/
dataset:
update_period_days: 730


tables:
living_planet_index_share:
variables:
share_increasing:
title: Share of populations increasing
description_short: The share of native, vertebrate populations that have increased by more than 5% over the study period.
share_decreasing:
title: Share of populations decreasing
description_short: The share of native, vertebrate populations that have decreased by more than 5% over the study period.
share_stable:
title: Share of populations stable
description_short: The share of native, vertebrate populations that are stable in size, meaning that they have changed by less than 5% over the study period.
share_strong_increase:
title: Share of populations strongly increasing
description_short: The share of native, vertebrate populations that are increasing on average by 2.81% or more per year.
description_processing: Categories are based on [Burns et al. (2023)](https://stateofnature.org.uk/wp-content/uploads/2023/09/TP25999-State-of-Nature-main-report_2023_FULL-DOC-v12.pdf).
display:
name: Strong increase
presentation:
grapher_config:
note: "Categories are based on annual changes: +2.81% is a strong increase; +1.16% to +2.81% is a moderate increase; -2.73% to -1.14% is a moderate decrease; and greater than -2.73% is a strong decrease."
share_moderate_increase:
title: Share of populations moderately increasing
description_short: The share of native, vertebrate populations that are increasing on average by 1.16% to 2.81% per year.
description_processing: Categories are based on [Burns et al. (2023)](https://stateofnature.org.uk/wp-content/uploads/2023/09/TP25999-State-of-Nature-main-report_2023_FULL-DOC-v12.pdf).
display:
name: Moderate increase
presentation:
grapher_config:
note: "Categories are based on annual changes: +2.81% is a strong increase; +1.16% to +2.81% is a moderate increase; -2.73% to -1.14% is a moderate decrease; and greater than -2.73% is a strong decrease."
share_little_change:
title: Share of populations with little change
description_short: The share of native, vertebrate populations that are decreasing by less than 1.14% per year and increasing by less than 1.16% per year.
description_processing: Categories are based on [Burns et al. (2023)](https://stateofnature.org.uk/wp-content/uploads/2023/09/TP25999-State-of-Nature-main-report_2023_FULL-DOC-v12.pdf).
display:
name: No change
presentation:
grapher_config:
note: "Categories are based on annual changes: +2.81% is a strong increase; +1.16% to +2.81% is a moderate increase; -2.73% to -1.14% is a moderate decrease; and greater than -2.73% is a strong decrease."
share_moderate_decrease:
title: Share of populations moderately decreasing
description_short: The share of native, vertebrate populations that are decreasing on average by 1.14% to 2.73% per year.
description_processing: Categories are based on [Burns et al. (2023)](https://stateofnature.org.uk/wp-content/uploads/2023/09/TP25999-State-of-Nature-main-report_2023_FULL-DOC-v12.pdf).
display:
name: Moderate decrease
presentation:
grapher_config:
note: "Categories are based on annual changes: +2.81% is a strong increase; +1.16% to +2.81% is a moderate increase; -2.73% to -1.14% is a moderate decrease; and greater than -2.73% is a strong decrease."
share_strong_decrease:
title: Share of populations strongly decreasing
description_short: The share of native, vertebrate populations that are decreasing on average by 2.73% or more per year.
description_processing: Categories are based on [Burns et al. (2023)](https://stateofnature.org.uk/wp-content/uploads/2023/09/TP25999-State-of-Nature-main-report_2023_FULL-DOC-v12.pdf).
display:
name: Strong decrease
presentation:
grapher_config:
note: "Categories are based on annual changes: +2.81% is a strong increase; +1.16% to +2.81% is a moderate increase; -2.73% to -1.14% is a moderate decrease; and greater than -2.73% is a strong decrease."

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""Load a meadow dataset and create a garden dataset."""

from etl.helpers import PathFinder, create_dataset

# Get paths and naming conventions for current step.
paths = PathFinder(__file__)


def run(dest_dir: str) -> None:
#
# Load inputs.
#
# Load meadow dataset.
snap = paths.load_snapshot("living_planet_index_share")

# Read table from meadow dataset.
tb = snap.read()
#
# Process data.
#
tb = tb.rename(columns={"taxon": "country"})
tb = tb.format(["country", "year"])

#
# Save outputs.
#
# Create a new garden dataset with the same metadata as the meadow dataset.
ds_garden = create_dataset(dest_dir, tables=[tb], check_variables_metadata=True)

# Save changes in the new garden dataset.
ds_garden.save()
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""Load a garden dataset and create a grapher dataset."""

from etl.helpers import PathFinder, create_dataset

# Get paths and naming conventions for current step.
paths = PathFinder(__file__)


def run(dest_dir: str) -> None:
#
# Load inputs.
#
# Load garden dataset.
ds_garden = paths.load_dataset("living_planet_index")

# Read table from garden dataset.
tb = ds_garden["living_planet_index"]

#
# Process data.
#

#
# Save outputs.
#
# Create a new grapher dataset with the same metadata as the garden dataset.
ds_grapher = create_dataset(
dest_dir, tables=[tb], check_variables_metadata=True, default_metadata=ds_garden.metadata
)

# Save changes in the new grapher dataset.
ds_grapher.save()
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""Load a garden dataset and create a grapher dataset."""

from etl.helpers import PathFinder, create_dataset

# Get paths and naming conventions for current step.
paths = PathFinder(__file__)


def run(dest_dir: str) -> None:
#
# Load inputs.
#
# Load garden dataset.
ds_garden = paths.load_dataset("living_planet_index_completeness")

# Read table from garden dataset.
tb = ds_garden["living_planet_index_completeness"]

#
# Process data.
#

#
# Save outputs.
#
# Create a new grapher dataset with the same metadata as the garden dataset.
ds_grapher = create_dataset(
dest_dir, tables=[tb], check_variables_metadata=True, default_metadata=ds_garden.metadata
)

# Save changes in the new grapher dataset.
ds_grapher.save()
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""Load a garden dataset and create a grapher dataset."""

from etl.helpers import PathFinder, create_dataset

# Get paths and naming conventions for current step.
paths = PathFinder(__file__)


def run(dest_dir: str) -> None:
#
# Load inputs.
#
# Load garden dataset.
ds_garden = paths.load_dataset("living_planet_index_share")

# Read table from garden dataset.
tb = ds_garden["living_planet_index_share"]

#
# Process data.
#

#
# Save outputs.
#
# Create a new grapher dataset with the same metadata as the garden dataset.
ds_grapher = create_dataset(
dest_dir, tables=[tb], check_variables_metadata=True, default_metadata=ds_garden.metadata
)

# Save changes in the new grapher dataset.
ds_grapher.save()
Loading
Loading