Skip to content

Commit

Permalink
Run on BRP
Browse files Browse the repository at this point in the history
  • Loading branch information
burggraaff committed Sep 12, 2024
1 parent 37bb8d5 commit a209a77
Showing 1 changed file with 66 additions and 1 deletion.
67 changes: 66 additions & 1 deletion demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,72 @@
"id": "b270e260-d77c-4a00-8386-ce18467ce8c9",
"metadata": {},
"source": [
"#### Using the BRP"
"#### Using the BRP\n",
"We can also use the BRP to retrieve coordinates and crop data automatically for one plot."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f4074a32-17bf-4a06-8d59-191dc089c43e",
"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": "984b54dd-8e81-42ed-a736-70b366389e1b",
"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": "eed64494-8b48-4319-849e-622675776d39",
"metadata": {},
"source": [
"We again combine the run data, now using the special BRP class, and run the model."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b03775c6-bfd3-44d4-adb9-9ea0962ccebd",
"metadata": {},
"outputs": [],
"source": [
"rundata = fpcup.model.RunDataBRP(brpdata=brp_plot, brpyear=year, soildata=soildata, weatherdata=weatherdata, agromanagement=agromanagement)\n",
"output = fpcup.model.run_pcse_single(rundata)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "411fd77c-0ea7-4cd2-b566-79fb9826ce69",
"metadata": {},
"outputs": [],
"source": [
"output.summary"
]
},
{
Expand Down

0 comments on commit a209a77

Please sign in to comment.