[Kst] Support for NetCDF4 files: yes or no?

Fowler, Joseph W. joe.fowler at nist.gov
Thu Jan 24 01:40:47 UTC 2013


Dear kst team:

I'm considering new data file format options for a scientific data set, and I am attracted to the "ragged arrays" supported by NetCDF version 4.  It goes without saying that I'll want to use kst to visualize the data in real time and after the fact.  I see from the mailing list (July 2012) that Ross Williamson has privately made mods to kst's netCDF plugin that would support version 4 files, but I gather that this support isn't in the release version of kst2.  (Not sure, though.  Perhaps I am just making NetCDF4 files that are invalid in some way.)

The python script below makes simple NetCDF files in each of 4 flavors (provided that you have py-netCDF4 installed, of course).  My kst2 correctly recognizes the two NetCDF3 files as NetCDF, but it recognizes the two NetCDF4 files as ASCII (which is technically true, but unhelpful).

I am using the compiled Mac OSX disk image downloaded yesterday from source forge, kst version 2.0.6 (Revision 1307223), on an OS 10.8 (Mountain Lion) Mac Pro.  

My questions are:

1. It seems like standard kst2 doesn't read NetCDF4 files.  Is that true?
2. If not, is such a feature imminent, likely, or possible?
3. Another thread on this mailing list seemed to state that NetCDF files cannot be used in live (streaming) mode.  True?

If the answers are "true", "not imminent", and "true" then I guess I should choose dirfiles/getdata instead.

Many thanks,
Joe
NIST Boulder Labs, Quantum Sensors Project



#!/usr/bin/env python

"""
Example script to make 4 flavors of NetCDF version 3 and 4 data files.
"""

import netCDF4, numpy

def test_fileflavors(filename, format):
        rootgrp = netCDF4.Dataset(filename, 'w', format=format)
        time = rootgrp.createDimension('time', None)
        times = rootgrp.createVariable('times', 'i2', ('time',))
        rand1 = rootgrp.createVariable('random', 'f4', ('time',))
        times[:] = numpy.arange(1000)
        rand1[:] = numpy.random.standard_normal(1000)
        rootgrp.close()

def main():
    test_fileflavors("example_cdf3a.nc", "NETCDF3_CLASSIC")
    test_fileflavors("example_cdf3b.nc", "NETCDF3_64BIT")
    test_fileflavors("example_cdf4a.nc", "NETCDF4_CLASSIC")
    test_fileflavors("example_cdf4b.nc", "NETCDF4")

if __name__=='__main__': main()



More information about the Kst mailing list