vyperdatum.drivers.npz

Classes

NPZ

Handle loading and parsing of a .npz (numpy arrays) file.

Module Contents

class vyperdatum.drivers.npz.NPZ(input_file: str, invalid_error: bool = True)

Bases: vyperdatum.drivers.base.Driver

Handle loading and parsing of a .npz (numpy arrays) file.

input_file

Full path to the npz file.

Type:

str

content

The object containing the numpy arrays stored in the npz file.

Type:

np.lib.npyio.NpzFile

Example

>>> npz = NPZ('PATH_TO_NPZ_FILE')
>>> x, y, z, u = npz.xyzu()
>>> wkt = npz.wkt()
>>> mmx, mmy, mmz, mmu = npz.minmax()
input_file
content
load() numpy.lib.npyio.NpzFile

Load a numpy .npz file (collection of numpy arrays). Return None when any exception take place or when the file is invalid.

Raises:
  • ValueError: – If the file path is missing.

  • FileNotFoundError: – If the input file is not found.

  • TypeError: – If key names in the .npz file didn’t match the expected names.

Return type:

Optional[numpy.lib.npyio.NpzFile]

xyzu() Tuple[numpy.ndarray]

Slice the data array to extract x, y, z, u arrays.

Returns:

  • x (numpy.ndarray) – x coordinate numpy array.

  • y (numpy.ndarray) – y coordinate numpy array.

  • z (numpy.ndarray) – z coordinate numpy array.

  • u (numpy.ndarray) – uncertainty numpy array.

wkt() str

Return wkt stored in the npz file.

minmax() Tuple[numpy.ndarray]

Extract the minmax values of the coordinated and uncertainty arrays.

Returns:

  • x (numpy.ndarray) – x coordinate numpy array.

  • y (numpy.ndarray) – y coordinate numpy array.

  • z (numpy.ndarray) – z coordinate numpy array.

  • u (numpy.ndarray) – uncertainty numpy array.

transform(transformer_instance, vdatum_check: bool) bool

Apply point transformation on npz data according to the transformer_instance.

Parameters:

transformer_instance (vyperdatum.transformer.Transform) – Instance of the transformer class.

Returns:

True if successful, otherwise False.

Return type:

bool

property is_valid