ropensci/tidync

Reported dimension values confused?

Closed this issue · 10 comments

Hey Michael, I'm having a problem with a NetCDF where the print() summary attributes the ranges of values to the wrong dimension:

Data Source (1): ghcndex-txx-ann-global-ts.nc ...

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

[1]   D2,D1,D0 : TXx    **ACTIVE GRID** ( 714816  values per variable)
[2]   D0       : time
[3]   D1       : lat
[4]   D2       : lon

Dimensions 3 (all active):

  dim   name  length   min    max start count  dmin   dmax unlim coord_dim
  <chr> <chr>  <dbl> <dbl>  <dbl> <int> <int> <dbl>  <dbl> <lgl> <lgl>
1 D0    time      68  -180   178.     1    68  -180   178. FALSE TRUE
2 D1    lat       73   -90    90      1    73   -90    90  FALSE TRUE
3 D2    lon      144     0 24472      1   144     0 24472  FALSE TRUE

Here, the lengths of the three dimensions (time, lat and lon) are all correct, but the min, max, dmin and dmax columns appear to be swapping values between time and lon.

This seems to be limited to the printing, AFAICT—I can filter on these dimensions totally fine and export to a tibble, and the values in the tibble are associated with the right dimensions (or columns, in the tibble). I've also verified that the dimensions appear correctly labelled in Panoply.

(I haven't tested this with other .nc files yet—but the one I'm using is only 3 MB, so I can provide it if required!)

This is happening with a rocker image (rocker/tidyverse:3.5.1) with tidync v. 0.1.0 installed.

Oops thanks, will check in a few days

Actually, could you please share the file ghcndex-txx-ann-global-ts.nc? I thought I could reproduce with another file, but no.

Pretty sure it's now fixed, thanks! Could you try this branch:

remotes::install_github("hypertidy/tidync@fix-print")

(I don't want to work in master while the rOpenSci review is still pending, and this is a bit flakier than I'm comfortable about!)

Yep, this all looks good in @fix-print! Would you still like me to share the file?

Yes please - I'll put it in my collection! https://github.com/mdsumner/rasterwise

And thanks!

No worries! Are there any licence conditions about submitting it that I should be aware of?

Nope, if you'll share it on github then it's in the same status as all the others

Lemme run it by someone first, but I'll share it if I can 🙂

Don't worry if it's a hassle!