generated from fastai/nbdev_template
-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #121 from chris-s-bowden/v7-improvements
v3.0.1
- Loading branch information
Showing
7 changed files
with
225 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stderr", | ||
"output_type": "stream", | ||
"text": [ | ||
"c:\\Users\\s10034cb\\Dropbox (The University of Manchester)\\Manchester Postdoc\\aquacrop\\aquacrop\\solution\\root_zone_water.py:4: NumbaPendingDeprecationWarning: \u001b[1mThe 'pycc' module is pending deprecation. Replacement technology is being developed.\n", | ||
"\n", | ||
"Pending Deprecation in Numba 0.57.0. For more information please see: https://numba.readthedocs.io/en/stable/reference/deprecation.html#deprecation-of-the-numba-pycc-module\u001b[0m\n", | ||
" from numba.pycc import CC\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"#source:https://urldefense.com/v3/__https://colab.research.google.com/github/aquacropos/aquacrop/blob/master/docs/notebooks/AquaCrop_OSPy_Notebook_1.ipynb*scrollTo=3PvQ5QYR49tG__;Iw!!PDiH4ENfjr2_Jw!D_pEP_KWqfA5MRPYdLgFgi8qQKsms7Wr4zR9ze88aSc-2dJmvQiGEntY6mcl2r3gO1Zn3I_nWrYtAqj8O_tcyzhIyvM8tAPZSmc3$ [colab[.]research[.]google[.]com]\n", | ||
"\n", | ||
"from aquacrop import AquaCropModel, Soil, Crop, InitialWaterContent, IrrigationManagement\n", | ||
"from aquacrop.utils import prepare_weather, get_filepath\n", | ||
"\n", | ||
"import pandas as pd\n", | ||
"import matplotlib.pyplot as plt\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"ename": "AttributeError", | ||
"evalue": "'Crop' object has no attribute 'SxTopQ'", | ||
"output_type": "error", | ||
"traceback": [ | ||
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", | ||
"\u001b[1;31mAttributeError\u001b[0m Traceback (most recent call last)", | ||
"Cell \u001b[1;32mIn[4], line 9\u001b[0m\n\u001b[0;32m 7\u001b[0m sandy_loam \u001b[38;5;241m=\u001b[39m Soil(soil_type\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mSandyLoam\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m 8\u001b[0m wheat \u001b[38;5;241m=\u001b[39m Crop(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mWheat\u001b[39m\u001b[38;5;124m'\u001b[39m, planting_date\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m09/28\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m----> 9\u001b[0m test_crop_basic \u001b[38;5;241m=\u001b[39m \u001b[43mCrop\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mcustom\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43m10/01\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mPlantPop\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;241;43m1000\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mSeedSize\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;241;43m5\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[0;32m 10\u001b[0m test_crop \u001b[38;5;241m=\u001b[39m Crop(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mcustom\u001b[39m\u001b[38;5;124m'\u001b[39m,\n\u001b[0;32m 11\u001b[0m planting_date\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m09/28\u001b[39m\u001b[38;5;124m'\u001b[39m,\n\u001b[0;32m 12\u001b[0m \u001b[38;5;66;03m#harvest_date='08/28',\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 49\u001b[0m YldWC \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m85\u001b[39m\n\u001b[0;32m 50\u001b[0m )\n\u001b[0;32m 52\u001b[0m InitWC \u001b[38;5;241m=\u001b[39m InitialWaterContent(value\u001b[38;5;241m=\u001b[39m[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mFC\u001b[39m\u001b[38;5;124m'\u001b[39m])\n", | ||
"File \u001b[1;32mc:\\Users\\s10034cb\\Dropbox (The University of Manchester)\\Manchester Postdoc\\aquacrop\\aquacrop\\entities\\crop.py:184\u001b[0m, in \u001b[0;36mCrop.__init__\u001b[1;34m(self, c_name, planting_date, harvest_date, **kwargs)\u001b[0m\n\u001b[0;32m 92\u001b[0m allowed_keys \u001b[38;5;241m=\u001b[39m {\n\u001b[0;32m 93\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mfshape_b\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m 94\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mPctZmin\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 177\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mYldFormCD\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m 178\u001b[0m }\n\u001b[0;32m 180\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__dict__\u001b[39m\u001b[38;5;241m.\u001b[39mupdate(\n\u001b[0;32m 181\u001b[0m (k, v) \u001b[38;5;28;01mfor\u001b[39;00m k, v \u001b[38;5;129;01min\u001b[39;00m kwargs\u001b[38;5;241m.\u001b[39mitems() \u001b[38;5;28;01mif\u001b[39;00m k \u001b[38;5;129;01min\u001b[39;00m allowed_keys\n\u001b[0;32m 182\u001b[0m )\n\u001b[1;32m--> 184\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate_additional_params\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", | ||
"File \u001b[1;32mc:\\Users\\s10034cb\\Dropbox (The University of Manchester)\\Manchester Postdoc\\aquacrop\\aquacrop\\entities\\crop.py:196\u001b[0m, in \u001b[0;36mCrop.calculate_additional_params\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 194\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mCC0 \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mPlantPop \u001b[38;5;241m*\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mSeedSize \u001b[38;5;241m*\u001b[39m \u001b[38;5;241m1e-8\u001b[39m\n\u001b[0;32m 195\u001b[0m \u001b[38;5;66;03m# Root extraction terms\u001b[39;00m\n\u001b[1;32m--> 196\u001b[0m SxTopQ \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mSxTopQ\u001b[49m\n\u001b[0;32m 197\u001b[0m SxBotQ \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mSxBotQ\n\u001b[0;32m 198\u001b[0m S1 \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mSxTopQ\n", | ||
"\u001b[1;31mAttributeError\u001b[0m: 'Crop' object has no attribute 'SxTopQ'" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"\n", | ||
"# locate built in weather file\n", | ||
"filepath=get_filepath('tunis_climate.txt')\n", | ||
"\n", | ||
"weather_data = prepare_weather(filepath)\n", | ||
"# print (weather_data)\n", | ||
"\n", | ||
"sandy_loam = Soil(soil_type='SandyLoam')\n", | ||
"wheat = Crop('Wheat', planting_date='09/28')\n", | ||
"test_crop_basic = Crop('custom', '10/01', PlantPop=1000, SeedSize=5)\n", | ||
"test_crop = Crop('custom',\n", | ||
" planting_date='09/28',\n", | ||
" #harvest_date='08/28',\n", | ||
" CropType=3,#\n", | ||
" # plantMethod=0,#\n", | ||
" PlantMethod=0,\n", | ||
" CalendarType=1,#\n", | ||
" p_up1=-9,#\n", | ||
" p_lo1=-9,#\n", | ||
" fshape_w1=0,#\n", | ||
" p_up2=-9,#\n", | ||
" fshape_w2=-9,#\n", | ||
" p_up3=-9,#\n", | ||
" fshape_w3=0,#\n", | ||
" p_up4=-9,#\n", | ||
" Zmax=0.5,#\n", | ||
" SxTopQ=0.048,#\n", | ||
" SxBotQ=0.012,#\n", | ||
" PlantPop=100,#\n", | ||
" CCx=1,#\n", | ||
" CDC_CD=0.01,#\n", | ||
" Determinant=1,#\n", | ||
" WP=-9,#\n", | ||
" HI0=50,#\n", | ||
" fsink=-9,#\n", | ||
" HIstartCD=1460,#\n", | ||
" FloweringCD=120,#\n", | ||
" EmergenceCD=0,#\n", | ||
" CGC_CD=-9,#\n", | ||
" YldFormCD=186,#\n", | ||
" MaxRootingCD=548,#\n", | ||
" SenescenceCD=1095,#\n", | ||
" MaturityCD=1281,#\n", | ||
" SwitchGDD=0,#\n", | ||
" p_lo2=-9,#\n", | ||
" p_lo3=-9,#\n", | ||
" p_lo4=-9,#\n", | ||
" fshape_w4=-9,#\n", | ||
" SeedSize=2.8,#\n", | ||
" YldWC = 85\n", | ||
" )\n", | ||
"\n", | ||
"InitWC = InitialWaterContent(value=['FC'])\n", | ||
"\n", | ||
"# combine into aquacrop model and specify start and end simulation date\n", | ||
"model = AquaCropModel(sim_start_time=f'{1980}/09/28',\n", | ||
" sim_end_time=f'{1982}/10/10',\n", | ||
" weather_df=prepare_weather(filepath),\n", | ||
" soil=Soil(soil_type='SandyLoam'),\n", | ||
" # crop=test_crop,\n", | ||
" crop = test_crop_basic,\n", | ||
" # crop=Crop('Wheat', planting_date='10/01'),\n", | ||
" initial_water_content=InitWC,\n", | ||
" irrigation_management=IrrigationManagement(irrigation_method=0)\n", | ||
" )\n", | ||
"\n", | ||
"model.run_model(till_termination=True)\n", | ||
"\n", | ||
"#print(model._outputs.final_stats.head())\n", | ||
"#print(model._outputs.water_flux.head())\n", | ||
"#print(model._outputs.water_storage.head())\n", | ||
"#print(model._outputs.crop_growth.head())\n", | ||
"\n", | ||
"x=model._outputs.crop_growth\n", | ||
"print (x)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "aq_test", | ||
"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.13" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.