Hi, Well, I did it, but all my script was on the first message. I don't have any other variables. I am just reading a NCDF file and trying to read the variable "tasmax", that has values of temperatures.
The only "new" information I have is the header of the NCDF file (Spain02D_tasmax.nc), that I have obtained by running "ncdump" command. netcdf Spain02D_tasmax { dimensions: time = 21275 ; lat = 40 ; lon = 68 ; variables: double time(time) ; time:long_name = "Time variable" ; time:units = "days since 1950-01-01 00:00:00" ; double lat(lat) ; lat:standard_name = "latitude" ; lat:long_name = "latitude" ; lat:units = "degrees north" ; double lon(lon) ; lon:standard_name = "longitude" ; lon:long_name = "longitude" ; lon:units = "degrees east" ; double tasmax(time, lat, lon) ; tasmax:long_name = "Daily maximum temperature" ; tasmax:units = "degrees Celsius" ; tasmax:missing_value = "-9999.0f" ; // global attributes: :Info = "Data generated for the esTcena project ( http://www.meteo.unican.es/projects/esTcena)" ; :Institution = "IFCA-UC" ; :Conventions = "CF-1.0" ; :conventionsURL = " http://www.cgd.ucar.edu/cms/eaton/cf-metadata/index.html" ; :creation_date = "20-Sep-2010 09:34:26" ; data: (...) tasmax = NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, 14.0840393066406, 14.4718475341797, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, (...) As we can see, "tasmax" has a lot of NaN (not a number) values. And the missing_value of the file is "-9999.0f". As we can see in following lines, the error occurs just when the function "get.var.ncdf" is trying to set the missing values to NA. > library(ncdf) > file<-open.ncdf("Spain02D_tasmax.nc") > temp<-get.var.ncdf(file,"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 I think that the error is related to this procedure: to set missing values to NA. But I am not sure, as I told you I am a newbie and I did not see any error like this before (even in discussion lists in the web). If any of you that have worked with NCDF files in R could help me, even if you know any other packages or commands to read this values, I would be really really grateful. Thank you very much for your attention! Sorry about my poor English. Charles On Wed, Oct 27, 2010 at 3:46 PM, jim holtman <jholt...@gmail.com> wrote: > 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.sant...@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@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? > -- 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@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.