This notebook follows the fourth day of a DSSAT training course, exercise by exercise:
- Creating crop measurement files: the 1976 peanut shading study. Build its experiment file (
UFGA7609.PNX, with an environmental modification that shades the crop), write its FileA and FileT from the course’s spreadsheets (what the ATCreate tool does), and evaluate the simulation. Then the whole published study, and a sweep over when and how strongly the crop is shaded.
- Nitrogen-limited production: the maize experiment
UFGA8213.MZX with the water and nitrogen balances on, built as the exercise specifies, and its three self tests (N rate, soil type, residue and initial N).
Data. Course data in notebooks/course-data/: PN_1976_Summary.xls and PN_1976_TimeSeriesData.xls (Hang et al. 1984). From DSSAT/dssat-csm-data (BSD-3): peanut UFGA7601 and UFGA7604, maize UFGA8201, weather and soils.
engine : C:\TEMP\dsn\dssat\dscsm048.exe
csm-data : C:\Users\benny\OneDrive\Documents\Github\dssat-csm-data @ 99c95b34
1. Creating crop measurement files
A FileA holds one line per treatment of what was measured at the end of the season; a FileT holds one line per treatment and sampling date. The columns are DSSAT variable codes, defined in the engine’s DATA.CDE, and the files are fixed-format: 6 characters per column, right-aligned under the code.
The shading study’s data
The course gives the final harvest (FileA) and the growth analysis (FileT) of a control and a shaded treatment as two spreadsheets. Their header row already holds the DSSAT codes:
| 0 |
1 |
6718 |
942 |
5283 |
14240 |
0.5608 |
| 1 |
2 |
5037 |
658 |
3611 |
11431 |
0.5488 |
| 0 |
1 |
76161 |
10 |
0 |
0 |
0 |
1407 |
0.0 |
| 1 |
1 |
76168 |
28 |
0 |
0 |
0 |
2268 |
0.0 |
| 2 |
1 |
76175 |
99 |
0 |
0 |
11 |
3032 |
0.0 |
| 3 |
1 |
76182 |
362 |
0 |
0 |
69 |
4365 |
0.0 |
| 4 |
1 |
76189 |
727 |
85 |
99 |
192 |
6498 |
116.5 |
| 5 |
1 |
76196 |
1305 |
313 |
448 |
329 |
7426 |
143.1 |
| 0 |
PWAM |
Pod/Ear w kg/ha |
Pod/Ear/Panicle weight at maturity (kg [dm]/ha) |
FileA |
| 1 |
H#AM |
Number #/m2 |
Number at maturity (no/m2) |
FileA |
| 2 |
HWAM |
Mat Yield kg/ha |
Yield at harvest maturity (kg [dm]/ha) |
FileA |
| 3 |
CWAM |
Biomass kg/ha |
Biomass at maturity (total crop minus roots) (... |
FileA |
| 4 |
HWUM |
Weight g/unit |
Unit wt at maturity (g [dm]/unit) |
FileA |
| 5 |
PWAD |
Pod wt kg/ha |
Pod weight (kg [dm]/ha) |
FileT |
| 6 |
G#AD |
Grain no #/m2 |
Grain number (no/m2) |
FileT |
| 7 |
GWAD |
Grain wt kg/ha |
Grain weight (kg [dm]/ha) |
FileT |
| 8 |
P#AD |
Pod no #/m2 |
Pod number (no/m2) |
FileT |
| 9 |
CWAD |
Biomass kg/ha |
Total crop weight minus roots (kg [dm]/ha) |
FileT |
| 10 |
GWGD |
Grain wt mg |
Unit grain weight (mg [dm]/grain) |
FileT |
Building the experiment: UFGA7609.PNX
The exercise starts from the 1976 Florunner experiment UFGA7601.PNX and changes only what differs: the experiment number (9), the planting and simulation start date (22 April 1976), automatic irrigation, and a second treatment with an environmental modification: solar radiation set to 20% of normal for 21 days, from 4 to 24 August 1976, and back to normal on 25 August. The notebook makes the same edits to the text of the file, section by section, as XBuild would.
*TREATMENTS -------------FACTOR LEVELS------------
@N R O C TNAME.................... CU FL SA IC MP MI MF MR MC MT ME MH SM
1 1 0 0 CONTROL, NO SHADE 1 1 0 1 1 0 1 0 0 0 0 1 1
2 1 0 0 SHADE 20%, 4-24 AUG 1 1 0 1 1 0 1 0 0 0 1 1 1
*ENVIRONMENT MODIFICATIONS
@E ODATE EDAY ERAD EMAX EMIN ERAIN ECO2 EDEW EWIND ENVNAME
1 76217 A 0 M .20 A 0 A 0 A 0.0 A 0 A 0 A 0
1 76238 A 0 M 1 A 0 A 0 A 0.0 A 0 A 0 A 0
In the ERAD column, M .20 multiplies radiation by 0.20 from 4 August (day 217); M 1 restores it on 25 August (day 238). A modification stays in force until another one replaces it, which is why the second row is needed.
Writing the FileA and FileT
learnlib.write_observed writes both files from the spreadsheets. The engine reads them by column position, so the alignment has to be exact: a first version of this writer put every name one character to the left of its values; read back by whitespace the file looked fine, but the engine’s evaluation reported anthesis about 11,000 days after planting. Comparing the engine’s Evaluate output with the spreadsheet is the check.
*EXP.DATA (A): UFGA7609PN Environmental Modification
@TRNO PWAM H#AM HWAM CWAM HWUM
1 6718 942 5283 14240 .5608
2 5037 658 3611 11431 .5488
*EXP.DATA (T): UFGA7609PN Environmental Modification
@TRNO DATE PWAD G#AD GWAD P#AD CWAD GWGD
1 76161 10 0 0 0 1407 0
1 76168 28 0 0 0 2268 0
1 76175 99 0 0 11 3032 0
| 0 |
1 |
HWAM |
5115.0000 |
5283.0000 |
Yield at harvest maturity (kg [dm]/ha) |
0.968200 |
| 1 |
1 |
PWAM |
6438.0000 |
6718.0000 |
Pod/Ear/Panicle weight at maturity (kg [dm]/ha) |
0.958321 |
| 2 |
1 |
CWAM |
14118.0000 |
14240.0000 |
Biomass at maturity (total crop minus roots) (... |
0.991433 |
| 3 |
1 |
H#AM |
873.0000 |
942.0000 |
Number at maturity (no/m2) |
0.926752 |
| 4 |
1 |
HWUM |
0.5859 |
0.5608 |
Unit wt at maturity (g [dm]/unit) |
1.044757 |
| 5 |
2 |
HWAM |
4170.0000 |
3611.0000 |
Yield at harvest maturity (kg [dm]/ha) |
1.154805 |
| 6 |
2 |
PWAM |
5266.0000 |
5037.0000 |
Pod/Ear/Panicle weight at maturity (kg [dm]/ha) |
1.045464 |
| 7 |
2 |
CWAM |
12017.0000 |
11431.0000 |
Biomass at maturity (total crop minus roots) (... |
1.051264 |
| 8 |
2 |
H#AM |
775.0000 |
658.0000 |
Number at maturity (no/m2) |
1.177812 |
| 9 |
2 |
HWUM |
0.5381 |
0.5488 |
Unit wt at maturity (g [dm]/unit) |
0.980503 |
| 0 |
1 |
CWAD |
13 |
1168.345543 |
0.979878 |
| 1 |
1 |
G#AD |
13 |
146.599664 |
0.963029 |
| 2 |
1 |
GWAD |
13 |
447.629139 |
0.986172 |
| 3 |
1 |
GWGD |
13 |
29.257332 |
0.994307 |
| 4 |
1 |
P#AD |
13 |
127.975659 |
0.928809 |
| 5 |
1 |
PWAD |
13 |
764.970537 |
0.975743 |
| 6 |
2 |
CWAD |
4 |
506.247469 |
0.889125 |
| 7 |
2 |
G#AD |
4 |
89.262254 |
0.390711 |
| 8 |
2 |
GWAD |
4 |
503.647694 |
0.792966 |
| 9 |
2 |
GWGD |
4 |
81.832422 |
0.757863 |
| 10 |
2 |
P#AD |
4 |
43.809246 |
0.408153 |
| 11 |
2 |
PWAD |
4 |
472.626174 |
0.847008 |
The whole study, and when shade hurts most
The published experiment UFGA7604.PNX of dssat-csm-data has the full study: a control and four 21-day shade periods at 25% of normal radiation, from early in the season to pod filling. And with the shade exercise’s experiment as a template, the notebook moves a 21-day window through the season in steps of a week, at two strengths, in one FileX with one environmental-modification level per treatment.
*ENVIRONMENT MODIFICATIONS
@E ODATE EDAY ERAD EMAX EMIN ERAIN ECO2 EDEW EWIND ENVNAME
1 76154 A 0 M .25 A 0 A 0 A 0.0 A 0 A 0 A 0
1 76175 A 0 M 1 A 0 A 0 A 0.0 A 0 A 0 A 0
| 0 |
1 |
CONTROL- NO SHADE |
5034 |
13162 |
871 |
0.577839 |
5283 |
14240 |
942 |
| 1 |
2 |
21D SHADE- 154-174 |
4143 |
11742 |
842 |
0.492103 |
5344 |
13724 |
967 |
| 2 |
3 |
21D SHADE- 175-195 |
2845 |
11963 |
653 |
0.435442 |
4511 |
13143 |
795 |
| 3 |
4 |
21D SHADE- 196-216 |
2684 |
12245 |
592 |
0.453101 |
3597 |
10786 |
720 |
| 4 |
5 |
21D SHADE- 217-237 |
3975 |
11211 |
780 |
0.509775 |
3611 |
11431 |
658 |
| start |
|
|
|
| NaN |
NaN |
NaN |
5115.0 |
| 154.0 |
4527.0 |
4930.0 |
NaN |
| 161.0 |
4293.0 |
4855.0 |
NaN |
| 168.0 |
3875.0 |
4573.0 |
NaN |
| 175.0 |
3273.0 |
4225.0 |
NaN |
| 182.0 |
2540.0 |
3979.0 |
NaN |
| 189.0 |
2385.0 |
3557.0 |
NaN |
| 196.0 |
2794.0 |
3418.0 |
NaN |
| 203.0 |
3367.0 |
3612.0 |
NaN |
| 210.0 |
3964.0 |
3977.0 |
NaN |
| 217.0 |
4204.0 |
4398.0 |
NaN |
| 224.0 |
4220.0 |
4709.0 |
NaN |
| 231.0 |
4306.0 |
4805.0 |
NaN |
| 238.0 |
4593.0 |
5027.0 |
NaN |
WindowsPath('C:/Users/benny/OneDrive/Documents/Github/xdssat/docs/learn/data/module4/shade_files.csv')
2. Nitrogen-limited production: UFGA8213.MZX
The exercise builds on the water-limited maize experiment of module 3 and adds what the nitrogen balance needs:
- initial conditions measured on 25 February 1982: previous crop maize, 100 kg/ha of roots, no nodules or rhizobia, 1000 kg/ha of crop residue with 0.8% N, fully incorporated to 15 cm;
- the initial ammonium and nitrate of each soil layer (1.5 g/Mg of NH4 in the top four layers, 0.6 in the next two and 0.5 in the last two; 0.6 g/Mg of NO3 throughout), with the same soil water as before;
- water and nitrogen simulated; nitrogen fertilizer on reported dates;
- four treatments: rainfed and automatically irrigated (30 cm, 50%), each without N and with 60 kg N/ha on 15 March plus 75 kg N/ha on 12 April as ammonium nitrate, broadcast and incorporated at 10 cm.
The soil N model keeps ammonium and nitrate in every layer; they change with fertilizer, mineralization, nitrification, leaching and uptake (Soil/Inorganic_N/SOILNI.for). In the plant, CERES-Maize compares the N concentration of the tops with a critical (TCNP) and a minimum (TMNC) concentration: NFAC = 1 - (TCNP - TANC) / (TCNP - TMNC) (MZ_NFACTO.for:61).
*TREATMENTS -------------FACTOR LEVELS------------
@N R O C TNAME.................... CU FL SA IC MP MI MF MR MC MT ME MH SM
1 1 0 0 RAINFED, NO N 1 1 0 1 1 0 0 0 0 0 0 0 1
2 1 0 0 AUTO IRRIGATED, NO N 1 1 0 1 1 0 0 0 0 0 0 0 2
3 1 0 0 RAINFED, 135 KG N 1 1 0 1 1 0 1 0 0 0 0 0 1
4 1 0 0 AUTO IRRIGATED, 135 KG N 1 1 0 1 1 0 1 0 0 0 0 0 2
*INITIAL CONDITIONS
@C PCR ICDAT ICRT ICND ICRN ICRE ICWD ICRES ICREN ICREP ICRIP ICRID ICNAME
1 MZ 82056 100 0 0 0 -99 1000 .8 0 100 15 -99
@C ICBL SH2O SNH4 SNO3
1 5 0.086 1.5 0.6
1 15 0.086 1.5 0.6
1 30 0.086 1.5 0.6
1 60 0.086 1.5 0.6
1 90 0.076 0.6 0.6
1 120 0.076 0.6 0.6
1 150 0.130 0.5 0.6
1 180 0.258 0.5 0.6
*PLANTING DETAILS
@P PDATE EDATE PPOP PPOE PLME PLDS PLRS PLRD PLDP PLWT PAGE PENV PLPH SPRL PLNAME
1 82057 -99 7.2 7.2 S R 61 0 7 -99 -99 -99 -99 0 -99
*FERTILIZERS (INORGANIC)
@F FDATE FMCD FACD FDEP FAMN FAMP FAMK FAMC FAMO FOCD FERNAME
1 82074 FE001 AP002 10 60 0 0 0 0 -99 -99
1 82102 FE001 AP002 10 75 0 0 0 0 -99 -99
1 OP Y Y N N N N N Y M
1 MA R R R N M
2 OP Y Y N N N N N Y M
2 MA R A R N M
| 0 |
1 |
rainfed, no N |
547 |
2505 |
0 |
25 |
44 |
13 |
47 |
21 |
6 |
661 |
0 |
411 |
| 1 |
2 |
irrigated, no N |
882 |
2992 |
0 |
27 |
46 |
13 |
50 |
23 |
9 |
661 |
74 |
451 |
| 2 |
3 |
rainfed, 135 kg N |
2268 |
7086 |
135 |
114 |
66 |
34 |
44 |
85 |
39 |
661 |
0 |
321 |
| 3 |
4 |
irrigated, 135 kg N |
8436 |
16373 |
135 |
130 |
70 |
21 |
51 |
110 |
80 |
661 |
200 |
370 |
| TRNO |
|
|
|
|
|
|
|
| 1 |
0.60 |
20.69 |
6.41 |
15.29 |
1.05 |
4.4 |
24.95 |
| 2 |
0.58 |
23.12 |
9.66 |
15.81 |
1.01 |
4.4 |
27.18 |
| 3 |
0.05 |
92.48 |
42.56 |
92.48 |
1.74 |
4.4 |
114.08 |
| 4 |
0.60 |
109.80 |
79.61 |
102.00 |
1.27 |
4.4 |
129.81 |
Two soil organic matter models
DSSAT has two ways to simulate soil organic matter, chosen with the MESOM switch of the simulation controls: G, the original CERES approach (Godwin), and P, the CENTURY-based model (Parton). The four treatments of the exercise under both:
| model |
CENTURY (Parton) |
CERES (Godwin) |
CENTURY (Parton) |
CERES (Godwin) |
| irrigated, 135 kg N |
8097 |
8436 |
33 |
51 |
| irrigated, no N |
368 |
882 |
29 |
50 |
| rainfed, 135 kg N |
2600 |
2268 |
24 |
44 |
| rainfed, no N |
250 |
547 |
27 |
47 |
Self test 1: the response to the N rate
0, 50, 100, 150 and 200 kg N/ha in total, in the two applications of the exercise (in the same 60:75 proportion), rainfed and automatically irrigated.
| rate |
|
|
| 0 |
882 |
547 |
| 50 |
3195 |
1374 |
| 100 |
6205 |
2309 |
| 150 |
9140 |
2161 |
| 200 |
10389 |
1530 |
Self test 2: three soils
The four treatments on a clay, a silt loam and a sand from the generic profiles of the soil file (the deep ones, 210 cm), next to the Millhopper fine sand. For those three soils the initial soil water is rebuilt at 100% of their plant-available range (ic_water=1.0); ammonium and nitrate keep the exercise’s values by depth.
| soil |
|
|
|
|
| Millhopper fine sand |
8436 |
882 |
2268 |
547 |
| deep sand |
8392 |
351 |
4773 |
301 |
| deep silt loam |
11875 |
2837 |
4466 |
2091 |
| deep silty clay |
12752 |
5599 |
11352 |
5161 |
Self test 3: residue and initial nitrogen
The fertilized treatments (3 and 4) with the crop residue, its N content and the initial nitrate changed one at a time, through the initial-conditions columns ICRES, ICREN and SNO3 (the nitrate value is then the same in every layer).
| scenario |
|
|
| 3000 kg/ha residue |
8821 |
2303 |
| NO3 10 g/Mg in every layer |
8541 |
2290 |
| NO3 3 g/Mg in every layer |
8462 |
2306 |
| as in the exercise |
8436 |
2268 |
| no residue |
8233 |
2310 |
| residue 0.4% N |
8270 |
2289 |
| residue 1.6% N |
8684 |
2326 |
Nitrogen fixation in a legumeGrain legumes add a source of nitrogen that cereals lack: symbiotic fixation by root nodules. CROPGRO growsnodules when the crop’s nitrogen demand exceeds what roots take up from the soil and mobilize from old tissue,and the nodules fix nitrogen at a rate set by their mass and by temperature, the crop’s water status, flooding,nodule age and the carbohydrate they receive (Plant/CROPGRO/NFIX.for). The SYMBI switch in the simulation controls turns fixation on or off.Bragg soybean at Gainesville in 1978 (UFGA7801.SBX, a sandy soil without fertilizer), with the nitrogen balanceon and fixation on or off, and with the nitrogen balance off for comparison:
| 0 |
no fixation |
irrigated |
75 |
119 |
9 |
0 |
39.0 |
| 1 |
no fixation |
rainfed |
85 |
146 |
10 |
0 |
36.0 |
| 2 |
fixation |
irrigated |
2806 |
5988 |
14 |
276 |
34.0 |
| 3 |
fixation |
rainfed |
1088 |
3363 |
10 |
180 |
33.0 |
| 4 |
nitrogen not limiting |
irrigated |
2849 |
6016 |
0 |
0 |
NaN |
| 5 |
nitrogen not limiting |
rainfed |
1115 |
3400 |
0 |
0 |
NaN |
3. Things to try
- Write your own FileT for a field you know: one row per sampling date, the codes from
DATA.CDE.
- In the shade sweep, find the 21 days when shade costs most. What is the crop doing then?
- Move all the nitrogen of treatment 4 to planting. What happens to leaching and to yield?
| engine |
C:\TEMP\dsn\dssat\dscsm048.exe |
| csm_data_commit |
99c95b340acb9515c2d0a8ab582f5fbbf076f345 |
| csm_os_commit |
25c93b9a2f73f8ec45bf441b198dac5fb7b22849 |
| run_on |
2026-11-07 10:53 |
Back to top