vtkmodules.util.xarray_support#

Module Contents#

Classes#

VtkAccessor

vtkXArrayCFReader

Reads data from a file using the XArray readers and then connects the XArray data to the vtkNetCDFCFREader (using zero-copy when possible). At the moment, data is copied for coordinates (because they are converted to double in the reader) and for certain data that is subset either in XArray or in VTK. Lazy loading in XArray is respected, that is data is accessed only when it is needed. Time is passed to VTK either as an int64 for datetime64 or timedelta64, or as a double (using cftime.toordinal) for cftime.

API#

class vtkmodules.util.xarray_support.VtkAccessor(dsxr)#

Initialization

create_reader()#

Returns a vtkXArrayCFReader that reads data from the XArray (using zero-copy when possible). At the moment, data is copied for coordinates (because they are converted to double in the reader) and for certain data that is subset either in XArray or in VTK. Lazy loading in XArray is respected, that is data is accessed only when it is needed. Time is passed to VTK either as an int64 for datetime64 or timedelta64, or as a double (using cftime.toordinal) for cftime.

class vtkmodules.util.xarray_support.vtkXArrayCFReader#

Bases: vtkmodules.util.vtkAlgorithm.VTKPythonAlgorithmBase

Reads data from a file using the XArray readers and then connects the XArray data to the vtkNetCDFCFREader (using zero-copy when possible). At the moment, data is copied for coordinates (because they are converted to double in the reader) and for certain data that is subset either in XArray or in VTK. Lazy loading in XArray is respected, that is data is accessed only when it is needed. Time is passed to VTK either as an int64 for datetime64 or timedelta64, or as a double (using cftime.toordinal) for cftime.

Initialization

Sets up default NumberOfInputPorts, NumberOfOutputPorts, InputType and OutputType that are used by various methods. Make sure to call this method from any subclass’ init

_FORWARD_GET#

None

_FORWARD_SET#

None

__getattr__(name)#
SetFileName(name)#

Specify filename for the file to read.

GetFileName()#
CanReadFile(filepath)#
SetNode(node)#
GetNode()#
SetXArray(dsxr)#
GetXArray()#
RequestDataObject(request, inInfo, outInfo)#
RequestInformation(request, inInfo, outInfo)#
RequestUpdateExtent(request, inInfo, outInfo)#
RequestData(request, inInfo, outInfo)#
static _get_nc_type(numpy_array_type)#

Returns a nc_type given a numpy array.

_update_accessor()#
_get_accessor()#
_set_data_vars(accessor, dsxr)#
_get_coords_bounds()#

Special data_vars associated coords

static _cftime_toordinal(o)#