obpg_query: A basic query function to retrieve one or more datasets

Description Usage Arguments Value See Also Examples

View source: R/query.R

Description

A basic query function to retrieve one or more datasets

Usage

1
2
3
4
5
6
7
  obpg_query(top = "https://oceandata.sci.gsfc.nasa.gov/opendap/catalog.xml",
  platform = "MODISA", product = "L3SMI",
  year = format(as.Date(Sys.Date()), "%Y"),
  day = format(as.Date(Sys.Date()), "%j"), what = c("all",
  "most_recent", "within", "before", "after")[1], date_filter = NULL,
  greplargs = NULL, verbose = FALSE, userpassword = c(user = "user",
  password = "password"))

Arguments

top

character, uri of the top catalog

platform

character, the name of the platform (MODISA, MODIST, OCTS, SeaWiFS, VIIRS, etc.)

product

character, the product type (L3SMI, etc.)

year

character or numeric, four digit year(s) - ignored if what is not 'all'

day

character or numeric, three digit year of day(s) - ignored if what is not 'all'. You can improve efficiency by preselecting days for months, days, or seasons.

what

character, optional filters

  • all - return all occurences, the default, used with year and day, date_filter = NULL

  • most_recent - return only the most recent, date_filter = NULL

  • within - return the occurrences bounded by date_filter first and secomd elements

  • before - return the occurences prior to the first date_filter element

  • after - return the occurrences after the first date_filter element

date_filter

POSIXct or Date, one or two element vector populated according to the what parameter. By default NULL. It is an error to not match the value of date_filter

greplargs

list or NULL, if a list the provide two elements, pattern=character and fixed=logical, which are arguments for grepl If fixed is FALSE then be sure to provide a regex for the pattern value.

verbose

logical, by default FALSE

userpassword

character, a two element named vector with elements "user" and "password"

Value

list of DatasetRefClass or NULL

See Also

get_monthdays, get_8days and get_seasondays

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
   ## Not run: 
      query <- obpg_query(
         top = 'http://oceandata.sci.gsfc.nasa.gov/opendap/catalog.xml',
         platform = 'MODISA',
         product = 'L3SMI',
         what = 'most_recent',
         greplargs = list(pattern='8D_CHL_chlor_a_4km', fixed = TRUE))
      query <- obpg_query(
         top = 'http://oceandata.sci.gsfc.nasa.gov/opendap/catalog.xml',
         platform = 'MODISA',
         product = 'L3SMI',
         what = 'within',
         date_filter = as.POSIXct(c("2008-01-01", "2008-06-01"), format = "%Y-%m-%d"),
         greplargs = list(
            chl = list(pattern='8D_CHL_chlor_a_4km', fixed = TRUE),
            sst = list(pattern='8D_SST_sst_4km', fixed = TRUE)) )
   
## End(Not run)

BigelowLab/obpgcrawler documentation built on Nov. 6, 2019, 5:02 a.m.