def test__RasterSegment_row_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) test_c.put_row(row, buff_a > 50) test_a.close() test_c.close()
def test__RasterSegment_value_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) for col in xrange(test_a.cols): test_c.put(row, col, buff_a[col] + buff_b[col]) test_a.close() test_b.close() test_c.close()