huss = dplyr::filter(params, id == 'maca_month', variable == 'huss')


cropped = dap_crop(catolog = huss,
                    AOI = AOI::aoi_get(state = "IA"),
                    startDate = "2010-01-01",
                    endDate = "2010-12-31",
                   verbose = FALSE)

glimpse(cropped)
#> Rows: 40
#> Columns: 31
#> $ grid.id     <chr> "167", "167", "167", "167", "167", "167", "167", "167", "1…
#> $ id          <chr> "maca_month", "maca_month", "maca_month", "maca_month", "m…
#> $ URL         <chr> "http://thredds.northwestknowledge.net:8080/thredds/dodsC/…
#> $ tiled       <chr> "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T"…
#> $ variable    <chr> "huss", "huss", "huss", "huss", "huss", "huss", "huss", "h…
#> $ varname     <chr> "specific_humidity", "specific_humidity", "specific_humidi…
#> $ long_name   <chr> "Daily Mean Near-Surface Specific Humidity", "Daily Mean N…
#> $ units       <chr> "kg kg-1", "kg kg-1", "kg kg-1", "kg kg-1", "kg kg-1", "kg…
#> $ model       <chr> "NorESM1-M", "CCSM4", "IPSL-CM5A-LR", "bcc-csm1-1-m", "MRI…
#> $ ensemble    <chr> "r1i1p1", "r6i1p1", "r1i1p1", "r1i1p1", "r1i1p1", "r1i1p1"…
#> $ scenario    <chr> "rcp45", "rcp45", "rcp45", "rcp45", "rcp45", "rcp45", "rcp…
#> $ T_name      <chr> "time", "time", "time", "time", "time", "time", "time", "t…
#> $ duration    <chr> "2005-12-20/2099-10-27", "2005-12-20/2099-10-27", "2005-12…
#> $ interval    <chr> "1 months", "1 months", "1 months", "1 months", "1 months"…
#> $ nT          <int> 1128, 1128, 1128, 1128, 1128, 1128, 1128, 1128, 1128, 1128…
#> $ Tdim        <dbl> 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13…
#> $ startDate   <dttm> 2010-01-01, 2010-01-01, 2010-01-01, 2010-01-01, 2010-01-0…
#> $ endDate     <dttm> 2011-01-01, 2011-01-01, 2011-01-01, 2011-01-01, 2011-01-0…
#> $ X_name      <chr> "lon", "lon", "lon", "lon", "lon", "lon", "lon", "lon", "l…
#> $ Y_name      <chr> "lat", "lat", "lat", "lat", "lat", "lat", "lat", "lat", "l…
#> $ X1          <dbl> -96.64761, -96.64761, -96.64761, -96.64761, -96.64761, -96…
#> $ Xn          <dbl> -90.14772, -90.14772, -90.14772, -90.14772, -90.14772, -90…
#> $ Y1          <dbl> 40.39617, 40.39617, 40.39617, 40.39617, 40.39617, 40.39617…
#> $ Yn          <dbl> 43.52112, 43.52112, 43.52112, 43.52112, 43.52112, 43.52112…
#> $ resX        <dbl> 0.04166599, 0.04166599, 0.04166599, 0.04166599, 0.04166599…
#> $ resY        <dbl> 0.041666, 0.041666, 0.041666, 0.041666, 0.041666, 0.041666…
#> $ ncols       <dbl> 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157…
#> $ nrows       <dbl> 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76…
#> $ proj        <chr> "+proj=longlat +a=6378137 +f=0.00335281066474748 +pm=0 +no…
#> $ toptobottom <lgl> TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE…
#> $ tile        <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
system.time({
 sequential = dap_get(dap = cropped)
})
#>    user  system elapsed 
#>   1.251   0.861  32.968
library(future)
plan(multisession, workers = 7)

system.time({
  ms = dap_get(cropped)
})
#>    user  system elapsed 
#>   2.813   0.425  27.013