[R-sig-Geo] Fastest method to reclassify large raster.
Robert J. Hijmans
r.hijmans at gmail.com
Mon Sep 16 07:57:06 CEST 2013
It seems to me that replacing numbers using a lookup table of 197000
rows x 80 reclass values for a (not very large) raster of 197000
values can be solved more easily. Unfortunately, you did not provide
code that generates example data; please do so in the future, now you
leave us guessing. Presumably the lookup table column 'Value' is a
cell number. Is so, and if they are sorted, perhaps you can simply do:
b <- brick(r, nl=83)
b <- setValues(b, mydataOut[,5:88])
On Fri, Sep 13, 2013 at 8:00 PM, Tom Philippi <tephilippi at gmail.com> wrote:
> A couple of hints:
> asc files are very slow to process in R. I would write it back to the disk
> as either a native grd, or even geoTiff, before reclassifying (in my
> experience, perhaps a 100x increase in throughput).
> If you have enough memory and are running 64-bit R, load the raster into
> memory rather than run it from the disk.
> If you have a quad (or more) core cpu, look at using clusterR() in raster
> for simple (snow) parallel processing. ?clusterR even has an example with
> reclassify. That can get you another 2x or 3x speedup.
> If all that fails, what Barry said, although for me, the upload/download
> time for a cloud solution would take longer than computing on my circa 2007
> desktop (slow quad core with 20GB RAM).
> On Fri, Sep 13, 2013 at 1:37 AM, Barry Rowlingson <
> b.rowlingson at lancaster.ac.uk> wrote:
>> On Fri, Sep 13, 2013 at 8:06 AM, Lionel Hertzog <s6lihert at uni-bonn.de>
>> > Dear Nevil Amos,
>> > Maybe the function 'reclassify' in the raster package is what you are
>> > looking for.
>> This should be trivially parallelizable, so if you have a cluster
>> handy there should be a way to split the raster and farm out the task
>> amongst the cluster.
>> Don't have a cluster? Rent one from Amazon.
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
> [[alternative HTML version deleted]]
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
More information about the R-sig-Geo