mt_batch_subset: Batch download MODIS Land Products subsets

View source: R/mt_batch_subset.R

mt_batch_subsetR Documentation

Batch download MODIS Land Products subsets

Description

Lists all available dates for a MODIS Land Products Subset product at a particular location.

Usage

mt_batch_subset(
  df,
  product,
  band,
  start = "2000-01-01",
  end = format(Sys.time(), "%Y-%m-%d"),
  km_lr = 0,
  km_ab = 0,
  out_dir = tempdir(),
  internal = TRUE
)

Arguments

df

a CSV file or data frame holding locations and their sitenames to batch process with column names site_name, lat, lon holding the respective sitenames, latitude and longitude. When providing a CSV make sure that the data are comma separated.

product

a valid MODIS product name

band

band to download

start

start date

end

end date

km_lr

km left-right to sample

km_ab

km above-below to sample

out_dir

location where to store all data

internal

should the data be returned as an internal data structure TRUE or FALSE (default = TRUE)

Value

A data frame combining meta-data and actual data values, data from different sites is concatenated into one large dataframe. Subsets can be created by searching on sitename.

See Also

mt_sites mt_dates mt_bands mt_products mt_subset

Examples


## Not run: 
# create data frame with a site_name, lat and lon column
# holding the respective names of sites and their location
df <- data.frame("site_name" = paste("test",1:2))
df$lat <- 40
df$lon <- -110

print(df)

# test batch download
subsets <- mt_batch_subset(df = df,
                        product = "MOD11A2",
                        band = "LST_Day_1km",
                        internal = TRUE,
                        start = "2004-01-01",
                        end = "2004-03-31")

# the same can be done using a CSV file with
# a data structure similar to the dataframe above

write.table(df, file.path(tempdir(),"my_sites.csv"),
 quote = FALSE,
 row.names = FALSE,
 col.names = TRUE,
 sep = ",")

# test batch download form CSV
subsets <- mt_batch_subset(df = file.path(tempdir(),"my_sites.csv"),
                        product = "MOD11A2",
                        band = "LST_Day_1km",
                        internal = TRUE,
                        start = "2004-01-01",
                        end = "2004-03-31"
                        )

head(subsets)

## End(Not run)

MODISTools documentation built on Sept. 17, 2023, 1:07 a.m.