xdssat
A bridge between the DSSAT crop model and Python: from one field to a whole region
DSSAT’s Cropping System Model is a Fortran program that grows a crop one day at a time from text files: an experiment file, daily weather, soil profiles and crop coefficients (Jones et al. 2003). It is usually driven by the DSSAT shell, a set of Windows tools for writing those files and reading the results.
xdssat puts Python in the place of the shell. It writes the engine’s own input files, runs the unmodified dscsm048 executable and reads what it writes back into tables. Nothing in the model is reimplemented, so a result from xdssat is a result from DSSAT. What Python adds is what the shell does not do easily: thousands of simulations at once, inputs prepared from gridded data, and every step written down as code that can be rerun.

| What the DSSAT shell does | What xdssat does instead |
|---|---|
| XBuild writes an experiment file | filex.build_filex writes one with a treatment per field, grid cell or scenario |
| WeatherMan imports and checks weather | wth.write_wth and wth.read_wth, with pandas for the checks |
| SBuild builds soil profiles | sol.SoilProfile and soils.saxton_rawls, from soil maps as well as from soil sheets |
| The cultivar file is edited by hand | genotype.write_cultivar_files writes per-run copies with changed coefficients |
| One run at a time from the shell | runner.run_engine and runner.run_units, in parallel chunks |
| Results in text output files | Tables, and CF netCDF maps for gridded runs (outputs.py) |
Three ways through this site
1. What xdssat is
How a field-scale model becomes a map: one simulation per weather cell and water regime, inputs prepared from netCDF and GeoTIFF, chunked parallel runs of the stock engine, and gridded output. With the implementation of every script and a setup guide.
2. A real case: rice in Java
xdssat applied to an island: simulated rice seasons over Java for 1991-2020, checked against district statistics. What fits, what does not, and how it was calibrated. Five more case studies, maize after rice in East Java, millet in Niger, maize in Kenya and rice in the Mekong Delta and northern Luzon, each ask a question of their own.
3. DSSAT itself, through xdssat
The case studies use a small part of DSSAT. Six training modules, adapted from the International Training Program on DSSAT, explore the rest: phenology, growth, weather and soils, calibration, water and nitrogen, seasonal risk and crop rotations. Each has a reading page and a notebook that runs the real engine.
The Java case study in one chart
Simulated and observed rice yield for Java, current calibrated run (), weighted by district rice area:
Level (simulated over observed), spatial correlation of district means r = . The story explains what that means.
Rebuilding
Numbers on the pages are read from small data files, never typed in. The rebuild notes say how to refresh them after a new run or a rerun notebook.
References
Jones, J. W., G. Hoogenboom, C. H. Porter, et al. 2003. “The DSSAT Cropping System Model.” European Journal of Agronomy 18 (3–4): 235–65. https://doi.org/10.1016/S1161-0301(02)00107-7.