def test__RasterRow_value_access__add(): test_a = pygrass.RasterRow(name="test_a") test_a.open(mode="r") test_b = pygrass.RasterRow(name="test_b") test_b.open(mode="r") test_c = pygrass.RasterRow(name="test_c") test_c.open(mode="w", mtype="FCELL", overwrite=True) buff_a = pygrass.Buffer(test_a.cols, test_a.mtype) buff_b = pygrass.Buffer(test_b.cols, test_b.mtype) buff_c = pygrass.Buffer(test_b.cols, test_b.mtype) for row in xrange(test_a.rows): test_a.get_row(row, buff_a) test_b.get_row(row,buff_b) for col in xrange(test_a.cols): buff_c[col] = buff_a[col] + buff_b[col] test_c.put_row(buff_c) test_a.close() test_b.close() test_c.close()
def test__RasterSegment_row_access__add(): test_a = pygrass.RasterSegment(name="test_a") test_a.open(mode="r") test_b = pygrass.RasterSegment(name="test_b") test_b.open(mode="r") test_c = pygrass.RasterSegment(name="test_c") test_c.open(mode="w", mtype="DCELL", overwrite=True) buff_a = pygrass.Buffer(test_a.cols, test_a.mtype) buff_b = pygrass.Buffer(test_b.cols, test_b.mtype) for row in xrange(test_a.rows): test_a.get_row(row, buff_a) test_b.get_row(row,buff_b) test_c.put_row(row, buff_a + buff_b) test_a.close() test_b.close() test_c.close()
def test__RasterRow_row_access__if(): test_a = pygrass.RasterRow(name="test_a") test_a.open(mode="r") test_c = pygrass.RasterRow(name="test_c") test_c.open(mode="w", mtype="CELL", overwrite=True) buff_a = pygrass.Buffer(test_a.cols, test_a.mtype) for row in xrange(test_a.rows): test_a.get_row(row, buff_a) test_c.put_row(buff_a > 50) test_a.close() test_c.close()
def test__RasterSegment_value_access__if(): test_a = pygrass.RasterSegment(name="test_a") test_a.open(mode="r") test_c = pygrass.RasterSegment(name="test_c") test_c.open(mode="w", mtype="CELL", overwrite=True) buff_a = pygrass.Buffer(test_a.cols, test_a.mtype) for row in xrange(test_a.rows): test_a.get_row(row, buff_a) for col in xrange(test_a.cols): test_c.put(row, col, buff_a[col] > 50) test_a.close() test_c.close()