vtkNetCDFCFReader orientation issue
Here is an example NetCDF file that is improperly loaded by VTK (and ParaView by extension): from_scratch.nc
the NetCDF file is using the CF convention and the axes are labeled x and z. It appears that the reader is generating an output vtkImageData object without the proper transform. I understand support for oriented images is new (reference this discourse topic), and I see that vtkNetCDFCFReader
is listed in the "VTK Orientation Support: Classes To Update" spreadsheet without a status.
ncdump -h from_scratch.nc
shows:
netcdf from_scratch {
dimensions:
time = 100 ;
y = 12 ;
x = 500 ;
variables:
double salinity(time, y, x) ;
salinity:_FillValue = NaN ;
salinity:coordinates = "yc xc" ;
int64 time(time) ;
time:units = "days since 2014-09-06 00:00:00" ;
time:calendar = "proleptic_gregorian" ;
double xc(y, x) ;
xc:_FillValue = NaN ;
xc:axis = "X" ;
xc:long_name = "x-coordinate in Cartesian system" ;
xc:units = "m" ;
double yc(y, x) ;
yc:_FillValue = NaN ;
yc:axis = "Z" ;
yc:long_name = "sigma" ;
yc:positive = "down" ;
yc:units = "m" ;
// global attributes:
:convention = "CF-1.4" ;
}
Note the axis
properties properly listed how the data should be oriented. VTK is seemingly ignoring this orientation.
Code to demonstrate (executed with VTK 9.0.1 python bindings):
import vtk
r = vtk.vtkNetCDFCFReader()
r.SetFileName("from_scratch.nc")
r.Update()
print(r.GetOutput().GetBounds())
output: (0.0, 499.0, 0.0, 11.0, 0.0, 0.0)
(on the XY plane)
Originally posted in the Pangeo Support Forum