[R-sig-Geo] Clip smaller domain from large domain netCDF file

Michael Sumner mdsumner at gmail.com
Wed Aug 27 01:59:45 CEST 2014


First see if raster can open it:

library(raster)
r <- raster("/path/to/hugefile.nc")
r

That will require you have the ncdf4 package installed (I don't know
of any such package "netCDF4").

If that works, try to crop with

rc <- crop(r, extent(-130, -120, 50, 60))

possibly with an added filename argument, e.g.

rc <- crop(r, extent(-130, -120, 50, 60), filename =
"/different/physical/disk/out.grd")

But, this assumes you are only reading one slice in a possibly 3D or
even 4D data set. 30Gb suggests that you are dealing with at least a
time series here, so please report on the first attempt with raster.
You must also have some idea of what is in there so please include
that in your queries here.

If raster can't deal with it you'll need to use the general NetCDF
tools in ncdf4, so start with its documentation.

And please read the posting guide.

Cheers, Mike.


On Wed, Aug 27, 2014 at 9:48 AM, Aseem Sharma <nature.aseem at gmail.com> wrote:
> Hi,
> I have this huge ( ~30GB) .nc file (NC_FORMAT_NETCDF4_CLASSIC)) for the
> whole country 141.00 to 52.00 W, 41.00 to 84.00 N".
> I am trying to clip this big dataset for a small region specific domain
> (120.00 to 130.00 W, 50.00 to 60.00 N).
> I am trying to do using netCDF4 r package but could not figure out how to
> do so.
> Kindly please suggest me how should i proceed.
>
>
> Thank you,
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



-- 
Michael Sumner
Software and Database Engineer
Australian Antarctic Division
Hobart, Australia
e-mail: mdsumner at gmail.com



More information about the R-sig-Geo mailing list