[R-sig-Geo] netCDF, raster(), and being memory-safe

Robert J. Hijmans r.hijmans at gmail.com
Mon Jun 7 23:12:23 CEST 2010


Hi Jonathan,

Currently the safest way would be to loop over time with something like this
v_wind_raster=raster(v_wind_file,zvar='vwnd',time=i)
and write these to another format, and then make a RasterStack.

But that's awful. I'll write memory-safer functions for netCDF
sometime this week (i.e. same functions and handling as for other
formats). This has been on the to-do list for a while, but you are the
first to (rightfully) complain.

Robert

On Mon, Jun 7, 2010 at 12:41 PM, Jonathan Greenberg
<greenberg at ucdavis.edu> wrote:
> r-sig-geo'ers:
>
> Next in my barrage of questions -- what would be a memory-safe way of
> dealing with netCDF files via raster()?  I understand that raster
> loads the entire netCDF band/file into memory when using raster():
>
> u_wind_rasters=stack(u_wind_file,zvar='uwnd')
>
> or
>
> v_wind_raster=raster(v_wind_file,zvar='vwnd',time=1)
>
> where u_wind_file and v_wind_file are .nc files.
>
> Would it make sense to pre-convert these to something "safer"?  Is
> there a memory-safe way of converting these to some multi-band image
> within R?
>
> --j
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



More information about the R-sig-Geo mailing list