# Obtaining the CellData of a given Cell

**URL:** https://discourse.vtk.org/t/obtaining-the-celldata-of-a-given-cell/2210
**Category:** Support
**Created:** [December 5, 2019, 2:42am UTC](https://discourse.vtk.org/t/obtaining-the-celldata-of-a-given-cell/2210 "2019-12-05T02:42:01Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![balborian](https://discourse.vtk.org/user_avatar/discourse.vtk.org/balborian/32/1152_2.png) [@balborian](https://discourse.vtk.org/u/balborian)
#### Post date: [December 5, 2019, 2:42am UTC](https://discourse.vtk.org/t/obtaining-the-celldata-of-a-given-cell/2210/1 "2019-12-05T02:42:01Z")

</div>

Consider the code below:

```python
reader = PVDReader(FileName="./function.pvd")
data = servermanager.Fetch(reader)
cells = data.GetCells()
cells.InitTraversal()   

cell_data_arr = data.GetCellData().GetArray(0)
for i in range(cells.GetNumberOfCells()):
    my_cell = data.GetCell(i)
    radius = cell_data_arr.GetTuple1(i)

```

This seems to work, and I am getting the value corresponding to cell “my\_cell”, but I don’t see anywhere something that guarantees that the way cell\_data\_arr is ordered coincides with the cell numbering. Are there other ways to obtain the CellData corresponding to the cell “my\_cell”?

---

<div class="post-metadata">

### Author: ![allison.vacanti](https://discourse.vtk.org/user_avatar/discourse.vtk.org/allison.vacanti/32/679_2.png) [@allison.vacanti](https://discourse.vtk.org/u/allison.vacanti)
#### Post date: [December 11, 2019, 11:01pm UTC](https://discourse.vtk.org/t/obtaining-the-celldata-of-a-given-cell/2210/2 "2019-12-11T23:01:39Z")

</div>

You have it right. In your code, `i` is a canonical cell id and is guaranteed to index the same cell from both the dataset and the cell data. Cells are identified by their 0-based index.
