gridncSileSiesta

class sisl.io.siesta.gridncSileSiesta(filename, mode='r', lvl=0, access=1, *args, **kwargs)[source]

NetCDF real-space grid file

Attributes

base_file

File of the current Sile

file

File of the current Sile

Methods

__init__(self, filename[, mode, lvl, access])

Initialize self.

close(self)

dir_file(self[, filename])

File of the current Sile

exist(self)

Query whether the file exists

iter(self[, group, dimension, variable, …])

Iterator on all groups, variables and dimensions.

read(self, \*args, \*\*kwargs)

Generic read method which should be overloaded in child-classes

read_grid(self[, spin, name])

Reads a grid in the current Siesta.grid.nc file

read_supercell(self)

Returns a SuperCell object from a Siesta.grid.nc file

write(self, \*args, \*\*kwargs)

Generic write method which should be overloaded in child-classes

write_grid(self, grid[, spin, nspin])

Write a grid to the grid.nc file

write_supercell(self, sc)

Write a supercell to the grid.nc file

property base_file

File of the current Sile

close(self)
dir_file(self, filename=None)

File of the current Sile

exist(self)

Query whether the file exists

property file

File of the current Sile

iter(self, group=True, dimension=True, variable=True, levels=-1, root=None)

Iterator on all groups, variables and dimensions.

This iterator iterates through all groups, variables and dimensions in the Dataset

The generator sequence will _always_ be:

  1. Group

  2. Dimensions in group

  3. Variables in group

As the dimensions are generated before the variables it is possible to copy groups, dimensions, and then variables such that one always ensures correct dependencies in the generation of a new SileCDF.

Parameters
groupbool (True)

whether the iterator yields Group instances

dimensionbool (True)

whether the iterator yields Dimension instances

variablebool (True)

whether the iterator yields Variable instances

levelsint (-1)

number of levels to traverse, with respect to root variable, i.e. number of sub-groups this iterator will return.

rootstr (None)

the base root to start iterating from.

Examples

Script for looping and checking each instance.

>>> for gv in self.iter():
...     if self.isGroup(gv):
...         # is group
...     elif self.isDimension(gv):
...         # is dimension
...     elif self.isVariable(gv):
...         # is variable
read(self, *args, **kwargs)

Generic read method which should be overloaded in child-classes

Parameters
kwargs :

keyword arguments will try and search for the attribute read_<> and call it with the remaining **kwargs as arguments.

read_grid(self, spin=0, name='gridfunc', *args, **kwargs)[source]

Reads a grid in the current Siesta.grid.nc file

Enables the reading and processing of the grids created by Siesta

Parameters
spinint or array_like, optional

specify the retrieved values

namestr, optional

the name for the grid-function (do not supply for standard Siesta output)

read_supercell(self)[source]

Returns a SuperCell object from a Siesta.grid.nc file

write(self, *args, **kwargs)

Generic write method which should be overloaded in child-classes

Parameters
**kwargs :

keyword arguments will try and search for the attribute write_ and call it with the remaining **kwargs as arguments.

write_grid(self, grid, spin=0, nspin=None)[source]

Write a grid to the grid.nc file

write_supercell(self, sc)[source]

Write a supercell to the grid.nc file