-
Notifications
You must be signed in to change notification settings - Fork 1
4.9 tile.R
Mateusz Żółtak edited this page Oct 16, 2019
·
4 revisions
Retiles and reprojects rasters into the target grid.
Can work with data from both rawDir
and periodsDir
(see [configuration and storage](2-Configuration and storage)).
A standard set of configFilePath
, regionName
, startDate
and endDate
.
Reads data from both rawDir
and/or periodsDir
and stores results into the tilesDir
.
Output files date/period and band name simply follow input files ones.
This step is pretty CPU intensive, especially if more advances resampling methods are used.
-
tileSkipExisting
should already existing output tiles be skipped (TRUE
) or reprocessed anyway (FALSE
). -
gridFile
path to the file storing the target tiling grid. It must be in a format supported by thesf::read_sf
R function (e.g. shapefile, geojson, kml). Tiles must be features and every tile must have a distinctTILE
property value. The projection of this file determines the output data projection. -
tileRawBands
vector of bands from therawDir
to be processed, e.g.c('NDVI', 'B03')
. -
tilePeriodBands
a named list describing data from theperiodsDir
to be processed.- Name of every list element defines a period. Period definition consists of a number and a period type name (
day
,month
oryear
), e.g.1 year
or10 days
. Period type name can be also provided in plural, e.g.2 months
,1 years
,10 days
. - Every list element value is a vector of band names to be processed for a given period kind, e.g.
c('NDVIq05', 'NDVIq50', 'NDVIq98')
.
- Name of every list element defines a period. Period definition consists of a number and a period type name (
-
tileResamplingMethod
resampling method to be used for reprojection - see the gdalwarp documentation. -
tileGdalOpts
command line options to be passed to the gdalwarp, e.g. ones specyfying output files compression. A good default should be--config GDAL_CACHEMAX 1024 -co "COMPRESS=DEFLATE" -co "TILED=YES" -co "BLOCKXSIZE=512" -co "BLOCKYSIZE=512"
For example a configuration retiling:
- bands
TCI
andB03
from therawDir
, - monthly bands
NDVI
, andDoyMaxNDVI
, - yearly bands
NDVI2q05
,NDVI2q50
andNDVI2q98
can look as follows:
tileSkipExisting = TRUE
tileRawBands = c('TCI', 'B03')
tilePeriodBands = list(
'1 month' = c('NDVI', 'DoyMaxNDVI'),
'1 year' = c('NDVI2q05', 'NDVI2q50', 'NDVI2q98')
)
tileResamplingMethod = 'near'
tileGdalOpts = '--config GDAL_CACHEMAX 1024 -co "COMPRESS=DEFLATE" -co "TILED=YES" -co "BLOCKXSIZE=512" -co "BLOCKYSIZE=512"'