to_hats

Contents

to_hats#

to_hats(catalog: HealpixDataset, *, base_catalog_path: str | Path | UPath, catalog_name: str | None = None, default_columns: list[str] | None = None, inherit_provenance: bool = False, addl_hats_properties: dict | None = None, histogram_order: int | None = None, overwrite: bool = False, resume: bool = False, progress_bar: bool = True, tqdm_kwargs: dict | None = None, create_parquet_metadata: bool = True, create_thumbnail: bool = False, create_per_partition_statistics: bool = True, error_if_empty: bool = True, create_summary: bool = False, should_write_skymap: bool = True, skymap_alt_orders: list[int] | None = None, npix_suffix: str = '.parquet', npix_parquet_name: str | None = None, write_table_kwargs: dict | None = None)[source]#

Writes a catalog to disk, in HATS format.

The output catalog comprises partitioned parquet files and respective metadata, as well as text and CSV files detailing partition, catalog and provenance info.

This will only write a SINGLE catalog, so if this catalog contains margins, you should use to_collection to write all parts of the catalog together.

Parameters:
catalogHealpixDataset

A catalog to export

base_catalog_pathpath-like

Location where catalog is saved to

catalog_namestr or None, default None

The name of the output catalog

default_columnslist[str] or None, default None

A metadata property with the list of the columns in the catalog to be loaded by default. Uses the default columns from the original hats catalog if they exist.

inherit_provenancebool, default False

If the original catalog had some provenance info (like creator or bib references), should this new catalog retain all of it?

addl_hats_propertiesdict or None, default None

key-value pairs of additional properties to write in the hats.properties file.

histogram_orderint or None, default None

The default order for the count histogram. Defaults to the same skymap order as original catalog, or the highest order healpix of the current catalog data partitions.

overwritebool, default False

If True existing catalog is overwritten

resumebool, default False

If True, will attempt to resume a previously interrupted write to the same directory.

progress_barbool, default True

If True, shows a progress bar for the export process. Defaults to True.

tqdm_kwargsdict, default None

Additional kwargs to pass to the tqdm progress bar.

create_parquet_metadatabool, default True

Should we create /dataset/_metadata parquet from all data partitions.

create_thumbnailbool, default False

If True, create a data thumbnail of the catalog for previewing purposes. Defaults to False.

create_per_partition_statisticsbool, default True

Should we create per_partition_statistics.parquet, based on footers from all data partitions

error_if_emptybool, default True

If True, raises an error if the output catalog is empty

create_summarybool, default False

If True, writes a README.md summary file describing the catalog.

should_write_skymap: bool, default True

Should we write a skymap.fits file, with the point distribution of the catalog? Main catalogs should contain skymap fits files, generally.

skymap_alt_orderslist[int] or None, default None

We will write a skymap file at the histogram_order, but can also write down-sampled skymaps, for easier previewing of the data.

npix_suffixstr, default ‘.parquet’

Extension for the parquet file (or / if a directory)

npix_parquet_namestr | None, default None

Name of the pixel parquet file to be used when npix_suffix=/. By default, it will be named after the pixel with a .parquet extension (e.g. ‘Npix=10.parquet’).

write_table_kwargs: dict or None, default None

Arguments to pass to the parquet write operations