ropensci/tidync

string length dimension

Closed this issue · 2 comments

These are confusing as it's about a char length, not a number of elements

The print could be less confusing.

test.zip

tidync("test.nc")

Data Source (1): test.nc ...

Grids (3) <dimension family> : <associated variables> 

[1]   D0 : z, z_WODflag, z_sigfig, Temperature, Temperature_sigfigs, Temperature_WODflag, Salinity, Salinity_sigfigs, Salinity_WODflag, Oxygen, Oxygen_sigfigs, Oxygen_WODflag, Phosphate, Phosphate_sigfigs, Phosphate_WODflag    **ACTIVE GRID** ( 12  values per variable)
[2]   D1 : country, WOD_cruise_identifier, originators_cruise_identifier, Platform, Institute, Wave_Direction, Wind_Direction, Weather_Condition, dataset, dbase_orig, Oxygen_Original_units, Phosphate_Original_units
[3]   S  : wod_unique_cast, lat, lon, time, date, GMT_time, Access_no, Orig_Stat_Num, Bottom_Depth, Wind_Speed, Barometric_Pres, Dry_Bulb_Temp, Wet_Bulb_Temp, Temperature_WODprofileflag, Salinity_WODprofileflag, Oxygen_WODprofileflag, Phosphate_WODprofileflag, crs, WODf, WODfp, WODfd

Dimensions (2): 
  
  dim      id name    length   min   max active start count  dmin  dmax unlim coord_dim 
  <chr> <dbl> <chr>    <dbl> <dbl> <dbl> <lgl>  <int> <int> <dbl> <dbl> <lgl> <lgl>     
1 D0        0 z           12     0   989 TRUE       1    12     0   989 FALSE TRUE      
2 D1        1 strnlen    200     1   200 FALSE      1   200     1   200 FALSE FALSE   

file from @cboettig

download.file("https://github.com/cboettig/scratch/releases/download/data/wod_000410903O.nc", "test.nc", mode = "wb")
    2 dimensions:
        z  Size:12
            standard_name: altitude
            long_name: depth_below_sea_level
            units: m
            positive: down
        strnlen  Size:200

Resolved with #77 - the string length is a dimension.

download.file("https://github.com/cboettig/scratch/releases/download/data/wod_000410903O.nc", "test.nc", mode = "wb")
library(tidync)
tidync("test.nc")
#> 
#> Data Source (1): test.nc ...
#> 
#> Grids (3) <dimension family> : <associated variables> 
#> 
#> [1]   D0 : z, z_WODflag, z_sigfig, Temperature, Temperature_sigfigs, Temperature_WODflag, Salinity, Salinity_sigfigs, Salinity_WODflag, Oxygen, Oxygen_sigfigs, Oxygen_WODflag, Phosphate, Phosphate_sigfigs, Phosphate_WODflag    **ACTIVE GRID** ( 12  values per variable)
#> [2]   D1 : country, WOD_cruise_identifier, originators_cruise_identifier, Platform, Institute, Wave_Direction, Wind_Direction, Weather_Condition, dataset, dbase_orig, Oxygen_Original_units, Phosphate_Original_units
#> [3]   S  : wod_unique_cast, lat, lon, time, date, GMT_time, Access_no, Orig_Stat_Num, Bottom_Depth, Wind_Speed, Barometric_Pres, Dry_Bulb_Temp, Wet_Bulb_Temp, Temperature_WODprofileflag, Salinity_WODprofileflag, Oxygen_WODprofileflag, Phosphate_WODprofileflag, crs, WODf, WODfp, WODfd
#> 
#> Dimensions (2, 1 active): 
#>   
#>   dim      id name  length   min   max active start count  dmin  dmax unlim 
#>   <chr> <dbl> <chr>  <dbl> <dbl> <dbl> <lgl>  <int> <int> <dbl> <dbl> <lgl> 
#> 1 D0        0 z         12     1   200 TRUE       1    12     1   200 FALSE 
#> # … with 1 more variable: coord_dim <lgl> 
#>   
#> 
#>   
#>   dim      id name    length   min   max active unlim coord_dim 
#>   <chr> <dbl> <chr>    <dbl> <dbl> <dbl> <lgl>  <lgl> <lgl>     
#> 1 D1        1 strnlen    200     0   989 FALSE  FALSE FALSE

tidync("test.nc") %>% hyper_tibble()
#> # A tibble: 12 x 15
#>        z z_WODflag z_sigfig Temperature Temperature_sig… Temperature_WOD…
#>    <dbl>     <int>    <int>       <dbl>            <int>            <int>
#>  1     0         0        1       16.8                 4                0
#>  2    20         0        2       16.8                 4                0
#>  3    50         0        2       16.5                 4                0
#>  4    75         0        2       16.1                 4                0
#>  5   100         0        3       15.5                 4                0
#>  6   150         0        3       14.2                 4                0
#>  7   200         0        3       13.2                 4                0
#>  8   281         0        3       11.5                 4                0
#>  9   396         0        3        9.78                3                0
#> 10   593         0        3        5.81                3                0
#> 11   796         0        3        4.01                3                0
#> 12   989         0        3        3.41                3                0
#> # … with 9 more variables: Salinity <dbl>, Salinity_sigfigs <int>,
#> #   Salinity_WODflag <int>, Oxygen <dbl>, Oxygen_sigfigs <int>,
#> #   Oxygen_WODflag <int>, Phosphate <dbl>, Phosphate_sigfigs <int>,
#> #   Phosphate_WODflag <int>


tidync("test.nc") %>% activate("D1") %>% hyper_tibble()
#> # A tibble: 200 x 13
#>    country WOD_cruise_iden… originators_cru… Platform Institute
#>    <chr>   <chr>            <chr>            <chr>    <chr>    
#>  1 S       Z                2                S        D        
#>  2 O       A                0                A        E        
#>  3 U       0                0                R        P        
#>  4 T       0                1                D        T        
#>  5 H       0                /                I        " "      
#>  6 " "     0                0                N        O        
#>  7 A       5                0                O        F        
#>  8 F       4                5                P        " "      
#>  9 R       Z                6                S        C        
#> 10 I       A                2                " "      O        
#> # … with 190 more rows, and 8 more variables: Wave_Direction <chr>,
#> #   Wind_Direction <chr>, Weather_Condition <chr>, dataset <chr>,
#> #   dbase_orig <chr>, Oxygen_Original_units <chr>,
#> #   Phosphate_Original_units <chr>, strnlen <int>

Created on 2019-02-28 by the reprex package (v0.2.1)