library(tidync)
f <- system.file("extdata", "unidata", "madis-hydro.nc", package = "tidync")
## grid D1,D12 has 4 variables
(tnc <- tidync(f) %>% activate("D1,D12"))
##
## Data Source (1): madis-hydro.nc ...
##
## Grids (13) <dimension family> : <associated variables>
##
## [1] D0,D12 : rawMessage
## [2] D1,D12 : dataProvider, handbook5Id, stationId, stationType **ACTIVE GRID** ( 12936 values per variable)
## [3] D10,D9 : staticIds
## [4] D2,D12 : providerId
## [5] D3,D12 : stationName
## [6] D4,D12 : homeWFO
## [7] D5,D12 : precip12hrQCD, precip1hrQCD, precip24hrQCD, precip3hrQCD, precip5minQCD, precip6hrQCD, precipAccumQCD
## [8] D6,D5 : QCT
## [9] D8,D7 : ICT
## [10] D11 : firstInBin, lastInBin
## [11] D12 : elevation, invTime, isOverflow, latitude, longitude, numericWMOid, observationTime, precip12hr, precip12hrDD, precip12hrICA, precip12hrICR, precip12hrQCA, precip12hrQCR, precip1hr, precip1hrDD, precip1hrICA, precip1hrICR, precip1hrQCA, precip1hrQCR, precip24hr, precip24hrDD, precip24hrICA, precip24hrICR, precip24hrQCA, precip24hrQCR, precip3hr, precip3hrDD, precip3hrICA, precip3hrICR, precip3hrQCA, precip3hrQCR, precip5min, precip5minDD, precip5minICA, precip5minICR, precip5minQCA, precip5minQCR, precip6hr, precip6hrDD, precip6hrICA, precip6hrICR, precip6hrQCA, precip6hrQCR, precipAccum, precipAccumDD, precipAccumICA, precipAccumICR, precipAccumQCA, precipAccumQCR, prevRecord, receivedTime, reportTime, riverFlow, riverReportChangeTime, riverStage
## [12] D9 : inventory, lastRecord
## [13] S : filterSetNum, firstOverflow, globalInventory, nStaticIds
##
## Dimensions (13):
##
## dimension id name length unlim coord_dim active start
## <chr> <dbl> <chr> <dbl> <lgl> <lgl> <lgl> <int>
## 1 D1 1 maxStaIdLen 11 FALSE FALSE TRUE 1
## 2 D12 12 recNum 1176 TRUE FALSE TRUE 1
## 3 D0 0 maxLDADmessageLen 256 FALSE FALSE FALSE 1
## 4 D2 2 maxProviderIdLen 12 FALSE FALSE FALSE 1
## 5 D3 3 maxNameLength 51 FALSE FALSE FALSE 1
## 6 D4 4 maxHomeWFOlen 4 FALSE FALSE FALSE 1
## 7 D5 5 QCcheckNum 10 FALSE FALSE FALSE 1
## 8 D6 6 QCcheckNameLen 60 FALSE FALSE FALSE 1
## 9 D7 7 ICcheckNum 55 FALSE FALSE FALSE 1
## 10 D8 8 ICcheckNameLen 72 FALSE FALSE FALSE 1
## 11 D9 9 maxStaticIds 2000 FALSE FALSE FALSE 1
## 12 D10 10 totalIdLen 24 FALSE FALSE FALSE 1
## 13 D11 11 nInventoryBins 24 FALSE FALSE FALSE 1
## # ... with 1 more variables: count <int>
## but we only want 2
tnc %>% hyper_tibble(select_var = c("handbook5Id", "stationType"))
## # A tibble: 1,176 x 4
## handbook5Id stationType recNum nInventoryBins
## <chr> <chr> <int> <int>
## 1 alert_r5 1 1
## 2 alert_r5 2 1
## 3 alert_r5 3 1
## 4 alert_r5 4 1
## 5 alert_r5 5 1
## 6 alert_r5 6 1
## 7 alert_r5 7 1
## 8 alert_r5 8 1
## 9 alert_r5 9 1
## 10 alert_r5 10 1
## # ... with 1,166 more rows
## without select_var we get all variables
## (as well as all dimension coordinates)
tnc %>% hyper_tibble()
## # A tibble: 1,176 x 6
## stationId handbook5Id stationType dataProvider recNum nInventoryBins
## <chr> <chr> <chr> <chr> <int> <int>
## 1 CRTC2 alert_r5 UDFCD 1 1
## 2 RALC2 alert_r5 UDFCD 2 1
## 3 CRPC2 alert_r5 UDFCD 3 1
## 4 BMTC2 alert_r5 UDFCD 4 1
## 5 NICC2 alert_r5 UDFCD 5 1
## 6 LEYC2 alert_r5 UDFCD 6 1
## 7 LCNC2 alert_r5 UDFCD 7 1
## 8 LECC2 alert_r5 UDFCD 8 1
## 9 VABC2 alert_r5 UDFCD 9 1
## 10 GHRC2 alert_r5 UDFCD 10 1
## # ... with 1,166 more rows
## currently there's no way to avoid expanding the dimension coordinates
## except by using hyper_slice directly