EPIC Model Simulation Tutorial
This notebook demonstrates how to use the EPIC model with the geoEpic package.
- If the package is installed in a conda environment, activate it in commond prompt with
- Set up a GeoEPIC workspace using
- Start a Jupyter notebook inside the workspace folder
Follow the below lines of code
Import the required classes from geoEpic
First create a Site
object with the necessary input files.
site = Site(opc = './opc/files/umstead.OPC',
dly = './weather/NCRDU.DLY',
sol = './soil/files/umstead.SOL',
sit = './sites/umstead.SIT')
print(site.site_id)
Define the EPICModel class
Now Let's create an EPICModel
object and specify the start date, duration of the simulation.
model = EPICModel('./model/EPIC1102.exe')
model.start_date = '2015-01-01'
model.duration = 5
model.output_types = ['ACY']
Run the model simulations at the required site
model.run(site)
# Close the model instance
model.close()
# Path to output files is stored in the site.outputs dict
site.outputs
- EPICModel instance can also be created using a configuration file. Example config file:
- This method allows for easier management of model parameters.
Using EPICModel class with Configuration File
model = EPICModel.from_config('./config.yml')
model.run(site)
model.close()
#using with context
with EPICModel.from_config('./config.yml') as model:
model.run(site)
Examine the outputs
Finally, examine the outputs generated by the model run.
index | YR | CPNM | YLDG | |
---|---|---|---|---|
0 | 0 | 2015 | CORN | 7.175 |
1 | 1 | 2016 | CORN | 4.735 |
2 | 2 | 2017 | CORN | 9.072 |
3 | 3 | 2018 | CORN | 7.829 |
4 | 4 | 2019 | CORN | 5.434 |
Plot the simulated Leaf Area Index