Codes for calculation of temporal correlations in model-data differences, creating and fitting mathematical models, and cross-validating the fits.
The functions of the mathematical models are of the following form:
They may take on one of the functional forms in the following section.
The last term is there to account for possibly-correlated instrumental noise, expected to vanish within a few hours.
The second-to-last term is there to model any correlations not accounted for by the other terms.
It seems to play the role of constant offset in many cases.
Baseline, used to explore behavior when that part of the function is absent. Identically zero for the daily and annual cycles, and identically one for the annual modulation of the daily cycle.
Used in CarbonTracker-Lagrange, which has a three-hourly time step with correlations from one day to the next but none from any period within a day to another within the same day. I want to use hourly data, so I linearly interpolate between the three-hourly values that gives.
This form was inspired by the "Periodic" kernel in scikit-learn.
This form has one parameter,
A three-term cosine series, re-parameterized to always be one at zero:
This form has two parameters,
The installation process generates the code for a Cython extension names flux_correlation_function_fits
, with function names like
dc_dmp_ad_fit_ne
or d0_dm0_ac_curve_loop
.
The fit
or curve
just before the end of the name describe whether the function returns a correlogram for the given times (curve
), or the fit of the correlogram to a provided correlogram.
The ne
and loop
at the end describe whether the function is entirely in Cython, or passes the actual work to numexpr.
Numexpr tends to be faster, but the Cython version also returns the derivative of the curve with respect to the various parameters.
The first three groups of letters describe which functional form is used to describe the daily cycle, annual modulation of the daily cycle, and annual cycle.
For each part, 0
denotes the "Nothing" form, d
for "Decoupled", p
for the exponential of a squared sine, and c
for the three-term cosine series.