tmp Documentation - GerardoLopez/TATSSI GitHub Wiki
2.1 Translator
TATSSI allows converting to/from all GDAL supported formats. This is mainly an internal module that is used to translate input files into an Cloud Optimised GeoTIFF COG which is the default internal TATSSI format. It is possible to use the Translator
module from a Python script, an example is provided on the TATSSI (Translator)[https://github.com/GerardoLopez/TATSSI/blob/master/TATSSI/notebooks/TATSSI_ImportExport.ipynb] Jupyter Notebook.
An example of how to use the module to convert the MOD13A2 EVI SubDataset product into a COG is shown below:
# Import directly the TATSSI translate module
import os
from glob import glob
from TATSSI.input_output.translate import Translate
from TATSSI.input_output.utils import *
# Set data directory
DataDir = "/home/TATSSI/data/MOD13A2.006/"
# Get all HDF files into a list
fnames = os.path.join(DataDir, '*.hdf')
fnames = glob(fnames)
# Sort the list
fnames.sort()
for fname in fnames:
# Get EVI QA SubDataset (SD) which is index 1
sds = get_subdatasets(fname)
vi_qa_sds = sds[1][0]
# Set output file
directory_name = os.path.dirname(os.path.abspath(fname))
output_fname = os.path.join(directory_name,
os.path.basename(fname)[:-3] + 'EVI.tif')
# Extract to a GeoTiff file
Translate(vi_qa_sds, output_fname, 'GTiff')
3.1 Time Series
All files available at the LP DAAC are available on a file per time step, either daily, 8-day, 16-day or monthly data. This is not the most efficient way to have the data when analyse time series where per-pixel operations for every time-step are required. Additionally, in order to process time series TATSSI requires specific metadata to set the observation/acquisition time for every time set in the time series.
Several of the MODIS and VIIRS products distributed on the LP DAAC are in HDF4 or HDF5 formats, given the hierarchical nature of these formats, this means that a single file can contain multiple subdatasets, we will referred to them as Scientific Datasets (SDS).
TATSSI will create a time series for a product where the default behaviour is:
- For every file in the data directory that matches the product selected by the user:
- Will import each band or SDS to the internal TATSSI format - Cloud Optimized GeoTiff (COG)
- For each QA layer associated to the product:
- Will import it to the internal TATSSI format and perform the QA decoding
- For each band or SDS and associated QA layers
- Will create GDAL VRTs layer stacks
3.2 Select spatial subset
TATSSI can either generate the time series for the full geographic extent or a spatial subset of the product selected. To generate a spatial subset:
- Click on the
Select spatial subset
button to show theTATSSI time series generator - Spatial Subset
window as shown in Figure 3.2.image1 - Click on the
Zoom to rectangle
button, the cursor is going to change to a cross, to select the subset, click and drag to draw a rectangle, the map will now show that spatial subset as shown in figure 3.2.image2. Click on theGet extent for subsetting
to indicate that will be the subset to use and then close the window.
3.1.3 Format | Driver | Extension
TATSSI selects the Format
and GDAL Raster Drivers using the extension
of the first file in the data directory selected by the user. It could be the case that the files do not have a consistent file name extension and corresponding format, if that is the case, select the adequate Format | Driver | Extension
.
3.2.6 Graphic controller buttons
Save the figure
Saves the current plot into a local image, e.g. PNG or JPEG file.
3.3.7 Standard anomalies
A_t = (X_t - mu_t) / std_t
4.1.10 Save QA Analytics
Saves the current selection for the selected QA definition
and corresponding QA parameter name
into a JSON file. This file can be then used to apply the same QA settings to a different time series.
4.1.13
Shows the histograms for the % of data available
and the ``Max-gap length```