open

asdf.open(fd, uri=None, mode=None, validate_checksums=False, extensions=None, ignore_version_mismatch=NotSet, ignore_unrecognized_tag=False, _force_raw_types=False, copy_arrays=NotSet, memmap=NotSet, lazy_tree=NotSet, lazy_load=True, custom_schema=None, strict_extension_check=False, ignore_missing_extensions=False, _get_yaml_content=False)

Open an existing ASDF file.

Parameters:
fdstring or file-like object

May be a string file or http URI, or a Python file-like object.

uristring, optional

The URI of the file. Only required if the URI can not be automatically determined from fd.

modestring, optional

The mode to open the file in. Must be r (default) or rw.

validate_checksumsbool, optional

If True, validate the blocks against their checksums. Requires reading the entire file, so disabled by default.

extensionsobject, optional

Additional extensions to use when reading and writing the file. May be an asdf.extension.Extension or a list of extensions.

ignore_version_mismatchbool, optional

Deprecated and unused. This setting does nothing since asdf 3.0.0 When True, do not raise warnings for mismatched schema versions. Set to True by default.

ignore_unrecognized_tagbool, optional

When True, do not raise warnings for unrecognized tags. Set to False by default.

copy_arraysbool, optional

Deprecated; use memmap instead. When False, when reading files, attempt to memmap underlying data arrays when possible.

memmapbool, optional

When True, when reading files, attempt to memmap underlying data arrays when possible. When set, this argument will override copy_arrays. The default will change to False in an upcoming ASDF version. At the moment the default is True.

lazy_loadbool, optional

When True and the underlying file handle is seekable, data arrays will only be loaded lazily: i.e. when they are accessed for the first time. In this case the underlying file must stay open during the lifetime of the tree. Setting to False causes all data arrays to be loaded up front, which means that they can be accessed even after the underlying file is closed. Note: even if lazy_load is False, memmap is still taken into account.

lazy_treebool, optional

When True the ASDF tree will not be converted to custom objects when the file is loaded. Instead, objects will be “lazily” converted only when they are accessed. Note that the tree will not contain dict and list instances for containers and instead return instances of classes defined in asdf.lazy_nodes. Since objects are converted when they are accessed, traversing the tree (like is done during AsdfFile.info and AsdfFile.search) will result in nodes being converted.

custom_schemastr, optional

Path to a custom schema file that will be used for a secondary validation pass. This can be used to ensure that particular ASDF files follow custom conventions beyond those enforced by the standard.

strict_extension_checkbool, optional

When True, if the given ASDF file contains metadata about the extensions used to create it, and if those extensions are not installed, opening the file will fail. When False, opening a file under such conditions will cause only a warning. Defaults to False.

ignore_missing_extensionsbool, optional

When True, do not raise warnings when a file is read that contains metadata about extensions that are not available. Defaults to False.

Returns:
asdffileAsdfFile

The new AsdfFile object.