New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
as_tibble no longer working on raster brick #30
Comments
I don't know how to reproduce this, I've tried a few test bricks including with daily oisst and can't get this error. Can you isolate it to a particular object? |
I haven't but I will try to write a reprex, stand by! |
I isolated the problem to the masking step. Even though (in reprex below)
|
thanks for the reprex I'll try to look more closely soon |
sorry to have lost this ... the problem is the dates on the raster are bogus str(getZ(wc_oisst_crop1))
chr [1:8766] "1982-01-01 12" "00" "00" "1982-01-02 12" "00" "00" ... but, I should be robust to that so will put in a fix. Thanks! |
Actually it's a bug in rerddap, nlayers should match length of getZ str(getZ(wc_oisst_crop1))
chr [1:8766] "1982-01-01 12" "00" "00" "1982-01-02 12" "00" "00" ...
nlayers(wc_oisst_crop1)
[1] 2922 so a workaround is z <- as.Date(getZ(wc_oisst_crop1))
z <- z[!is.na(z)]
range(z)
#[1] "1982-01-01" "1989-12-31"
range(diff(z))
#Time differences in days
#[1] 1 1
wc_oisst_crop_fixed <- setZ(wc_oisst_crop1, z)
as_tibble(wc_oisst_crop_fixed, cell=FALSE, dim=TRUE, values=TRUE, xy=TRUE)
# A tibble: 6,919,296 × 4
cellvalue dimindex x y
<dbl> <date> <dbl> <dbl>
1 NA 1982-01-01 -126. 50.1
2 NA 1982-01-01 -126. 50.1
3 NA 1982-01-01 -125. 50.1
4 NA 1982-01-01 -125. 50.1
5 NA 1982-01-01 -125. 50.1
6 NA 1982-01-01 -125. 50.1
7 NA 1982-01-01 -124. 50.1
8 NA 1982-01-01 -124. 50.1
9 NA 1982-01-01 -124. 50.1
10 NA 1982-01-01 -124. 50.1
# … with 6,919,286 more rows
# ℹ Use `print(n = ...)` to see more rows
|
I'm re-running some old code that I haven't revisited since the update to R 4.0.X. Some calls to
tabularaster::as_tibble()
work fine, but I keep getting an error converting a raster brick into a df here that says:I've tried updating packages (
raster
,tabularaster
,sf
, andrerddap
), clearing thererddap
cache on my local machine, and testing different OISST raster bricks. The HadISST ones work fine, but none of the OISST ones do -- they just have slightly different dimension sizes in the error. Here's my session info:The text was updated successfully, but these errors were encountered: