main function of MODIStsp tool. Takes as input processing parameters specified by the user using MODIStsp_GUI and saved in MODIStsp_Previous.json (Interactive use), or a user specified JSON file (batch use) (See MODIStsp_main for details ) and performs all required processing.
MODIStsp_process(sel_prod, start_date, end_date, out_folder, out_folder_mod, reprocess = "Yes", delete_hdf = "No", sensor, download_server, user, password, https, ftps, start_x, start_y, end_x, end_y, bbox, out_format, compress, out_res_sel, out_res, native_res, tiled, MOD_proj_str, outproj_str, nodata_in, nodata_out, nodata_change, scale_val, scale_factor, offset, rts, datatype, bandsel, bandnames, indexes_bandsel, indexes_bandnames, indexes_formula, indexes_nodata_out, quality_bandnames, quality_bandsel, quality_bitN, quality_source, quality_nodata_in, full_ext, quality_nodata_out, file_prefixes, main_out_folder, resampling, ts_format, use_aria = TRUE, download_range = "full", gui = TRUE)
sel_prod | string selected MODIS product |
---|---|
start_date | string start_date for images download and preprocessing (yyyy.mm.dd) |
end_date | string end_date for images download and preprocessing (yyyy.mm.dd) |
out_folder | main output folder |
out_folder_mod | output folder for original HDF storage |
reprocess | string string ("Yes"/"No") If Yes, reprocess data for already existing dates (Default = 'Yes') |
delete_hdf | string ("Yes"/"No") If Yes, delete original HDF after completion |
sensor | string ("Terra" or "Aqua" or "Both") |
download_server | service used to download MODIS tiles, one of: 'http', 'ftp', NA. |
user | Username for http download (urs.earthdata.nasa.gov/home) |
password | Password for http download (urs.earthdata.nasa.gov/home) |
https | hash https site for download of HDF of selected product |
ftps | hash ftps site for download of HDF of selected product |
start_x | int start horizontal tile |
start_y | int start vertical tile |
end_x | int end horizontal tile |
end_y | int end vertical tile |
bbox | array output bounding box (xmin, xmax, ymin, ymax ) in out proj coords |
out_format | string output raster format (ENVI or GTiff) |
compress | string compression for GTiff outputs (None, LZW, DEFLATE) |
out_res_sel | string "Native" or "Resampled" |
out_res | float Output resolution (in output projection measurement unit) |
native_res | float Native resolution of MODIS product |
tiled | 0/1 1 = tiled product; 0 = non-tiled product (resolution 0.05 deg) |
MOD_proj_str | string proj4 string for MODIS product native projection |
outproj_str | string proj4 string of selected output projection |
nodata_in | array Original NoData for MODIS bands |
nodata_out | Target NoData for MODIS bands |
nodata_change | string (Yes/No) if Yes, NoData are set to nodata_out in output rasters |
scale_val | string (Yes/No) if Yes, output values in are rescaled in the measure unit of the variable |
scale_factor | scale factor to be applied to MODIS layer to convert from scaled integer to correct measure units |
offset | offset to be applied to MODIS layer to convert form scaled integer to correct measure units |
rts | string ("Yes"/"No") If Yes, create rts time series |
datatype | string array datatypes of MODIS bands |
bandsel | array of length equal to number of original modis layers. set to 1 for bands to be processed |
bandnames | array of Abbreviated Names of MODIS bands |
indexes_bandsel | array of length equal to number of available spectral indexes, set to 1 for indexes to be processed |
indexes_bandnames | array of Abbreviated Names of MODIS indexes |
indexes_formula | array of indexes formulas |
indexes_nodata_out | NoData values for indexes |
quality_bandnames | array of Names of MODIS quality indicators |
quality_bandsel | array of length equal to number of available quality indicators, set to 1 for indicators to be processed |
quality_bitN | list of strings with number of entries equal to number of quality indicators. each entry contains position of bits corresponding to a QI (e.g., 0-1) |
quality_source | list of strings which connects each quality indicator to its source aggregated quality assurance layer |
quality_nodata_in | Always 255 |
full_ext | string ("Full_Ext" or "Resized") |
quality_nodata_out | Always 255 |
file_prefixes | output file prefix according to selected product (e.g., MOD13Q1) |
main_out_folder | Suffix to add to the overall out_folder to create the out dir for the product (corresponds to an abbreviation of the selected product) |
resampling | string resampling method (near, bilinear, etc.) |
ts_format | string format of virtual files (None, ENVI Meta Files, GDAL vrt files, ENVI and GDAL) |
use_aria | logical if TRUE, then aria2c is used to accelerate download (if available !) |
download_range | character if "full", all the available images between the starting and the ending dates are downloaded; if "seasonal", only the images included in the season (e.g: if the starting date is 2005-12-01 and the ending is 2010-02-31, only the images of December, January and February from 2005 to 2010
|
gui | logical indicates if processing was called within the GUI environment or not. If not, direct processing messages to the log |
After retrieving the input processing options, the function
Accesses lpdaac http or ftp archive to determine the list of dates to be processed
Performs all required processing steps on each date (download, reprojection, resize, mosaicing, indexes computation, quality indicators computation)
Creates virtual files of the processed time series.
Reprojection and resize is dealt with by accessing gdal routines through the gdaUtils
package.
Extraction of bitfields from Quality layers is done though fast bitwise computation
Checks are done in order to not re-download already existing HDF images, and not
reprocess already processed dates (if the user did not specify that)
Thanks Tomislav Hengl and Babak Naimi, whose scripts made the starting point for development of this function (ModisDownload; Download_and_resampling_of_MODIS_images)
License: GPL 3.0