diff --git a/demo.ipynb b/demo.ipynb index 0d555e7..4a2e547 100644 --- a/demo.ipynb +++ b/demo.ipynb @@ -401,16 +401,149 @@ "id": "f538daaf-37c8-4560-abd9-2aadd98b53dd", "metadata": {}, "source": [ - "### WOFOST ensembles" + "### Running a WOFOST ensemble across multiple locations" ] }, { "cell_type": "markdown", - "id": "dbac85d4-db2f-4bd5-b474-d33058f4d97d", + "id": "59b61e9c-c00f-4927-8be5-889020da7fef", "metadata": {}, "source": [ - "### Running WOFOST at multiple sites" + "More interesting than a single WOFOST run is the ability to do multiple runs at the same time.\n", + "This can be used to simulate multiple locations at the same time, such as different plots in the BRP or random sites within one province." ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "dbd7b6b3-7e94-4d0a-9938-149325f399c3", + "metadata": {}, + "outputs": [], + "source": [ + "# Setup BRP\n", + "year = 2020\n", + "brp = fpcup.io.load_brp(year)\n", + "index = 1 # Change this to any index in the BRP table. Try some values and see what happens!\n", + "\n", + "# Select plot\n", + "brp_plot = brp.iloc[index]\n", + "brp_plot" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f03731b8-f650-4a40-b350-1134099b941e", + "metadata": {}, + "outputs": [], + "source": [ + "# Setup WOFOST\n", + "crop_name = brp_plot[\"crop\"]\n", + "crop = fpcup.crop.select_crop(crop_name)\n", + "agromanagement = crop.agromanagement_first_sowingdate(year) # First sowing date of the year\n", + "\n", + "soildata = fpcup.soil.soil_types[\"ec1\"] # In the future, it will be possible to retrieve the soil type specific to this plot\n", + "\n", + "latitude, longitude = brp_plot[\"latitude\"], brp_plot[\"longitude\"] # Center of the plot\n", + "weatherdata = fpcup.weather.load_weather_data_NASAPower((latitude, longitude))" + ] + }, + { + "cell_type": "markdown", + "id": "fc1c2792-1680-40b6-82e8-1b97815f1c76", + "metadata": {}, + "source": [ + "Rather than keeping all of the results in working memory, they are saved to files which can be accessed later.\n", + "For this, we must also set up a folder." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7662330f-9df6-463f-b80e-a74ec4744de3", + "metadata": {}, + "outputs": [], + "source": [ + "# Setup output folder" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3b29ab07-7d1d-4e99-90e3-c2c22e3ad563", + "metadata": {}, + "outputs": [], + "source": [ + "# Run WOFOST" + ] + }, + { + "cell_type": "markdown", + "id": "0eea4829-d284-4ffd-a649-8aeaaf4c2e81", + "metadata": {}, + "source": [ + "Since we have multiple outputs, the tabulated summary becomes more interesting:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "61709ee2-cc30-41ef-bf6f-d781e3d1fda1", + "metadata": {}, + "outputs": [], + "source": [ + "outputs.summary" + ] + }, + { + "cell_type": "markdown", + "id": "91022e4a-ffcf-4ab4-9dca-90e41583a7ac", + "metadata": {}, + "source": [ + "Additionally, we can plot the results in several ways:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e91a4803-e627-4a50-9ebf-c749870890fe", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5eadcd91-bf0e-418e-b386-93ede2581ffe", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1dafc5fc-a1b9-42b7-8936-1528f73f1cdd", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "id": "d5144658-0015-41af-8278-20da55694238", + "metadata": {}, + "source": [ + "### Estimating uncertainty using WOFOST ensembles\n", + "Ensembles can also be used to estimate the uncertainty in outputs by using different combinations of input parameters.\n", + "Here, we will look at an example using one site." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c307ef2c-31a1-4f56-9fd7-041609a98c5e", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": {