[R-sig-Geo] parallelize projectRaster()

Jonathan Greenberg jgrn at illinois.edu
Wed Jun 18 18:15:29 CEST 2014


Have you tried first converting the NetCDF to another "friendlier"
raster format (netcdf isn't really a raster format, keep in mind)--j
first via gdal_translate?  Then you can follow up with a gdalwarp.
Keep in mind gdalUtils is merely a wrapper for the GDAL Utilities --
from their documentation on NetCDF

"If the file contains only one netCDF array which appears to be an
image, it may be accessed directly, but if the file contains multiple
images it may be necessary to import the file via a two step process.

The first step is to get a report of the components images (dataset)
in the file using gdalinfo, and then to import the desired images
using gdal_translate. The gdalinfo utility lists all multidimensional
subdatasets from the input netCDF file.

The name of individual images are assigned to the SUBDATASET_n_NAME
metadata item. The description for each image is found in the
SUBDATASET_n_DESC metadata item. For netCDF images will follow this
format: NETCDF:filename:variable_name"

On Wed, Jun 18, 2014 at 10:44 AM, Yerguner <yasebaytok at gmail.com> wrote:
> Hi Jonathan,
> Thanks a lot for your reply. I've already tried your gdalUtils() package but
> it creates a empty .tif file (all zero values) and continues to run several
> (>14) hrs. May be I'm not using the function correctly:
> library(raster)
> rasterOptions(tmpdir="/pegasus/yb3/modvar2000/")
> library(ncdf4)
> library(rgdal)
> library(gdalUtils)
> gdal_setInstallation()
> ifile2 <- "cold00_s2.nc"
> newproj <- "+proj=laea +lat_0=45 +lon_0=-100 +x_0=0 +y_0=0 +a=6370997
> +b=6370997 +units=m +no_defs"
> gdalwarp(srcfile= ifile2, dstfile= "ohey_file.tif", t_srs= newproj,
> output_Raster=TRUE, multi=TRUE, tr=c(231.6564, 231.6563),r="near")
> class       : RasterBrick
> dimensions  : 2049, 4417, 9050433, 365  (nrow, ncol, ncell, nlayers)
> resolution  : 231.6564, 231.6563  (x, y)
> extent      : -1075057, -51831.17, 241865.9, 716529.7  (xmin, xmax, ymin,
> ymax)
> coord. ref. : +proj=laea +lat_0=45 +lon_0=-100 +x_0=0 +y_0=0 +a=6370997
> +b=6370997 +units=m +no_defs
> data source : /pegasus/yb3/daymet2000/ohey_file.tif
> names       : ohey_file.1, ohey_file.2, ohey_file.3, ohey_file.4,
> ohey_file.5, ohey_file.6, ohey_file.7, ohey_file.8, ohey_file.9,
> ohey_file.10, ohey_file.11, ohey_file.12, ohey_file.13, ohey_file.14,
> ohey_file.15, ...
> Thanks,
> Yasemin
> --
> View this message in context: http://r-sig-geo.2731867.n2.nabble.com/parallelize-projectRaster-tp7586598p7586604.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Jonathan A. Greenberg, PhD
Assistant Professor
Global Environmental Analysis and Remote Sensing (GEARS) Laboratory
Department of Geography and Geographic Information Science
University of Illinois at Urbana-Champaign
259 Computing Applications Building, MC-150
605 East Springfield Avenue
Champaign, IL  61820-6371
Phone: 217-300-1924
AIM: jgrn307, MSN: jgrn307 at hotmail.com, Gchat: jgrn307, Skype: jgrn3007

More information about the R-sig-Geo mailing list