Question

I understand that paraview can read classic netcdf files through its VTK backend. However after several attempts I cannot make it read a netcdf 4 file that uses the enhanced data model. I would like to use the new file format since it allows for parallel output with MPI.

I compiled one of the example C programs from http://www.unidata.ucar.edu/software/netcdf/examples/programs/ changing the creation flag to NC_NETCDF4 and tried to open the resulting file in paraview (v4.0.1), which I installed via the ubuntu package manager. It always tells me that "A reader (...) could not be found. Please choose one: (...) " However, none of the readers to choose from can actually read the file.

Can someone tell me if

  • paraview simply cannot open netcdf 4 files, or

  • it needs some kind of installation flag and a reinstallation

  • there is some miracle option in paraview that I have not found yet?
Was it helpful?

Solution

The solution was to download a current version from the kitware download site instead of the one in the ubuntu package manager. Apparantly there are some installation flags set wrong in ubuntu's paraview package.

OTHER TIPS

xmdf files helped me to read netcdf files with older versions of paraview as well.

I use them to deal with another issue actually which I am not sure if it is important for you or not, netcdf files are saved based on array index. If you wish to visualize them on paraview with the correct physical coordinates, I think the only way is to create a xmdf file. not sure if it is the only way, please comment if there are other ways, also please have a look my question about that:

An example xmdf file looks like that:

<?xml version="1.0" ?>
<!DOCTYPE Xdmf SYSTEM "Xdmf.dtd" []>
<Xdmf xmlns:xi="http://www.w3.org/2001/XInclude" Version="2.0">
   <Domain>
      <Grid Name="gridxyz">
        <Topology TopologyType="3DSMesh" NumberOfElements="064 0129 0513">
        </Topology>
<!-- Read Coordinates -->
        <Geometry GeometryType="X_Y_Z">
           <DataItem Name="X" Format="HDF" NumberType="Float" Precision="8" Dimensions="0064 0129 0513">
                       grid.nc:/gridx
           </DataItem>
           <DataItem Name="Y" Format="HDF" NumberType="Float" Precision="8" Dimensions="0064 0129 0513">
                       grid.nc:/gridy
           </DataItem>
           <DataItem Name="Z" Format="HDF" NumberType="Float" Precision="8" Dimensions="0064 0129 0513">
                       grid.nc:/gridz
           </DataItem>
        </Geometry>
<!-- Read Scalar -->
        <Attribute Name="ux1" AttributeType="Scalar" Center="node">
           <DataItem Format="HDF" NumberType="Float" Precision="8" Dimensions="0064 0129 0513">
                fields021.nc:/ux1
           </DataItem>
        </Attribute>
        <Attribute Name="uy1" AttributeType="Scalar" Center="node">
           <DataItem Format="HDF" NumberType="Float" Precision="8" Dimensions="0064 0129 0513">
                fields021.nc/uy1
           </DataItem>
        </Attribute>
        <Attribute Name="uz1" AttributeType="Scalar" Center="node">
           <DataItem Format="HDF" NumberType="Float" Precision="8" Dimensions="0064 0129 0513">
                fields021.nc:/uz1
           </DataItem>
        </Attribute>
     </Grid>
   </Domain>
</Xdmf>

I had this same problem with Paraview 5.5.0-RC3 on OS X. It was solved by saving the NetCDF file in 'classic mode', as follows:

from netCDF4 import Dataset
foo_dataset = Dataset("foo.nc", "w", format="NETCDF4_CLASSIC")
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top