To install and run DSSAT-Pythia on your PC, you will need the following software:
-
DSSAT:
Download and install DSSAT from DSSAT website. -
Python 3.8:
Download the Python 3.8 installer for Windows or macOS from Python 3.8 release page.- During installation, select “Customize installation.”
- Select all options under “Optional Features” and “Advanced Options.”
- Note: DSSAT-Pythia only works with Python 3.8. If you have another version, uninstall it and download Python 3.8 from the above link.
-
Git:
Download and install Git from Git download page. -
Community Version of Visual Studio:
Download and install Visual Studio from Visual Studio website.
Select the Desktop development with C++ workload during installation. -
RStudio:
To use RStudio on your PC, install both R and RStudio:- Download and install R from CRAN website.
- Download and install RStudio from RStudio website.
-
Enable Developer Mode:
- Open Windows Settings > Update & Security > For Developers.
- Switch on Developer Mode and restart the computer.
-
Open the Command Prompt in the C Drive:
- Open the C drive and type
cmd
in the address bar and press Enter.
- Open the C drive and type
-
Clone the DSSAT-Pythia repository:
git clone https://github.com/dssat/pythia.git pythia
-
Navigate to the cloned directory:
cd pythia
-
Delete the
poetry.lock
file:del poetry.lock
-
Install Poetry:
pip install poetry
-
Install DSSAT-Pythia:
<full path to poetry>\poetry install <full path to poetry>\poetry build
-
Install the Pythia wheel file:
- Navigate to the
dist
folder and install the.whl
file:cd dist pip install pythia-2.2.1-py3-none-any.whl
- Note: Check the version in the
dist
folder and adjust the command if necessary.
- Navigate to the
-
Add the path to
pythia.exe
to your environment variables. -
Close the command prompt.
- If you encounter any issues during installation, delete the folder
C:\pythia
and repeat the installation steps.
-
Download the
InputFiles.zip
folder from Google Drive link, unzip it, and save theSimulation_Data
folder inC:\pythia\
. -
Open the folder
C:\pythia\Simulation_Data\OUTPUT\Sri_Lanka
and remove all folders (if any).Note: Remove the contents from the
OUTPUT
folder every time you run the model.
-
Open the command prompt at
C:\pythia\Simulation_Data\Sri_Lanka
by typingcmd
in the folder address bar. -
Run the following commands to simulate maize and rice:
pythia --all C:/pythia/Simulation_Data/Sri_Lanka/SL_Maize.json pythia --all C:/pythia/Simulation_Data/Sri_Lanka/SL_Rice.json
-
To view the output:
- Open the
.json
file inC:\pythia\Simulation_Data\Sri_Lanka\
. - Find the working directory in
"workDir": "C:/pythia/Simulation_Data/OUTPUT/Sri_Lanka/…"
and navigate to that folder. - The output will be available in
.csv
format.
- Open the
-
Open the R code file:
C:\pythia\Simulation_Data\OUTPUT\ACASA_Sri_Lanka_maize.R
. -
Install all required packages and modify the file location on line 22 to match the output
.csv
file. -
Run the R script to generate the yield plot.
-
The plot will be saved at the location specified in line 62.
Note: If you encounter errors reading the
.csv
file, open the file and delete all columns exceptLATITUDE
,LONGITUDE
, andHWAH
.