On Fri, May 6, 2011 at 10:11 AM, francoise orain
<francoise.or...@meteo.fr>wrote:

> Hello
> I am a new user of R .
> and I ve problem with R and netcdf .
> I succed installation , I could use all examples .
> But when I take my netcf it is different .
>
> I want to do statistic on this kind of file .
>
> 1)
> first calculate mean .
> my data is like that
> through ncdump -h test.nc
>
> netcdf test {
> dimensions:
>       lat = 301 ;
>       lon = 401 ;
>       time = UNLIMITED ; // (80 currently)
> variables:
>       float lat(lat) ;
>               lat:long_name = "latitude" ;
>               lat:standard_name = "latitude" ;
>               lat:units = "degrees_north" ;
>               lat:valid_range = -60., 60. ;
>       float lon(lon) ;
>               lon:long_name = "longitude" ;
>               lon:standard_name = "longitude" ;
>               lon:units = "degrees_east" ;
>               lon:valid_range = -100., 45. ;
>       double sst(time, lat, lon) ;
>               sst:long_name = "sea surface temperature" ;
>               sst:standard_name = "sea_surface_temperature" ;
>               sst:units = "K" ;
>               sst:_FillValue = -32768. ;
>       double time(time) ;
>               time:long_name = "time" ;
>               time:standard_name = "time" ;
>               time:units = "seconds since 1981-01-01 00:00:00" ;
>               time:ancillary_variables = "sst_data_processed_flag" ;
>
> I succeed to read it with R, there is only one variable sst   80 days and
> lat = 301     lon = 401 (this file is already a concatenation with nco
> fonctions .
>
> Here is what I do :
>
> nc<-open.ncdf("test.nc")
> summary (nc)
> data<- get.var.ncdf(nc)
> print (data)
>
> answer extract :
>
> [331,] -32768.00 -32768.00 -32768.00 -32768.00 -32768.00 -32768.00
> -32768.00
> [332,] -32768.00 -32768.00 -32768.00 -32768.00 -32768.00 -32768.00
> -32768.00
>         [,295]    [,296]    [,297]    [,298]    [,299]    [,300]    [,301]
>  [1,]      0.10      0.10      0.12      0.15      0.15      0.14      0.15
>  [2,]      0.12      0.12      0.13      0.15      0.15      0.14      0.15
>  [3,]      0.13      0.13      0.13      0.16      0.14      0.14      0.14
>  [4,]      0.15      0.13      0.11      0.16      0.15      0.15      0.15
>  [5,]      0.17      0.16      0.15      0.15      0.16      0.17      0.15
>
> #_fill_value is at  -32768.00
>
>
Hello,

I'm not sure what the problem you are experiencing is. As a practical
matter, I suggest you try something like this:

nc<-open.ncdf("test.nc")
summary (nc)
data<- get.var.ncdf(nc)
data[ data < -32000 ] <- NA

Regards,

--Dave

-- 
David W. Pierce
Division of Climate, Atmospheric Science, and Physical Oceanography
Scripps Institution of Oceanography
(858) 534-8276 (voice)  /  (858) 534-8561 (fax)    dpie...@ucsd.edu

        [[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.

Reply via email to