R-在大型栅格图层中跟踪特定像元值 [英] R - Chaging specific cell values in a large raster layer

查看:92
本文介绍了R-在大型栅格图层中跟踪特定像元值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用R栅格"包,并具有较大的栅格层(62460098像元,对象为12 Mb).我的单元格值范围从-1到1.我必须将所有负值替换为0(例如:值为-1的单元格必须变为0).我尝试这样做:

I am working with R "raster" package and have a large raster layer (62460098 cells, 12 Mb for the object). My cell values range from -1 to 1. I have to replace all negative values with a 0 (example: a cell that has -1 as value has to become a 0). I tried to do this:

raster[raster < 0] <- 0

但是由于栅格大小,它一直使我的RAM过载.

But it keeps overloading my RAM because of the raster size.

操作系统:Windows 7 64位

OS: Windows 7 64-bits

RAM大小:8GB

RAM size: 8GB

谢谢!

推荐答案

您可以

r <- reclassify(raster, c(-Inf, 0, 0))

这将适用于任何大小的栅格(无内存限制)

This will work on rasters of any size (no memory limitation)

这篇关于R-在大型栅格图层中跟踪特定像元值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆