├── COEF2Final.py
├── Doc
└── ch1: About HANTS.md
├── HANTS-GEE user manual - V1.0.pdf
├── figures
├── GUI.png
├── readme.txt
├── sample_case.png
├── sample_case.svg
└── sample_case1.png
└── readme.rst
/COEF2Final.py:
--------------------------------------------------------------------------------
1 | ###With HANTS method, the cloud contaminated NDVI time series from earth observation can be reconstructed.
2 | #The HANTS had been implemented on GEE, and coeficients of harminics can be retrived from GEE. After donloaded,
3 | #these images of haimonic coeficients needed to be further processed to produce time series of NDVI images with
4 | #given intevals by users.
5 | #this processing is defined to generate NDVI images based on given images of harmonic coeficients.
6 | import rasterio as rio
7 | import concurrent.futures
8 | import numpy as np
9 | #import matplotlib.pyplot as plt
10 | def tranform(coefArr,ts):
11 |
12 | # coefArr = params[0]
13 | #ts = params[1]
14 | print(typeof(params))
15 | print(params[1].shape)
16 | nHarms = int((coefArr.shape[0]-1)/2.0)
17 | ni = len(ts)
18 |
19 | mat = 2*np.pi*np.r_[np.arange(nHarms-1)+1,[0.5]].reshape(nHarms,1)*ts.reshape(1,ni)/(ni)
20 | #ind=np.array([i for i in zip(np.arange(nHarms),np.arange(nHarms)+nHarms)]).reshape(2*nHarms)
21 |
22 | cosMat = np.cos(mat)
23 | sinMat = np.sin(mat)
24 | mat1 = np.vstack((cosMat,sinMat))#[ind,:]
25 | mat1 = np.vstack((np.ones(ni),mat1))
26 | result = mat1.T.dot(coefArr.reshape(nHarms*2+1,coefArr.shape[1]*coefArr.shape[2])).reshape(ni,coefArr.shape[1],coefArr.shape[2])
27 |
28 | return (result*10000).astype(np.int16)
29 |
30 |
31 |
32 | def COEF2Final(coefFile, outfile, intervals, date):
33 | num_workers = 4
34 | with rio.Env():
35 | with rio.open(coefFile) as src:
36 | #harmCoef = src.read(1)
37 |
38 | period = 365.0
39 | ts = np.arange(0,period//interval+1)
40 | profile = src.profile
41 | profile.update(blockxsize=512, blockysize=512, tiled=True,count = len(ts),dtype = "int16")
42 |
43 | nHarms = int((src.count-1)/2.0)
44 | ni = len(ts)
45 |
46 | mat = 2*np.pi*np.r_[np.arange(nHarms-1)+1,[0.5]].reshape(nHarms,1)*ts.reshape(1,ni)/(ni)
47 | #ind=np.array([i for i in zip(np.arange(nHarms),np.arange(nHarms)+nHarms)]).reshape(2*nHarms)
48 |
49 | cosMat = np.cos(mat)
50 | sinMat = np.sin(mat)
51 | mat1 = np.vstack((cosMat,sinMat))#[ind,:]
52 | mat1 = np.vstack((np.ones(ni),mat1))
53 |
54 |
55 |
56 |
57 | with rio.open(outfile, "w", **profile) as dst:
58 | windows = [window for ij, window in dst.block_windows()]
59 | data_gen = (src.read(window=window) for window in windows)
60 |
61 | for window in windows:
62 | coefArr = next(data_gen)
63 | result = mat1.T.dot(coefArr.reshape(nHarms*2+1,coefArr.shape[1]*coefArr.shape[2])).reshape(ni,coefArr.shape[1],coefArr.shape[2])
64 | result = (result*10000).astype(np.int16)
65 | dst.write(result, window=window)
66 | #print(next(data_gen).shape)
67 |
68 |
69 | harmCoefFile = "China_MODIS_NDVI_5kmm_2014_COEF1.tif"
70 | outfile = "Global_2014_5km_hants_daily.tif"
71 | interval = 1
72 | date ='2014-01-01'
73 | #COEF2Final(harmCoefFile,outfile,interval,date)
74 | harmCoefFile=input("Enter the HANTS coeficent file:")
75 | print(harmCoefFile)
76 | outfile=input("Enter the fullpath of output file:")
77 | print(outfile)
78 | interval=input("Enter the interval(days) of output:")
79 | print(outfile)
80 | date=input("Enter the start date of output (YYYY-MM-DD):")
81 | print(outfile)
82 | COEF2Final(harmCoefFile,outfile,interval,date)
83 |
--------------------------------------------------------------------------------
/Doc/ch1: About HANTS.md:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/HANTS-GEE user manual - V1.0.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jiezhou87/HANTS-GEE/92716b9cd413a10b3c40c5ac5f791a3cf905f854/HANTS-GEE user manual - V1.0.pdf
--------------------------------------------------------------------------------
/figures/GUI.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jiezhou87/HANTS-GEE/92716b9cd413a10b3c40c5ac5f791a3cf905f854/figures/GUI.png
--------------------------------------------------------------------------------
/figures/readme.txt:
--------------------------------------------------------------------------------
1 | Some relevant figures
2 |
--------------------------------------------------------------------------------
/figures/sample_case.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jiezhou87/HANTS-GEE/92716b9cd413a10b3c40c5ac5f791a3cf905f854/figures/sample_case.png
--------------------------------------------------------------------------------
/figures/sample_case.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/figures/sample_case1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jiezhou87/HANTS-GEE/92716b9cd413a10b3c40c5ac5f791a3cf905f854/figures/sample_case1.png
--------------------------------------------------------------------------------
/readme.rst:
--------------------------------------------------------------------------------
1 | ====
2 | HANTS-GEE
3 | ====
4 | This repository aims to introduce the `HANTS-GEE `_ (Latest update: 25/09/2024) package, **a scalable implimentation of HANTS for time sereis reconstruction in remote sensing on Google Earth Engine platform**.
5 |
6 | The **Harmonic ANalysis of Time Series (HANTS)** was proposed by Verheof (1996) and Menenti et al. (1993)
7 | to reconstruct time series of remote sensing products such as NDVI and LAI.
8 | The algorithm had been widely used in the remote sensing community and implemented
9 | in Fortran, IDL/ENVI, Matlab, C, and Python.
10 | The script in this file aim to implement the HANTS in GEE, which can avoid
11 | donwloading large volume dataset to local PC and also make full use of the
12 | powerfull computation resource of GEE.
13 |
14 | Main features:
15 | - Complete HANTS kernel implementation
16 | - Scalable reconstrction tasks (spatiotemporal extent & resolution).
17 | - Processing result can be export to google drive as well as Assets for
18 | further analysis.
19 | - TO speed up the exporting and downloading, one can choose to export final
20 | harmonic coefficient and then construct final image series in local PC.
21 | .. figure:: figures/GUI.png
22 | :width: 800
23 | :alt: Grapical User Interface for HANTS-GEE
24 | :class: with-border
25 |
26 | *Figure 1. Grapical User Interface for HANTS-GEE*
27 |
28 | .. figure:: figures/sample_case1.png
29 | :width: 800
30 | :alt: A reconstrction case with HANTS-GEE
31 | :class: with-border
32 |
33 | *Figure 2. Pixel-level time series reconstruciton with HANTS-GEE. Gray dots represent quality assessment (QA) value for observation (MODIS-NDVI: 0- Good Data, 1- Marginal Data, 2- Snow/Ice, 3- Cloudy. Red squres indicate valid observations identified by HANTS-GEE and other observations are outliers.*
34 |
35 | Attentions:
36 | - If you want to export the result for large area with high spatial reolution
37 | and long-time series, better to seperate the region in different parts and
38 | export it one by one. Otherwise, it will take a long time to processing or
39 | even failed.
40 | - The maixum storage space provide by Google Drive with free account is 15 GB,
41 | please check your left space before exporting result.
42 |
43 |
44 | ****
45 | Usage of the packages
46 | ****
47 |
48 | The HANTS-GEE package is freely avaliable `here `_ (Latest update: 25/09/2024).
49 |
50 | Contact: Dr. Jie Zhou (zhou.j@ccnu.edu.cn), Central China Normal University, Wuhan, P.R. China
51 |
52 | ****
53 | Usefull references
54 | ****
55 |
56 | [1] Menenti, M, S Azzali, W Verhoef, and R Van Swol. 1993. “Mapping Agroecological Zones and Time Lag in Vegetation Growth by Means of Fourier Analysis of Time Series of NDVI Images.” Advances in Space Research 13 (5). Elsevier: 233–237.
57 |
58 | [2] Roerink, GJ, Massimo Menenti, and Wout Verhoef. 2000. “Reconstructing Cloudfree NDVI Composites Using Fourier Analysis of Time Series.” International Journal of Remote Sensing 21 (9). Taylor & Francis: 1911–1917.
59 |
60 | [3] Verhoef, W. 1996. Application of Harmonic Analysis of NDVI Time Series (HANTS). Fourier Analysis of Temporal NDVI in the Southern African and American Continents. DLO Winand Staring Centre, Wageningen, The Netherlands.
61 |
62 | [4] Zhou, Jie, Li Jia, and Massimo Menenti. 2015. “Reconstruction of Global MODIS NDVI Time Series: Performance of Harmonic ANalysis of Time Series (HANTS).” Remote Sensing of Environment 163. Elsevier: 217–228.
63 |
64 | [5] Zhou, Jie, Li Jia, Massimo Menenti, and Ben Gorte. 2016. “On the Performance of Remote Sensing Time Series Reconstruction Methods–A Spatial Comparison.” Remote Sensing of Environment 187: 367–384.
65 |
66 | [6] Zhou, Jie, Li Jia, Massimo Menenti, and Xuan Liu. 2021. “Optimal Estimate of Global Biome—Specific Parameter Settings to Reconstruct NDVI Time Series with the Harmonic ANalysis of Time Series (HANTS) Method.” Remote Sensing 13 (21). Multidisciplinary Digital Publishing Institute: 4251.
67 |
68 | [7] Zhou, J., Menenti, M., Jia, L., Gao, B., Zhao, F., Cui, Y., Xiong, X., Liu, X. and Li, D., 2023. A scalable software package for time series reconstruction of remote sensing datasets on the Google Earth Engine platform. International Journal of Digital Earth, 16(1), pp.988-1007. `https://doi.org/10.1080/17538947.2023.2192004 `_
69 |
--------------------------------------------------------------------------------