From 75aed33118385d539d83e75b5037d34db93730f5 Mon Sep 17 00:00:00 2001 From: Marco Matthies <71844+marcom@users.noreply.github.com> Date: Fri, 6 Sep 2024 19:05:33 +0200 Subject: [PATCH] Add Base.show() method for ALMaSS.CropCurveParams --- src/crop/almass.jl | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/crop/almass.jl b/src/crop/almass.jl index 9c62406..45de95a 100644 --- a/src/crop/almass.jl +++ b/src/crop/almass.jl @@ -59,6 +59,30 @@ struct CropCurveParams height::Dict{GrowthPhase,Vector{Length{Float64}}} end +function Base.show(io::IO, ::MIME"text/plain", curve::CropCurveParams) + println(io, "CropCurveParams") + println(io, " curveID = $(curve.curveID)") + println(io, " highnutrients = $(curve.highnutrients)") + for (dict, name) in [ + (curve.GDD, "GDD"), + (curve.LAItotal, "LAItotal"), + (curve.LAIgreen, "LAIgreen"), + # (curve.height, "height"), + ] + println(" $name:") + for (phase, arr) in dict + println(" $phase = $arr") + end + end + # Manually print height array for each phase so that we avoid the + # lengthy type information before printing the array. + println(" height:") + for (phase, arr) in curve.height + arrstr = "[" * join(split(string(arr), "[")[2:end], "[") + println(" $phase = $arrstr") + end +end + """ CropType -- GitLab