Open a PyTables (or generic HDF5) file and return a File object. Parameters ---------- filename : str The name of the file (supports environment variable expansion). It is suggested that file names have any of the .h5, .hdf or .hdf5 extensions, although this is n
(
filename: str,
mode: Literal["r", "w", "a", "r+"] = "r",
title: str = "",
root_uep: str = "/",
filters: Filters | None = None,
**kwargs,
)
| 214 | |
| 215 | |
| 216 | def open_file( |
| 217 | filename: str, |
| 218 | mode: Literal["r", "w", "a", "r+"] = "r", |
| 219 | title: str = "", |
| 220 | root_uep: str = "/", |
| 221 | filters: Filters | None = None, |
| 222 | **kwargs, |
| 223 | ) -> File: |
| 224 | """Open a PyTables (or generic HDF5) file and return a File object. |
| 225 | |
| 226 | Parameters |
| 227 | ---------- |
| 228 | filename : str |
| 229 | The name of the file (supports environment variable expansion). |
| 230 | It is suggested that file names have any of the .h5, .hdf or |
| 231 | .hdf5 extensions, although this is not mandatory. |
| 232 | mode : str |
| 233 | The mode to open the file. It can be one of the |
| 234 | following: |
| 235 | |
| 236 | * *'r'*: Read-only; no data can be modified. |
| 237 | * *'w'*: Write; a new file is created (an existing file |
| 238 | with the same name would be deleted). |
| 239 | * *'a'*: Append; an existing file is opened for reading and |
| 240 | writing, and if the file does not exist it is created. |
| 241 | * *'r+'*: It is similar to 'a', but the file must already |
| 242 | exist. |
| 243 | |
| 244 | title : str |
| 245 | If the file is to be created, a TITLE string attribute will be |
| 246 | set on the root group with the given value. Otherwise, the |
| 247 | title will be read from disk, and this will not have any effect. |
| 248 | root_uep : str |
| 249 | The root User Entry Point. This is a group in the HDF5 hierarchy |
| 250 | which will be taken as the starting point to create the object |
| 251 | tree. It can be whatever existing group in the file, named by |
| 252 | its HDF5 path. If it does not exist, an HDF5ExtError is issued. |
| 253 | Use this if you do not want to build the *entire* object tree, |
| 254 | but rather only a *subtree* of it. |
| 255 | |
| 256 | .. versionchanged:: 3.0 |
| 257 | The *rootUEP* parameter has been renamed into *root_uep*. |
| 258 | |
| 259 | filters : Filters |
| 260 | An instance of the Filters (see :ref:`FiltersClassDescr`) class |
| 261 | that provides information about the desired I/O filters |
| 262 | applicable to the leaves that hang directly from the *root group*, |
| 263 | unless other filter properties are specified for these leaves. |
| 264 | Besides, if you do not specify filter properties for child groups, |
| 265 | they will inherit these ones, which will in turn propagate to |
| 266 | child nodes. |
| 267 | |
| 268 | Notes |
| 269 | ----- |
| 270 | In addition, it recognizes the (lowercase) names of parameters |
| 271 | present in :file:`tables/parameters.py` as additional keyword |
| 272 | arguments. |
| 273 | See :ref:`parameter_files` for a detailed info on the supported |