BasicObsData¶
- class tolteca.datamodels.toltec.BasicObsData(source, open_=True)[source]¶
Bases:
tolteca.datamodels.io.base.DataFileIO
A class that provides unified IO interface to TolTEC basic obs data.
This class acts as a simple wrapper around the data file IO classes defined in
toltec
module, and provides an unified interface to handle high level information of data items that are of different types, or located on remote file systems.If the source points to a local file, the
file_obj
is available and can be used to access the data:>>> from tolteca.datamodels.toltec import BasicObsData >>> bod = BasicObsData('toltec0.nc') >>> with bod.open() as fo: >>> # ``fo`` is a `~tolteca.datamodels.io.toltec.NcFileIO` >>> # instance. >>> kidsdata = fo.read()
The above can also be done via the
BasicObsData.open()
shortcut as follows:>>> with BasicObsData.open('toltec0.nc') as fo: >>> kidsdata = fo.read()
This can further be shortened as:
>>> kidsdata = BasicObsData.read('toltec0.nc')
When
file_loc
is a remote file,file_obj
isNone
, and (of course) attempting to open the file will raiseDataFileIOError
.In both cases, various information of the data is pulled and stored in
meta
. In particular, whenfile_obj
is available (local file), the meta data includes those from the header of the opened data file.- Parameters
- sourcestr,
Path
,FileLoc
. The data file location. Remote locations can be specified in either URL or SFTP format
<host>:<path>
.- open_: bool
If True, attemp to open the file to load meta data.
- sourcestr,
Attributes Summary
Methods Summary
open
(*args, **kwargs)Shortcut to open the file.
read
(*args, **kwargs)Shortcut to read the file.
update_meta_from_file_loc
(meta, file_loc)Update
meta
with info encoded infile_loc
.update_meta_from_file_obj
(meta, file_obj)Update
meta
with header offile_obj
.Attributes Documentation
- logger = <Logger BasicObsData (DEBUG)>¶
Methods Documentation