Description Usage Arguments Details Value Author(s) See Also Examples
MRTSwath is the "MODIS Reprojection Tool for swath products". See: https://lpdaac.usgs.gov/tools/modis_reprojection_tool_swath).
1 2 | run_swath2grid_mod09nrt(mrtpath = "swath2grid", prmfn = "tmpMRTparams.prm",
tifsdir, modfn, geoloc_fn, ul_lon, ul_lat, lr_lon, lr_lat)
|
mrtpath |
This is the path to the MRTSwath executable |
prmfn |
The name of the parameter/control file which will be the input to MRTSwath's |
tifsdir |
The directory to save the output TIF files in |
modfn |
The filename of the MODIS data |
geoloc_fn |
The filename of the corresponding geolocation file (annoyingly, this is a much larger file than the data file!) |
ul_lon |
Upper left (ul) longitude (x-coordinate) for subsetting |
ul_lat |
Upper left (ul) latitude (y-coordinate) for subsetting |
lr_lon |
Lower right (lr) longitude (x-coordinate) for subsetting |
lr_lat |
Lower right (lr) latitude (y-coordinate) for subsetting |
If you want this function to use MRTSwath tool successfully, you should
add the directory with the MRTSwath executable to the default R PATH
by editing ~/.Rprofile
.
cmdstr
The string giving the system command that ran swath2grid
Nicholas J. Matzke matzke@berkeley.edu
write_MRTSwath_param_file_mod09nrt
http://landweb.nascom.nasa.gov/cgi-bin/QA_WWW/newPage.cgi?fileName=hdf_filename @cite NASA2001
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | #######################################################
# Run MRTSwath tool "swath2grid"
#######################################################
# Source MODIS files (both data and geolocation)
# Code excluded from CRAN check because it depends on modiscdata
## Not run:
library(devtools)
library(modiscdata)
moddir = system.file("extdata/2002raw/", package="modiscdata")
# Get the matching data/geolocation file pairs
fns_df = check_for_matching_geolocation_files(moddir, modtxt="MOD09", geoloctxt="MOD03")
fns_df
# Resulting TIF files go in this directory
tifsdir = getwd()
# Box to subset
ul_lat = 13
ul_lon = -87
lr_lat = 8
lr_lon = -82
for (i in 1:nrow(fns_df))
{
prmfn = write_MRTSwath_param_file_mod09nrt(prmfn="tmpMRTparams.prm", tifsdir=tifsdir,
modfn=fns_df$mod09_fns[i], geoloc_fn=fns_df$mod03_fns[i], ul_lon=ul_lon, ul_lat=ul_lat,
lr_lon=lr_lon, lr_lat=lr_lat)
print(scan(file=prmfn, what="character", sep="\n"))
run_swath2grid_mod09nrt(mrtpath="swath2grid", prmfn="tmpMRTparams.prm", tifsdir=tifsdir,
modfn=fns_df$mod309_fns[i], geoloc_fn=fns_df$mod03_fns[i], ul_lon=ul_lon, ul_lat=ul_lat,
lr_lon=lr_lon, lr_lat=lr_lat)
}
list.files(tifsdir, pattern=".tif", full.names=TRUE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.