On Mon, Dec 12, 2011 at 2:19 AM, tony333 <tony33...@hotmail.com> wrote:

> i use library(ncdf) to read this file as follow
> library(ncdf)
> sst.nc = open.ncdf(title)
> lonall = get.var.ncdf(sst.nc,'lon')
> latall = get.var.ncdf(sst.nc,'lat')
> precip = get.var.ncdf(sst.nc,'pre')
> close(sst.nc)
> if i use this method my pc freeze and not respond until i restart it is
> there
>

As Paul already mentioned, more information would be useful, but here's a
suggestion. If you have a data set that is too big to fit in your
computer's memory, read it in one timestep at a time and process that
timestep. For example, you could get the number of timesteps in the
variable like this:

varname = 'pre'
sst.nc = open.ncdf(file)
varsize = sst.nc$var[[varname]]$size
nt = dim( varsize )[3]

Then read in one timestep at a time and process it:

for( itstep in 1:nt ) {
    data = get.var.ncdf( sst.nc, varname, start=c(1,1,itstep),
count=c(-1,-1,1))
    ...process one timestep of the data here ...
}

Regards,

--Dave

-- 
Dr. David W. Pierce
Division of Climate, Atmospheric Science, and Physical Oceanography
Scripps Institution of Oceanography, La Jolla, California, USA
(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