What is It?
When a periodic time dependent data set, such as NDVI, is decomposed into sum of sinusoidal functions, the procedure is called Harmonic ANalysis of Time series (HANTS) or Fourier Analysis. At the end, one can obtain phase and amplitudes, which can be used for further processing and analyzing of the data set.
Moving data from time or space into frequency domain may be done for various reasons. The main advantage of this is that it becomes much easier to study how the data is varying based on different frequencies. However, my focus here is on the three applications:
- Smoothing the data and removing the outliers,
- Gap filling or obtaining the missing data,
- Data compression.
How to perform HANTS?
The goal in this step is to find a set of coefficients which shows the contribution of each sine or cosine function in reconstructing the original data set. There are various method to obtain this. Here, the coefficients are obtained through least square curve fitting method, based on the algorithm/software provided on:
The NLR HANTS, freely available to download from above link, calculates the Fourier series coefficients while filtering out the outliers. This software originally was developed to remove the cloud effect in various remote sensing applications and perform temporal interpolation to obtain a gapless data set when there is no satellite image or product available. However, it can be also used to perform data compression.
The software is about 2MB and freely available to download. However, the software is available in executable (binary) format. As more and more students, scientists, and researchers are using MATLAB these days, it was decided to also provide the MATLAB version of the main function, i.e. the HATNS itself.
MATLAB version of HANTS?
The MATLAB version of HANTS is the exact translation of the original FORTRAN code developed by prof. Wout Verhoef to MATLAB m-file. The only difference is that the sort and matrix inversion available in MATLAB are used instead of the ranking and the inversion algorithm used in the FORTRAN code. A sample output of the MATLAB version is shown below.
There are four MATLAB files available:
- HANTS.m: which calculates amplitude, phase, and the smoothed data for a single time series.
- ApplyHANTS.m: which calls HANTS for each pixel of a data set assuming the input data set has the dimension of [time,lat,lon].
- ReconHANTSData.m: receives the amplitude and phase and reconstructs the smoothed time series.
- ReconstructImage.m: receives the amplitude and phase and reconstructs the spatial data set assuming that both phase and amplitude have the dimension of [nf+1,lat,lon], where nf is the number of frequencies above zero frequency, one of the inputs of HANTS.m.
The figure below shows smoothed and gap filled land surface temperature provided through MODIS products.
Once it is decided to use the smoothed data set, it is possible to perform data compression. The entire data sets can be reconstructed by knowing only the phase and the amplitudes. In above figure only three frequencies above zero frequency was used. This means to reconstruct the red line, i.e. the data that we want to use, only 4 amplitudes and 3 phase are needed, i.e. 7 numbers, while the entire time series consist of 366 numbers for one year. This means a compression rate of 52.3. This can be very beneficial for spatial data. As an example a MODIS tile with 1200X1200 pixels and one year of daily data consists of 527.04 data entry. If this many elements are about to be stored as floating points one needs 2011MB, whereas storing only the phases and amplitudes requires only 38 MB. This is a huge reduction of data volume. Yet, it is still possible to use one of the compression programs (gzip, rar) to further compress the file.
NOTE: In order to obtain the MATLAB version of HANTS algorithm, you can either download it from here or send me an e-mail.