Skip to content

Dimensions error when filtering  #700

@dominicroye

Description

@dominicroye

I get a dimension error when I want to filter a single pressure level from my ncdf. I can filter the time dimension without any issues. Data example can be downloaded here.

> hu <- read_stars("hur_day_EC-Earth3_historical_r1i1p1f1_gr_19500101-19501231.nc", proxy = F)
> hu850 <-  filter(hu, time <= ymd("1950-06-01"))
> hu850 <- filter(hu850, plev == units::set_units(850*100, Pa))
Error in `glubort()`:
! Measure `/home/dominic/tankdatafic/03_CMIP6/EC-EARTH3/HUR/Historical/hur_day_EC-Earth3_historical_r1i1p1f1_gr_19500101-19501231.nc` needs dimensions [512 x 256 x 7 x 304], not [512 x 256 x 8 x 304]
Run `rlang::last_trace()` to see where the error occurred.
> rlang::last_trace()
<error/rlang_error>
Error in `glubort()`:
! Measure `/home/dominic/tankdatafic/03_CMIP6/EC-EARTH3/HUR/Historical/hur_day_EC-Earth3_historical_r1i1p1f1_gr_19500101-19501231.nc` needs dimensions [512 x 256 x 7 x 304], not [512 x 256 x 8 x 304]
---
Backtrace:
    ▆
 1. ├─dplyr::filter(hu850, plev == units::set_units(850 * 100, Pa))
 2. └─stars:::filter.stars(...)
 3.   ├─cubelyr::as.tbl_cube(.data)
 4.   └─stars::as.tbl_cube.stars(.data)
 5.     └─cubelyr::tbl_cube(dims, c(unclass(x)))
 6.       └─cubelyr:::bad_measures(...)
 7.         └─cubelyr:::glubort(fmt_measures(measures), ..., .envir = .envir)
Run rlang::last_trace(drop = FALSE) to see 1 hidden frame.
> sessionInfo()
R version 4.4.1 (2024-06-14)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 22.04.4 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0 
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

time zone: Etc/UTC
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] ncmeta_0.4.0    furrr_0.3.1     future_1.33.2   tictoc_1.2.1    stars_0.6-7     abind_1.4-5     lubridate_1.9.3 forcats_1.0.0   stringr_1.5.1   dplyr_1.1.4     purrr_1.0.2    
[12] readr_2.1.5     tidyr_1.3.1     tibble_3.2.1    ggplot2_3.5.1   tidyverse_2.0.0 fs_1.6.4        sf_1.0-16       terra_1.7-78   

loaded via a namespace (and not attached):
 [1] utf8_1.2.4         generics_0.1.3     class_7.3-22       KernSmooth_2.23-24 stringi_1.8.4      listenv_0.9.1      digest_0.6.36      hms_1.1.3          magrittr_2.0.3    
[10] grid_4.4.1         timechange_0.3.0   e1071_1.7-14       DBI_1.2.3          fansi_1.0.6        scales_1.3.0       codetools_0.2-20   RNetCDF_2.9-2      cli_3.6.3         
[19] crayon_1.5.3       rlang_1.1.4        units_0.8-5        parallelly_1.37.1  munsell_0.5.1      withr_3.0.0        tools_4.4.1        parallel_4.4.1     tzdb_0.4.0        
[28] colorspace_2.1-0   globals_0.16.3     vctrs_0.6.5        R6_2.5.1           proxy_0.4-27       lifecycle_1.0.4    classInt_0.4-10    pkgconfig_2.0.3    pillar_1.9.0      
[37] gtable_0.3.5       glue_1.7.0         Rcpp_1.0.13        tidyselect_1.2.1   rstudioapi_0.16.0  compiler_4.4.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions