NcNodeMapper

class tollan.utils.nc.NcNodeMapper(nc_node_map=None, source=None, **kwargs)[source]

Bases: contextlib.ExitStack, tollan.utils.nc.NcNodeMapperMixin

A adaptor class that accesses netCDF4 dataset with a custom name map.

Parameters
sourcestr, pathlib.Path, FileLoc, netCDF4.Dataset

The netCDF file location or netCDF dataset.

Attributes Summary

file_loc

The opened file.

logger

Methods Summary

open(source, **kwargs)

Return a context to operate on source.

set_nc_node(nc_node)

Set the node to map.

sync()

Sync the underlying file.

Attributes Documentation

file_loc

The opened file.

logger = <Logger NcNodeMapper (WARNING)>

Methods Documentation

open(source, **kwargs)[source]

Return a context to operate on source.

Parameters
sourcestr, pathlib.Path, FileLoc, netCDF4.Dataset

The netCDF file location or netCDF dataset.

**kwargs :

The keyword arguments passed to netCDF4.Dataset constructor.

set_nc_node(nc_node)[source]

Set the node to map.

This assumes the nc_node is an externally opened dataset.

sync()[source]

Sync the underlying file.