(input file "dk-soil.dai")
(input file "tillage.dai")
(input file "fertilizer.dai")
(input file "crop.dai")
(input file "dk-management.dai")
(input file "log-std.dai")

(defreaction MyReact Python
  "Use Python for chemical reaction."
  (module "daisy-react") ; Must match python filename
  (soil "charles") ; Must match function name in python file

  ;; Soil input parameters.
  (in (NO3 M_total "NO3")) ;; Chemical!
  (texture ("clay" 2 [um])
	   ("below50" 50 [um]))
  (extra Theta z)
  ;; Soil output parameters.
  (out (CO2 none)
       (NO3 primary "NO3"))
)

(defchemistry MyChem N
  (reaction MyReact nitrification))

(defprogram Base Daisy
  "This is the stuff all scenarios have in common."
  (time 1978 1 1)
  (stop 1990 1 1)
  (output ("Field nitrogen" (when daily))))

;; We want to optimize for the temperature offset.
(defweather Normal table (file "dk-taastrup.dwf"))
(defweather Weather Normal (TempOffset {temp_offset} [dg C]))

;; We test three different soils: Askov, Jyndevad, Foulum.
;; These are defined in dk-soil.dai.

;; The Foulum column has no groundwater defined.
(defcolumn FoulumD Foulum (Groundwater deep))

;; We test one management "SBarley w. catch crop"
;; It is defined in dk-management.dai.

(defprogram askov Base "Askov scenario"
            (weather Weather)
            (column (Askov (Chemistry multi (combine DOM MyChem))))
            (manager "SBarley w. catch crop")
            (activate_output (after 1989 1 1)))

(defprogram jyndevad Base "Jyndevad scenario"
            (weather Weather)
            (column (Jyndevad (Chemistry multi (combine DOM MyChem))))
            (manager "SBarley w. catch crop")
            (activate_output (after 1989 3 1)))

(defprogram foulum Base "Foulum scenario"
            (weather Weather)
            (column (FoulumD (Chemistry multi (combine DOM MyChem))))
            (manager "SBarley w. catch crop")
            (activate_output (after 1989 6 1)))

;; Now, run them all.

(defprogram all spawn
  (program askov jyndevad foulum))

(run all)

;;; test-spawn.dai ends her.
