AgriFoodPy Data is a data repository and companion package to AgriFoodPy, providing easy access to curated datasets related to agriculture, food systems, environmental impacts, land use, and population. These datasets are essential for modeling, analysis, and research in sustainable food systems.
All datasets are stored in NetCDF format and loaded as xarray DataArrays or Datasets for efficient handling in Python.
For a full list of datasets please visit
To intall AgriFoodPy Data during development:
pip install git+https://github.com/FixOurFood/agrifoodpy-data.gitFor stable releases (once available), use:
pip install agrifoodpy-dataAgriFoodPy Data integrates seamlessly with AgriFoodPy to load and utilize datasets in both pipeline and interactive modes.
In interactive mode, datasets are loaded as module atributes by importing them
from agrifoodpy_data.food import FAOSTATAlternatively, datasets can be imported using the load_dataset function of
AgriFoodPy in standalone mode.
from agrifoodpy.utils.nodes import load_dataset
FAOSTAT = load_dataset(module="agrifoodpy_data.food", data_attr="FAOSTAT")In pipeline mode, datasets can be stored in an AgriFoodPy Pipeline datablock
using the load_dataset module and used in other modules further along the
pipleine
import agrifoodpy as afp
pipe = afp.pipeline.Pipeline()
pipe.add_node(
afp.utils.nodes.load_dataset,
name="Load fbs",
params={
"datablock_path": "fbs",
"module": "agrifoodpy_data.food",
"data_attr": "FAOSTAT",
"coords": {
"Item": [2731, 2511],
"Year": [2019, 2020],
"Region": 229},
}
)
# add more nodes to work with the loaded datasetContributions are welcome! Please see the main AgriFoodPy repository for guidelines.