@@ -306,67 +306,15 @@ end
306306# ## ----- UTILS ----- ###
307307# ## ----------------- ###
308308
309- function Base. show (
310- io:: IO ,
311- p:: Union {
312- ParametersP3,
313- MassPowerLaw,
314- AreaPowerLaw,
315- SlopePowerLaw,
316- SlopeConstant,
317- VentilationFactor,
318- LocalRimeDensity,
319- },
320- )
321- indent = get (io, :indent , " " )
322- prefix = get (io, :prefix , " " )
323-
324- # Get type information
325- T = typeof (p)
326- FT = eltype (p)
327- type = (FT != get (io, :typeinfo , Any)) ? " {$FT }" : " "
328-
329- # Print type name, handling nested types
330- type_name = T. name. name
331- println (io, " $(prefix)$(type_name)$type " )
332-
333- # Print each field
334- fields = fieldnames (T)
335- for (i, field) in enumerate (fields)
336- value = getfield (p, field)
337- is_last = i == length (fields)
338- prefix_char = is_last ? " └" : " ├"
339-
340- if typeof (value) <: Number
341- # Simple value - print directly with unit
342- unit = _get_parameter_unit (field)
343- println (
344- io,
345- " $(indent)$(prefix_char) ── $(field) = $(value) [$(unit) ]" ,
346- )
347- else
348- # Nested struct - recursively show with proper context
349- nested_io = IOContext (
350- io,
351- :prefix => " $(prefix_char) ── $(field) : " ,
352- :indent => " $(indent) │ " ,
353- :typeinfo => FT,
354- )
355- show (nested_io, value)
356- end
357- end
358- end
359-
360- function _get_parameter_unit (field:: Symbol )
361- units = Dict (
362- :α_va => " kg μm^(-β_va)" ,
363- :γ => " μm^(2-σ)" ,
364- :a => " m^b" ,
365- :τ_wet => " s" ,
366- :ρ_i => " kg m⁻³" ,
367- :ρ_l => " kg m⁻³" ,
368- :T_freeze => " K" ,
369- )
370- # unitless parameters: β_va, σ, b, c, μ_max, μ, aᵥ, bᵥ
371- return get (units, field, " -" )
372- end
309+ Base. show (io:: IO , mime:: MIME"text/plain" , p:: ParametersP3 ) =
310+ ShowMethods. verbose_show_type_and_fields (io, mime, p)
311+
312+ # Unit annotations for verbose show (used by ShowMethods.verbose_show_type_and_fields)
313+ ShowMethods. field_units (:: MassPowerLaw ) = (; α_va = " kg m^(-β_va)" )
314+ ShowMethods. field_units (:: AreaPowerLaw ) = (; γ = " μm^(2-σ)" )
315+ ShowMethods. field_units (:: SlopePowerLaw ) = (; a = " m^b" )
316+ ShowMethods. field_units (:: SlopeConstant ) = (;)
317+ ShowMethods. field_units (:: VentilationFactor ) = (;)
318+ ShowMethods. field_units (:: LocalRimeDensity ) = (; ρ_ice = " kg m⁻³" )
319+ ShowMethods. field_units (:: ParametersP3 ) =
320+ (; τ_wet = " s" , ρ_i = " kg m⁻³" , ρ_l = " kg m⁻³" , T_freeze = " K" )
0 commit comments