Charles Novaes de Santana
2010-Oct-27 13:27 UTC
[R] "non-numeric argument to binary operator" error while reading ncdf file
Hi everyone, I am a newbie in R and in this discussion list. I am trying to use R package "ncdf" to read values of temperature from a NCDF file. I did it before to another file using the function "get.var.ncdf", but now there is an error that I can not solve, and I would really appreciate if you could help me. I am using R version 2.11.1 (2010-05-31) in a machine with Linux 2.6.26-2-amd64.> library(ncdf) > file_temp<-open.ncdf("File.nc") > temp<-get.var.ncdf(file_temp,"tasmax",verbose=TRUE)[1] "get.var.ncdf: entering. Here is varid:" [1] "tasmax" [1] "checking to see if passed varid is actually a dimvar" [1] "entering vobjtodimname with varid= tasmax" [1] "vobjtodimname: is a character type varid. This file has 3 dims" [1] "vobjtodimname: no cases found, returning FALSE" [1] "get.var.ncdf: isdimvar: FALSE" [1] "vobjtovarid: entering with varid=tasmax" [1] "Variable named tasmax found in file with varid= 4" [1] "vobjtovarid: returning with varid deduced from name; varid= 4" [1] "get.var.ncdf: ending up using varid= 4" [1] "ndims: 3" [1] "get.var.ncdf: varsize:" [1] 68 40 21275 [1] "get.var.ncdf: start:" [1] 1 1 1 [1] "get.var.ncdf: count:" [1] 68 40 21275 [1] "get.var.ncdf: totvarsize: 57868000" [1] "Getting var of type 4 (1=short, 2=int, 3=float, 4=double, 5=char, 6=byte)" [1] "get.var.ncdf: C call returned 0" [1] "count.nodegen: 68 Length of data: 57868000" [2] "count.nodegen: 40 Length of data: 57868000" [3] "count.nodegen: 21275 Length of data: 57868000" [1] "get.var.ncdf: final dims of returned array:" [1] 68 40 21275 [1] "varid: 4" [1] "nc$varid2Rindex: 0" "nc$varid2Rindex: 0" "nc$varid2Rindex: 0" [4] "nc$varid2Rindex: 1" [1] "nc$varid2Rindex[varid]: 1" [1] "get.var.ncdf: setting missing values to NA" Error en mv * 1e-05 : non-numeric argument to binary operator Thank you very much for your attention! Cheers, Charles -- Um axé! :) -- Charles Novaes de Santana PhD student - Global Change Laboratorio Internacional de Cambio Global Department of Global Change Research Instituto Mediterráneo de Estudios Avanzados(CSIC/UIB) Calle Miquel Marques 21, 07006 Esporles - Islas Baleares - España [[alternative HTML version deleted]]
jim holtman
2010-Oct-27 13:46 UTC
[R] "non-numeric argument to binary operator" error while reading ncdf file
put: options(error=utils::recover) in your script so that when an error occurs you are dropped into the 'browser' so that you can examine the variables at that point in time. There are several references on how to use the debugging tools in R that will help you resolve your problem. We can not tell from the information you provided what the problem is. You need to at least provide provide commented, minimal, self-contained, reproducible code so other can reproduce the error and provide feed back. On Wed, Oct 27, 2010 at 9:27 AM, Charles Novaes de Santana <charles.santana at imedea.uib-csic.es> wrote:> Hi everyone, > > I am a newbie in R and in this discussion list. I am trying to use R package > "ncdf" to read values of temperature from a NCDF file. I did it before to > another file using the function "get.var.ncdf", but now there is an error > that I can not solve, and I would really appreciate if you could help me. > > I am using R version 2.11.1 (2010-05-31) in a machine with Linux > 2.6.26-2-amd64. > >> library(ncdf) >> file_temp<-open.ncdf("File.nc") >> temp<-get.var.ncdf(file_temp,"tasmax",verbose=TRUE) > [1] "get.var.ncdf: entering. Here is varid:" > [1] "tasmax" > [1] "checking to see if passed varid is actually a dimvar" > [1] "entering vobjtodimname with varid= tasmax" > [1] "vobjtodimname: is a character type varid. ?This file has 3 dims" > [1] "vobjtodimname: no cases found, returning FALSE" > [1] "get.var.ncdf: isdimvar: FALSE" > [1] "vobjtovarid: entering with varid=tasmax" > [1] "Variable named tasmax found in file with varid= 4" > [1] "vobjtovarid: returning with varid deduced from name; varid= 4" > [1] "get.var.ncdf: ending up using varid= 4" > [1] "ndims: 3" > [1] "get.var.ncdf: varsize:" > [1] ? ?68 ? ?40 21275 > [1] "get.var.ncdf: start:" > [1] 1 1 1 > [1] "get.var.ncdf: count:" > [1] ? ?68 ? ?40 21275 > [1] "get.var.ncdf: totvarsize: 57868000" > [1] "Getting var of type 4 ?(1=short, 2=int, 3=float, 4=double, 5=char, > 6=byte)" > [1] "get.var.ncdf: C call returned 0" > [1] "count.nodegen: 68 ? ?Length of data: 57868000" > [2] "count.nodegen: 40 ? ?Length of data: 57868000" > [3] "count.nodegen: 21275 ? ?Length of data: 57868000" > [1] "get.var.ncdf: final dims of returned array:" > [1] ? ?68 ? ?40 21275 > [1] "varid: 4" > [1] "nc$varid2Rindex: 0" "nc$varid2Rindex: 0" "nc$varid2Rindex: 0" > [4] "nc$varid2Rindex: 1" > [1] "nc$varid2Rindex[varid]: 1" > [1] "get.var.ncdf: setting missing values to NA" > Error en mv * 1e-05 : non-numeric argument to binary operator > > Thank you very much for your attention! > > Cheers, > > Charles > > -- > Um ax?! :) > > -- > Charles Novaes de Santana > PhD student - Global Change > Laboratorio Internacional de Cambio Global > Department of Global Change Research > Instituto Mediterr?neo de Estudios Avanzados(CSIC/UIB) > Calle Miquel Marques 21, 07006 > Esporles - Islas Baleares - Espa?a > > ? ? ? ?[[alternative HTML version deleted]] > > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?