hats.loaders.read_hats#

Attributes#

Functions#

read_hats(catalog_path, *[, single_catalog, read_moc, ...]) → hats.catalog.catalog_collection.CatalogCollection | hats.catalog.catalog_extension.CatalogExtension | hats.catalog.Dataset

Reads a HATS Catalog from a HATS directory, or a catalog extension from its

Module Contents#

DATASET_TYPE_TO_CLASS[source]#
read_hats(catalog_path: str | pathlib.Path | upath.UPath, *, single_catalog: bool | None = None, read_moc: bool = True, storage_options: dict | None = None) → hats.catalog.catalog_collection.CatalogCollection | hats.catalog.catalog_extension.CatalogExtension | hats.catalog.Dataset[source]#

Reads a HATS Catalog from a HATS directory, or a catalog extension from its <extension>.properties file.

Parameters:
catalog_pathstr | Path | UPath

path to the root directory of the catalog, or to an <extension>.properties file

single_catalog: bool

If you happen to already know that the catalog_path points to a single catalog, instead of a catalog collection, this flag can save a few file read operations.

read_moc: bool

If you happen to know that your catalog does not have a MOC (or if you know that your use case will not utilize a MOC), then you can skip the file read and memory load of the MOC.

storage_options: dict or None, default None

additional options for connecting to the catalog, or a collection’s affiliated tables.

Returns:
CatalogCollection | CatalogExtension | Dataset

HATS catalog found at directory, or the extension described by the file

Examples

To read a catalog from a public S3 bucket, call it as follows:

from upath import UPath
catalog = hats.read_hats(UPath(..., anon=True))