## Not run: ------------------------------------
# # single variable dataset
# ## You can pass in the outpu of a call to erddap_info
# (out <- erddap_info('noaa_esrl_027d_0fb5_5d38'))
# (res <- erddap_grid(out,
# time = c('2012-01-01','2012-06-12'),
# latitude = c(21, 18),
# longitude = c(-80, -75)
# ))
# ## Or, pass in a dataset id
# (res <- erddap_grid(x='noaa_esrl_027d_0fb5_5d38',
# time = c('2012-01-01','2012-06-12'),
# latitude = c(21, 18),
# longitude = c(-80, -75)
# ))
#
# # multi-variable dataset
# (out <- erddap_info('noaa_gfdl_5081_7d4a_7570'))
# (res <- erddap_grid(out,
# time = c('2005-11-01','2006-01-01'),
# latitude = c(20, 21),
# longitude = c(10, 11)
# ))
# (res <- erddap_grid(out, time = c('2005-11-01','2006-01-01'), latitude = c(20, 21),
# longitude = c(10, 11), fields = 'uo'))
# (res <- erddap_grid(out, time = c('2005-11-01','2006-01-01'), latitude = c(20, 21),
# longitude = c(10, 11), fields = 'uo', stride=c(1,2,1,2)))
# (res <- erddap_grid(out, time = c('2005-11-01','2006-01-01'), latitude = c(20, 21),
# longitude = c(10, 11), fields = c('uo','so')))
# (res <- erddap_grid(out, time = c('2005-09-01','2006-01-01'), latitude = c(20, 21),
# longitude = c(10, 11), fields = 'none'))
#
# # multi-variable dataset
# ## this one also has a 0-360 longitude system, BLARGH!!!
# (out <- erddap_info('noaa_gfdl_3c96_7879_a9d3'))
# (res <- erddap_grid(out,
# time = c('2005-11-01','2006-01-01'),
# latitude = c(20, 22),
# longitude = c(-80, -75)
# ))
# (res <- erddap_grid(out,
# time = c('2005-11-01','2006-01-01'),
# latitude = c(20, 22),
# longitude = c(-80, -75),
# depth = c(5, 50)
# ))
#
# # Write to memory (within R), or to disk
# (out <- erddap_info('noaa_pfeg_e9ae_3356_22f8'))
# ## disk, by default (to prevent bogging down system w/ large datasets)
# ## you can also pass in path and overwrite options to disk()
# (res <- erddap_grid(out,
# time = c('2012-06-01','2012-06-12'),
# latitude = c(20, 21),
# longitude = c(-80, -75),
# store = disk()
# ))
# ## the 2nd call is much faster as it's mostly just the time of reading in the table from disk
# system.time( erddap_grid(out,
# time = c('2012-06-01','2012-06-12'),
# latitude = c(20, 21),
# longitude = c(-80, -75),
# store = disk()
# ) )
# system.time( erddap_grid(out,
# time = c('2012-06-01','2012-06-12'),
# latitude = c(20, 21),
# longitude = c(-80, -75),
# store = disk()
# ) )
#
# ## memory
# (res <- erddap_grid(out,
# time = c('2012-06-01','2012-06-12'),
# latitude = c(20, 21),
# longitude = c(-80, -75),
# store = memory()
# ))
## ---------------------------------------------
Run the code above in your browser using DataLab