Skip to content
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

Tilde expansion doesn't work with write_stars #293

Closed
michaeldorman opened this issue May 28, 2020 · 2 comments
Closed

Tilde expansion doesn't work with write_stars #293

michaeldorman opened this issue May 28, 2020 · 2 comments

Comments

@michaeldorman
Copy link
Contributor

Expansion of tilde ~ into the home directory path doesn't work with write_stars (unlike read_stars, sf::st_read and sf::st_write, where tilde expansion works fine).

For example:

library(stars)
tif = system.file("tif/L7_ETMs.tif", package = "stars")
x = read_stars(tif)
write_stars(x, "~/Downloads/x.tif")
## Error in CPL_write_gdal(mat, file, driver, options, type, dims, from,  : 
##   creating dataset failed
## In addition: Warning message:
## In CPL_write_gdal(mat, file, driver, options, type, dims, from,  :
##   GDAL Error 4: Attempt to create new tiff file `~/Downloads/x.tif' failed: No such file or directory

However, this does work:

write_stars(x, "/home/michael/Downloads/x.tif")

Session information:

R version 4.0.0 (2020-04-24)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.4 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3.10.3
LAPACK: /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3.10.3

locale:
 [1] LC_CTYPE=en_IL       LC_NUMERIC=C         LC_TIME=en_IL       
 [4] LC_COLLATE=en_IL     LC_MONETARY=en_IL    LC_MESSAGES=en_IL   
 [7] LC_PAPER=en_IL       LC_NAME=C            LC_ADDRESS=C        
[10] LC_TELEPHONE=C       LC_MEASUREMENT=en_IL LC_IDENTIFICATION=C 

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

other attached packages:
[1] stars_0.4-2 sf_0.9-3    abind_1.4-5

loaded via a namespace (and not attached):
 [1] compiler_4.0.0     magrittr_1.5       class_7.3-17       parallel_4.0.0    
 [5] tools_4.0.0        DBI_1.1.0          units_0.6-6        Rcpp_1.0.4.6      
 [9] KernSmooth_2.23-17 grid_4.0.0         e1071_1.7-3        lwgeom_0.2-4      
[13] classInt_0.4-3     rlang_0.4.6       
> 

Thanks!

@edzer edzer closed this as completed in 310f131 May 28, 2020
@edzer
Copy link
Member

edzer commented May 28, 2020

Thanks! That should work now.

@michaeldorman
Copy link
Contributor Author

Great, it works now! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants