Skip to content

Prepare national data

View or edit on GitHub

This page is synchronized from trase/models/bolivia/soy/prepare_national_data.ipynb. Last modified on 2025-12-14 23:19 CET by Trase Admin. Please view or edit the original file there; changes should be reflected here after a midnight build (CET time), or manually triggering it with a GitHub action (link).

Bolivian Soy

National data preparation.

We're doing this so that we can put new data online in Q3 2021, and a subnational model should follow in 2022.

from trase.tools.sps import SupplyChain

from definition import years as model_years, version
# Run supply chain model
for year in range(min(model_years), max(model_years) + 1):
    print("-" * 40)
    print("Preparing national data for {} {} {}...".format("Bolivia", "Soy", year))
    sc = SupplyChain("bolivia/soy", year=year, bucket="trase-storage")
    # Set up Dataset
    sc.preparation()
    sc.load()

    # manually setting the national data version, since the preparation.py file is set for the subnational model
    sc.definition.version = "0.0.3"

#     sc.export_results()
#     sc.upload_results(filename = f"NATIONAL_BOLIVIA_SOY_{sc.context.year}.csv")
sc.get("flows")