Hi,
I've been working on a set of functions for a bit more than a month.
This morning I updated all my packages (but not R) and now, when I
call:
outfile <- "b4.sinks.sgrd"
writeRaster(myraster, outfile, overwrite = TRUE, datatype = "FLT4S",
NAflag = -9999)
or
infile <- "b4.sinks.sdat"
r <- raster(infile)
from within one of my functions, I get this error:
Error in if (is.null(projs) | is.na(projs) | nchar(projs) < 3) { :
argument is of length zero
In addition: Warning message:
In is.na(projs) : is.na() applied to non-(list or vector) of type 'NULL'
My function that calls writeRaster() and raster() hasn't changed in a
while. It was working fine just yesterday! From the error message, it
looks like .makeProj (in makeProjString.R) calls .newCRS with an
unknown projection, although I never changed my raster's projections
since I started working on this project. Here's the output of
proj4string(myraster):
"+proj=utm +zone=18 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0"
Here's the output of sessionInfo():
R version 3.0.2 (2013-09-25)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=French_Canada.1252 LC_CTYPE=French_Canada.1252
LC_MONETARY=French_Canada.1252
[4] LC_NUMERIC=C LC_TIME=French_Canada.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] snow_0.3-13 raster_2.1-66 devtools_1.3
stringr_0.6.2 RSAGA_0.93-6 plyr_1.8
[7] shapefiles_0.7 foreign_0.8-55 gstat_1.0-17
rgdal_0.8-11 data.table_1.8.10 sp_1.0-14
loaded via a namespace (and not attached):
[1] digest_0.6.3 evaluate_0.5.1 grid_3.0.2 httr_0.2
intervals_0.14.0 lattice_0.20-23
[7] memoise_0.1 parallel_3.0.2 RCurl_1.95-4.1
spacetime_1.0-9 tools_3.0.2 whisker_0.3-2
[13] xts_0.9-7 zoo_1.7-10
I'm getting frustrated as I'm about to finish this program I've been
working on for a while and now I'm stuck!!
Thanks for your help,
Guillaume
writeRaster and raster give same error after package update
6 messages · droletg, Robert J. Hijmans, Guillaume Drolet
Hi Again: Following on to my previous post, I discovered that I can successfully writeRaster() if the output file has extension ".tif". The problems I experience seems to come from trying to write to a SAGA grid (.sgrd), although it used to work until today... If you have any piece of information that could help me fix this problem, I will appreciate it a lot! Cheers, Guillaume -- View this message in context: http://r-sig-geo.2731867.n2.nabble.com/writeRaster-and-raster-give-same-error-after-package-update-tp7585138p7585139.html Sent from the R-sig-geo mailing list archive at Nabble.com.
Guillaume, It is a bug in the latest version of raster. IYou should be
able to install a corrected version 2.1-68 from R-Forge in a couple of
hours:
install.packages("raster", repos="http://R-Forge.R-project.org")
I will also send this to CRAN soon.
Thanks for reporting this. Robert
On Tue, Nov 19, 2013 at 2:52 PM, droletg <droletguillaume at gmail.com> wrote:
Hi Again: Following on to my previous post, I discovered that I can successfully writeRaster() if the output file has extension ".tif". The problems I experience seems to come from trying to write to a SAGA grid (.sgrd), although it used to work until today... If you have any piece of information that could help me fix this problem, I will appreciate it a lot! Cheers, Guillaume -- View this message in context: http://r-sig-geo.2731867.n2.nabble.com/writeRaster-and-raster-give-same-error-after-package-update-tp7585138p7585139.html Sent from the R-sig-geo mailing list archive at Nabble.com.
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Robert: thanks! That's a great news! Can't wait to install the fixed version and continue my work. Guillaume -- View this message in context: http://r-sig-geo.2731867.n2.nabble.com/writeRaster-and-raster-give-same-error-after-package-update-tp7585138p7585141.html Sent from the R-sig-geo mailing list archive at Nabble.com.
Hi Robert, This morning I got the error below when I tried to install the latest version of raster:
install.packages("raster", repos = "http://R-Forge.project.org")
Installing package into ?C:/Users/Utilisateur/Documents/R/win-library/3.0? (as ?lib? is unspecified) source repository is unavailable to check versions Error in install.packages : Line starting '<!DOCTYPE HTML PUBLI ...' is malformed! Do you have any clue? Cheers, Guillaume -- View this message in context: http://r-sig-geo.2731867.n2.nabble.com/writeRaster-and-raster-give-same-error-after-package-update-tp7585138p7585145.html Sent from the R-sig-geo mailing list archive at Nabble.com.
Guillaume. Alternatively you can download and then install from here: http://r-forge.r-project.org/R/?group_id=294 Download the zip file and in Rgui use "install packages from local zip file" Robert On Wed, Nov 20, 2013 at 6:32 AM, Guillaume Drolet
<droletguillaume at gmail.com> wrote:
Hi Robert, This morning I got the error below when I tried to install the latest version of raster:
install.packages("raster", repos = "http://R-Forge.project.org")
Installing package into ?C:/Users/Utilisateur/Documents/R/win-library/3.0? (as ?lib? is unspecified) source repository is unavailable to check versions Error in install.packages : Line starting '<!DOCTYPE HTML PUBLI ...' is malformed! Do you have any clue? Cheers, Guillaume -- View this message in context: http://r-sig-geo.2731867.n2.nabble.com/writeRaster-and-raster-give-same-error-after-package-update-tp7585138p7585145.html Sent from the R-sig-geo mailing list archive at Nabble.com.
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo