@@ -82,35 +82,39 @@ and temperature always in °C.
8282
8383## Function arguments
8484
85- Most functions of ` Bigleaf.jl ` require a DataFrame, from which the required
86- variables are extracted. This is usually the first argument of a function.
87- Most functions further provide default values for their arguments,
88- such that in many cases it is not necessary to provide them explicitly.
89-
90- The column names in the DataFrame should correspond to the argument names
91- of the corresponding method that accespts each input individually.
92-
93- Methods are usually provided with two forms:
94- - all required scalar inputs as positional arguments with outputing a NamedTuple
95- - a mutating DataFrame with columns corresponding to required inputs
96- where the output columns are added or modified.
85+ ` Bigleaf.jl ` usually provides functions in two flavours.
86+ - providing all arguments seperately as scalars and output being a single scalar
87+ or a NamedTuple
88+ - providing a DataFrame as first argument with columns corresponding to the inputs and
89+ ouput being the in-place modified DataFrame. Most keyword arguments
90+ accept both, vectors or scalars.
91+ The column names in the DataFrame should correspond to the argument names
92+ of the corresponding method with individual inputs.
9793
9894We can demonstrate the usage with a simple example:
9995
10096``` @example doc
10197# explicit inputs
10298Tair, pressure, Rn, = 14.81, 97.71, 778.17
103- potential_ET(Tair, pressure, Rn, Val(:PriestleyTaylor))
99+ potential_ET(Val(:PriestleyTaylor), Tair, pressure, Rn)
100+
104101# DataFrame
105102potential_ET!(copy(tha), Val(:PriestleyTaylor))
103+
106104# DataFrame with a few columns overwritten by user values
107105potential_ET!(transform(tha, :Tair => x -> 25.0; renamecols=false), Val(:PriestleyTaylor))
106+
108107# varying one input only: scalar form with dot-notation
109108Tair_vec = 10.0:1.0:20.0
110- DataFrame(potential_ET.(Tair_vec, pressure, Rn, Val(:PriestleyTaylor) ))
109+ DataFrame(potential_ET.(Val(:PriestleyTaylor), Tair_vec, pressure, Rn))
111110nothing # hide
112111```
113112
113+ For functions operating only on vectors, e.g. [ ` roughness_parameters ` ] ( @ref ) vectors
114+ are provided with the individual inputs. Sometimes, an additional non-mutating DataFrame
115+ variant is provided for convenience, however, the output value of this variant is
116+ not type-stable.
117+
114118## Ground heat flux and storage fluxes
115119
116120Many functions require the available energy ($A$), which is defined as ($A = R_n - G - S$,
@@ -463,16 +467,18 @@ evapotranspiration (PET). At the moment, the `Bigleaf.jl` contains two formulati
463467for the estimate of PET: the Priestley-Taylor equation, and the Penman-Monteith equation:
464468
465469``` @example doc
466- potential_ET!(thas, Val(:PriestleyTaylor); G = thas.G, infoGS = false)
467- # TODO need aerodynamci and surface conductance to compute Ga and Gs_mol before
468- # potential_ET!(thas, Val(:PenmanMonteith); G = thas.G,
469- # Gs_pot=quantile(skipmissing(thas.Gs_mol),0.95))
470- select(thas[24:26,:], :datetime, :ET_pot, :LE_pot)
470+ potential_ET!(thas, Val(:PriestleyTaylor); G = thas.G)
471+
472+ # aerodynamic Ga_h and surface conductance Gs_mol must be computed before
473+ potential_ET!(thas, Val(:PenmanMonteith); G = thas.G,
474+ Gs_pot=quantile(skipmissing(thas.Gs_mol),0.95))
475+ thas[24:26, Cols(:datetime, :ET_pot, :LE_pot)]
471476```
472477
473478In the second calculation it is important to provide an estimate of aerodynamic
474- conductance Ga and `` Gs_{pot} `` , the potential surface conductance under optimal conditions.
475- Here, we have approximated `` Gs_{pot} `` with the `` 95^{\text{th}} `` percentile of all
479+ conductance, `` G_a `` , and the potential surface conductance under optimal conditions,
480+ `` G_{s pot} `` .
481+ Here, we have approximated `` G_{s pot} `` with the `` 95^{\text{th}} `` percentile of all
476482`` G_s `` values of the site.
477483
478484
0 commit comments