ConvertRS2Stack: Convert a set of MODIS images to a raster stack and,...

Description Usage Arguments Details Value See Also Examples

View source: R/RS_get.R

Description

ConvertRS2Stack takes a set of pre-processed MODIS TIF files and creates a raster stack and, optionally, a NetCDF file.

Usage

1
2
3
4
ConvertRS2Stack(inPath, matchStr, begin = NULL, end = NULL,
  noData = NULL, noDataQual = "exact", valScale = 1, valAdd = 0,
  outFile = NULL, varName = NULL, varUnit = NULL, varLong = NULL,
  varNA = (-1e+36), 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").

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).

noData

Value for specifying "no data" per the MODIS product. Should be combined with a qualifier. For example, for the MOD15A2 (LAI) product, valid value range is 0-100. So the noData value should be set to 100 and the noDataQual to "max". (DEFAULT=NULL, no additional "no data" screening is applied)

noDataQual

Qualifier for specifying "no data" per the MODIS product. Should be combined with a nodata value. For example, for the MOD15A2 LAI product, valid value range is 0-100. So the noData value should be set to 100 and the noDataQual to "max". Options are: "exact" (value == noData are converted to NA), "min" (value < noData are converted to NA), "max" (value > noData are converted to NA). (DEFAULT="exact", only exact matches are converted to NA)

valScale

The scale factor to apply to the image values per the MODIS product. The adjustment is applied as VALUE * valScale + valAdd. For example, for the MOD15A2 LAI product, the scale factor is 0.1. (DEFAULT = 1)

valAdd

The addition value to apply to the image values per the MODIS product. The adjustment is applied as VALUE * valScale + valAdd. (DEFAULT = 0)

outFile

OPTIONAL name for an output NetCDF file. A NetCDF file will only be created if this file name is provided. Images will be exported after the "no data" and scale adjustments are made. If you want to do smoothing or other time series processing, do not export a NetCDF file here but do processing on the raster stack and then use ConvertStack2NC to export the processed brick to a NetCDF file.

varName

Name for the NetCDF export variable. Only required if outFile is provided.

varUnit

Units for the NetCDF export variable. Only required if outFile is provided.

varLong

Long name for the NetCDF export variable. Only required if outFile is provided.

varNA

Value to set for "NA" or "no data". Default is -1.e+36. Only required if outFile is provided.

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 is "%Y%j" ('YYYYDDD'). Read ?as.Date for for more information.

Details

ConvertRS2Stack scans the specified directory and imports pre-processed MODIS TIF files matching the specified expression and combines them into an R raster stack object and, optionally, an output NetCDF file. Files in the input directory should be already processed through the GetMODIS tool or follow the same file naming convention used by the MODIS runGdal tool. See the R MODIS package for more on those specifications.

Value

A raster stack.

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Import the already processed LAI TIF images into a raster stack. Use 
## the full time series of images.

## Not run: 
lai.b <- ConvertRS2Stack("/d6/adugger/WRF_Hydro/RS/MODIS_ARC/PROCESSED/BCNED_LAI",
                         "*Lai_1km.tif", noData=100, noDataQual="max", 
                         valScale=0.1, valAdd=0)

## Export a subset of the already processed LAI TIF images into an output netcdf file

lai.b <- ConvertRS2Stack("/d6/adugger/WRF_Hydro/RS/MODIS_ARC/PROCESSED/BCNED_LAI", 
                         "*Lai_1km.tif", begin="2011.06.01", end="2011.06.30", 
                         noData=100, noDataQual="max", valScale=0.1, valAdd=0, 
                         outFile="BCNED_LAI.nc", varName="LAI",
                         varUnit="(m^2)/(m^2)", varLong="Leaf area index")

## End(Not run)

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