# write vkthdf file with points only.

**URL:** https://discourse.paraview.org/t/write-vkthdf-file-with-points-only/16729
**Category:** Development
**Tags:** python, vtk
**Created:** [May 28, 2025, 3:06pm UTC](https://discourse.paraview.org/t/write-vkthdf-file-with-points-only/16729 "2025-05-28T15:06:59Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![KS\_HH](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/k/c0e974/32.png) [@KS\_HH](https://discourse.paraview.org/u/KS_HH)
#### Post date: [May 28, 2025, 3:06pm UTC](https://discourse.paraview.org/t/write-vkthdf-file-with-points-only/16729/1 "2025-05-28T15:06:59Z")

</div>

I am trying to understand how to write a vtkhdf file.  
To that end I tried to make it as simple as possible and write only points with point data. My script looks like this:

```python
import h5py as h5
import numpy as np
pnts = np.array([[0,0,0],
                 [1,0,0],
                 [1,1,1]])
with h5.File('points.vtkhdf', 'w') as f:
    root = f.create_group('VTKHDF', track_order=True)
    root.attrs['Version'] = (2,1)
    ascii_type = 'UnstructuredGrid'.encode('ascii')
    root.attrs.create('Type', ascii_type, dtype=h5.string_dtype('ascii', len(ascii_type)))
    
    n_steps = 1
    root.create_dataset('NumberOfPoints' , data=[pnts.shape[0]], dtype='i8')
    root.create_dataset('NumberOfConnectivityIds', data=[0] , dtype='i8')
    root.create_dataset('NumberOfCells' , data=[0] , dtype='i8')
    
    root.create_dataset('Types', data = [] , dtype=np.uint8)
    root.create_dataset('Points', data = pnts, dtype='f' )
    root.create_dataset('Offsets', data = [] , dtype='i8' )
    root.create_dataset('Connectivity', data = [] , dtype='i8' )

    point_data = root.create_group("PointData")
    pressure_field = (1, 2, 3, )
    point_data.create_dataset("Pressure", data=(pressure_field), dtype="f")

```

Paraview can open the generated “points.vtkhdf” file. Unfortunately, the points are not rendered. However, I see the points and the data in the spread sheet view.

Have I done something wrong or is it not possible to display points only with the unstructured grid vtkhdf file?

---

<div class="post-metadata">

### Author: ![nicolas.vuaille](https://discourse.paraview.org/user_avatar/discourse.paraview.org/nicolas.vuaille/32/5873_2.png) [@nicolas.vuaille](https://discourse.paraview.org/u/nicolas.vuaille)
#### Post date: [June 2, 2025, 8:31am UTC](https://discourse.paraview.org/t/write-vkthdf-file-with-points-only/16729/2 "2025-06-02T08:31:32Z")

</div>

The VTK model relies on cell for most of work, specially rendering. While you can define an unstructured grid with points without cells, it is expected that nothing shows up.

That said ParaView offers several way to display them anyway:

- change the representation: use `Point Gaussian`
- create some cell with `Convert to Point Cloud` filter

---

<div class="post-metadata">

### Author: ![KS\_HH](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/k/c0e974/32.png) [@KS\_HH](https://discourse.paraview.org/u/KS_HH)
#### Post date: [June 2, 2025, 7:07pm UTC](https://discourse.paraview.org/t/write-vkthdf-file-with-points-only/16729/3 "2025-06-02T19:07:50Z")

</div>

Thanks for clarifying things. I was not aware of that.
