GapFillRS: Gap fill a series of MODIS images using interpolation.

Description Usage Arguments Details Value See Also Examples

View source: R/RS_get.R

Description

GapFillRS takes a set of pre-processed MODIS TIF files and fills no-data gaps using interpolation.

Usage

1
2
3
GapFillRS(inPath, matchStr, outDir, begin = NULL, end = NULL,
  maskFile = NULL, maskVals = NULL, nodataVal = -9999,
  scriptPath = NULL, pos1 = 10, pos2 = 16, format = "%Y%j")

Arguments

inPath

The path to the directory that holds the already processed MODIS TIF files.

matchStr

The regular expression for filename matching (e.g., "*Lai_1km.tif").

outDir

Pathname to the directory to store the output files.

begin

Date string for the start date to include. The date string should follow MODIS package convention (e.g., "2011.06.01"). (DEFAULT=NULL, all files are processed).

end

Date string for the end date to include. The date string should follow MODIS package convention (e.g., "2011.06.01"). (DEFAULT=NULL, all files are processed).

maskFile

Mask grid file. File must be in a GDAL-friendly format and should match the dimensions and resolution of the inputs.

maskVals

List of value sets to pull from mask file and convert. The list should be in the form: list("maskValue"=outputValue), e.g., list("1"=0, "16"=0) to convert all cells in the mask grid with mask values of 1 and 16 to 0 in the output files.

nodataVal

Value to use to represent no data. Make sure this value is NOT in your mask raster. (DEFAULT=-9999)

scriptPath

OPTIONAL path to where gdal_calc.py script lives in case it is not in the same default path as gdal executables

pos1

From MODIS orgTime: Start position of date in the filename (DEFAULT=10).

pos2

From MODIS orgTime: End position of date in the filename (DEFAULT=16).

format

From MODIS orgTime: How is the date formatted in the file, default expects: YYYYDDD (%Y%j). Read ?as.Date for for more information.

Details

GapFillRS scans the specified directory and runs the GDAL python script gdal_fillnodata.py. If a mask file is provided, GapFillRS will convert specified mask cells to specified values AFTER the gap-filling.

Value

null

See Also

Other MODIS: CalcStatsRS, ConvertRS2Stack, ConvertStack2NC, GetMODIS, InsertRS, SmoothStack

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Gap fill a set of MODIS LAI images. We will convert all non-vegetation 
## land use types into 0.

## Not run:  
maskVals <- list("1"=0, "16"=0, "19"=0, "23"=0, 
                 "24"=0, "25"=0, "26"=0, "27"=0)
GapFillRS("~/wrfHydroTestCases/MODIS_ARC/PROCESSED/FOURMILE_LAI",
                         outDir="~/wrfHydroTestCases/MODIS_ARC/PROCESSED/FOURMILE_LAI_GAPFILL",
                         matchStr="*Lai_1km.tif", 
                         begin="2013.05.01", end="2013.07.31", 
                         maskFile="~/wrfHydroTestCases/Fourmile_Creek/DOMAIN/geo_LUINDEX.tif",
                         maskVals=maskVals)

## End(Not run)

mccreigh/rwrfhydro documentation built on Feb. 28, 2021, 1:53 p.m.