Convert model data (netcdf) to vtk in Python

Hi there.

I am trying to convert my model data from netCDF to vtk, as the native format needs some post processing to be visualized correctly, namely the vertical topology needs to be manipulated. I had already achieved this, and this is documented here:

https://www.kitware.com/scientific-visualization-of-weather-research-and-forecasting-model-output-in-paraview/

The model data I have (an extract) are here:
model_data.nc (3.7 MB)
My data are NOT on a rectilinear grid, but they are rather curvilinear.

However, now I am trying to get rid of some of the intermediate steps described in the link above and return vtk straight away. My starting point is this script.

My problems and questions:

I see that there is a mismatch in size between destination grid (vtk) and input data (my netcdf data). Specifically:

nx, ny, nz = np.shape(netcdfData) #Original grid   

while the destination grid should have dimension

nx+1, ny+1, nz+1              #Target grid 

In other words, I should have more coordinates than grid points. This, to me, sounds like a staggered grid. I tried plotting by maintaining the number of gridnodes constant, and I see some mismatches.

My question is:

  1. what destination data type should I use (VOXEL? datapoint? Datacell?); see linked script
  2. how can i map my data (origin <-> destination), by keeping it consistent in shape, with a shape-preserving method?

Thank you for any help you might be willing to give me.
Marco