[R-sig-Geo] NetCDF file size

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Sat Jun 18 01:28:08 CEST 2011


On Fri, Jun 17, 2011 at 7:02 PM, Narayani Barve <narayani at ku.edu> wrote:
> Hi All,
>
> I am using ncdf package to manipulate netcdf file downloaded from ECMWF
> website. The downloaded data file contains 8 observations per day for a
> single variable. The size of file is 800+ mb for a whole year data. The
> dimension for the data is 240 x 120 x 1460, where 240 is DimX, 120 is DimY
> and 2920 is Time Dimension. I want to take only 4 observations from this
> file. To do this I wrote a script in R and used ncdf package to manipulate
> the data. My script is working great. And my effective dimension of the
> variable is 240 x 120 x 1460 (which is half of 2920). The only trouble is
> size of the new file is same as old file. In my opinion, the file size
> should have reduced to half. But this is not happening. Is there any
> documentation which tell me more about how the file size is decided, OR Do
> you think I am doing something wrong ? OR is there any way to compact the
> file size like in Microsoft Access, there is a option to compact database ?
>
> Thanks in advance, any help is appreciated.

 Hard to tell without seeing your code. I suspect either you are
creating the new netcdf file with the same dimensions as the original,
and then only writing the first 1460 of the time dimension, or
possibly your source file is in single precision and you are writing
in double precision...

Barry



More information about the R-sig-Geo mailing list