Pyclaw Input/Output Package

Pyclaw supports the following input and output formats:

  • ASCII - ASCII file I/O, supports traditional clawpack format files
  • HDF5 - HDF5 file I/O
  • NetCDF - NetCDF file I/O, support for NetCDF3 and NetCDF4 files

Each module contains two main routines read_<format> and write_<format> which Solution can call with the appropriate <format>. In order to create a new file I/O extension the calling signature must match

read_<format>(solution,frame,path,file_prefix,write_aux,options)
where the the inputs are
Input:
  • solution - (Solution) Pyclaw object to be output
  • frame - (int) Frame number
  • path - (string) Root path
  • file_prefix - (string) Prefix for the file name.
  • write_aux - (bool) Boolean controlling whether the associated auxiliary array should be written out.
  • options - (dict) Optional argument dictionary

and

write_<format>(solution,frame,path,file_prefix,write_aux,options)
where the inputs are
Input:
  • solution - (Solution) Pyclaw object to be output
  • frame - (int) Frame number
  • path - (string) Root path
  • file_prefix - (string) Prefix for the file name.
  • write_aux - (bool) Boolean controlling whether the associated auxiliary array should be written out.
  • options - (dict) Optional argument dictionary.

Note that both allow for an options dictionary that is format specific and should be documented thoroughly. For examples of this usage, see the HDF5 and NetCDF modules.

HDF5 and NetCDF support require installed libraries in order to work, please see the respective modules for details on how to obtain and install the libraries needed.

Note

Pyclaw automatically detects the availability of HDF5 and NetCDF file support and will warn you if you try and use them without the proper libraries.

pyclaw.io.ascii

System Message: WARNING/2 (/var/folders/_s/dx0xgftn3_x04rdx0_w5nq7w0000gn/T/tmplBPRI1sphinxcontrib_versioning/8b07e169f86998872fc1cf3755d1b7f4a8c40a33/doc/pyclaw/io.rst, line 71)

autodoc: failed to import module u’pyclaw.io.ascii’; the following exception was raised: Traceback (most recent call last): File “/usr/local/lib/python2.7/site-packages/sphinx/ext/autodoc.py”, line 551, in import_object __import__(self.modname) ImportError: No module named pyclaw.io.ascii

pyclaw.io.hdf5

System Message: WARNING/2 (/var/folders/_s/dx0xgftn3_x04rdx0_w5nq7w0000gn/T/tmplBPRI1sphinxcontrib_versioning/8b07e169f86998872fc1cf3755d1b7f4a8c40a33/doc/pyclaw/io.rst, line 79)

autodoc: failed to import module u’pyclaw.io.hdf5’; the following exception was raised: Traceback (most recent call last): File “/usr/local/lib/python2.7/site-packages/sphinx/ext/autodoc.py”, line 551, in import_object __import__(self.modname) ImportError: No module named pyclaw.io.hdf5

pyclaw.io.netcdf

System Message: WARNING/2 (/var/folders/_s/dx0xgftn3_x04rdx0_w5nq7w0000gn/T/tmplBPRI1sphinxcontrib_versioning/8b07e169f86998872fc1cf3755d1b7f4a8c40a33/doc/pyclaw/io.rst, line 87)

autodoc: failed to import module u’pyclaw.io.netcdf’; the following exception was raised: Traceback (most recent call last): File “/usr/local/lib/python2.7/site-packages/sphinx/ext/autodoc.py”, line 551, in import_object __import__(self.modname) ImportError: No module named pyclaw.io.netcdf