As of version 1.8, SPLITS comes with a C/C++ API to enable users to write their own programs for analyzing time series. The API’s implementation can be found in the source files splits.h and splits.cpp in the SPLITS tarball. Using the API to fit spline models to time series and doing phenological calculations involves the following steps:
- Creating a domain to describe a temporal axis for the spline model, including the number of observations, their days of year (DOY), start and end date.
- Creating a spline by fitting it to a given domain using a set of observations.
- After it is fitted successfully, the spline or any of its derivatives can be evaluated within a given domain, or phenological parameters can be calculated for every year covered by the domain.
Phenological calculations come in a so called Pheno_set which includes the 26 phenological parameters defined in SPLITS for a given season. Pheno Sets for all the seasons of a given time series are mapped to their appropriate year.
An example program to illustrate the various steps, source code, the input file, and a basic Makefile example can be found in the installation’s share folder (e.g. /usr/local/share/splits). Note that all API functionality is defined in the namespace splits.
To compile source code using the SPLITS API, link in the API’s static library and the linear algebra support library (armadillo) with a command like:
g++ testapi.cpp -lsplits -larmadillo