{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Static Scenario Generation Example " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We will start by import the relevant modules " ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from static_scenario_generator.scenarios import ScenarioGeneration\n", "import os " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Define path and inputs " ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "path = \"../tests/data\"\n", "\n", "#scenario input prameters in json format\n", "json_file = \"config_1.json\" \n", "\n", "#scenario input prameters in csv format\n", "csv_file = \"csv_load_input.csv\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Scenario Generator class instance " ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "scenario_class = ScenarioGeneration()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Json output " ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " Scenarios Cattle systems Manure management Dairy pop Beef pop \\\n", "0 0 Dairy tank liquid 1060000 0 \n", "1 0 Beef tank liquid 0 1000 \n", "2 0 Upland sheep solid 0 0 \n", "3 0 Lowland sheep solid 0 0 \n", "4 1 Dairy tank liquid 1060000 0 \n", "5 1 Beef tank liquid 0 1000 \n", "6 1 Upland sheep solid 0 0 \n", "7 1 Lowland sheep solid 0 0 \n", "\n", " Upland sheep pop Lowland sheep pop Dairy prod Beef prod \\\n", "0 0 0 0 0 \n", "1 0 0 0 0 \n", "2 3000 0 0 0 \n", "3 0 50000 0 0 \n", "4 0 0 0 0 \n", "5 0 0 0 0 \n", "6 0 0 0 0 \n", "7 0 0 0 0 \n", "\n", " Upland sheep prod ... Urea abated proportion Crop area Wetland area \\\n", "0 0 ... 0 0 0 \n", "1 0 ... 0 0 0 \n", "2 0 ... 0 0 0 \n", "3 0 ... 0 0 0 \n", "4 0 ... 0 0 0 \n", "5 0 ... 0 0 0 \n", "6 0 ... 0 0 0 \n", "7 0 ... 0 0 0 \n", "\n", " Forest area Conifer proportion Broadleaf proportion Conifer harvest \\\n", "0 1 0.7 0.3 0.05 \n", "1 1 0.7 0.3 0.05 \n", "2 1 0.7 0.3 0.05 \n", "3 1 0.7 0.3 0.05 \n", "4 1 0.7 0.3 0.05 \n", "5 1 0.7 0.3 0.05 \n", "6 1 0.7 0.3 0.05 \n", "7 1 0.7 0.3 0.05 \n", "\n", " Broadleaf harvest Conifer thinned Afforest year \n", "0 0 0.1 2080 \n", "1 0 0.1 2080 \n", "2 0 0.1 2080 \n", "3 0 0.1 2080 \n", "4 0 0.8 2080 \n", "5 0 0.8 2080 \n", "6 0 0.8 2080 \n", "7 0 0.8 2080 \n", "\n", "[8 rows x 28 columns]\n" ] } ], "source": [ "print(scenario_class.json_load(os.path.join(path,json_file)))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## CSV output" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " Scenarios Cattle systems Manure management Dairy pop Beef pop \\\n", "0 0 Dairy tank liquid 1060000 0 \n", "1 0 Beef tank liquid 0 3000 \n", "2 0 Upland sheep solid 0 0 \n", "3 0 Lowland sheep solid 0 0 \n", "4 1 Dairy tank liquid 1060000 0 \n", "5 1 Beef tank liquid 0 3000 \n", "6 1 Upland sheep solid 0 0 \n", "7 1 Lowland sheep solid 0 0 \n", "\n", " Upland sheep pop Lowland sheep pop Dairy prod Beef prod \\\n", "0 0 0 0 0 \n", "1 0 0 0 0 \n", "2 3000 0 0 0 \n", "3 0 3000 0 0 \n", "4 0 0 0 0 \n", "5 0 0 0 0 \n", "6 3000 0 0 0 \n", "7 0 3000 0 0 \n", "\n", " Upland sheep prod ... Urea abated proportion Crop area Wetland area \\\n", "0 0 ... 0 0.2 0.2 \n", "1 0 ... 0 0.2 0.2 \n", "2 0 ... 0 0.2 0.2 \n", "3 0 ... 0 0.2 0.2 \n", "4 0 ... 0 0.2 0.2 \n", "5 0 ... 0 0.2 0.2 \n", "6 0 ... 0 0.2 0.2 \n", "7 0 ... 0 0.2 0.2 \n", "\n", " Forest area Conifer proportion Broadleaf proportion Conifer harvest \\\n", "0 1 0.2 0.3 0.4 \n", "1 1 0.2 0.3 0.4 \n", "2 1 0.2 0.3 0.4 \n", "3 1 0.2 0.3 0.4 \n", "4 1 0.2 0.3 0.4 \n", "5 1 0.2 0.3 0.4 \n", "6 1 0.2 0.3 0.4 \n", "7 1 0.2 0.3 0.4 \n", "\n", " Broadleaf harvest Conifer thinned Afforest year \n", "0 0.3 0.4 2080 \n", "1 0.3 0.4 2080 \n", "2 0.3 0.4 2080 \n", "3 0.3 0.4 2080 \n", "4 0.3 0.4 2080 \n", "5 0.3 0.4 2080 \n", "6 0.3 0.4 2080 \n", "7 0.3 0.4 2080 \n", "\n", "[8 rows x 28 columns]\n" ] } ], "source": [ "print(scenario_class.csv_load(os.path.join(path,csv_file)))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": ".venv", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.12" } }, "nbformat": 4, "nbformat_minor": 2 }