write_catalog#
- Catalog.write_catalog(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, as_collection: bool = True, 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]#
Save the catalog to disk in HATS format.
- Parameters:
- base_catalog_pathstr | Path | UPath,
Location where catalog is saved to
- catalog_namestr
The name of the catalog to be saved
- default_columnslist[str]
A metadata property with the list of the columns in the catalog to be loaded by default. 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.propertiesfile.- as_collectionbool, default True
If True, saves the catalog and its margin as a collection
- overwritebool, default False
If True existing catalog is overwritten
- resumebool, default False
If True, resumes a previous write operation, skipping partitions that were already written to disk.
- 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
README.mdsummary file(s) describing the catalog. Whenas_collectionis True, this generates a summary for the collection, the main catalog, and the margin (if it exists).- 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
Examples
Write a small synthetic catalog to disk:
>>> import lsdb >>> from lsdb import generate_data >>> nf = generate_data(1000, 5, seed=0, ra_range=(0.0, 300.0), dec_range=(-50.0, 50.0)) >>> catalog = lsdb.from_dataframe(nf.compute()[["ra", "dec", "id"]], catalog_name="demo") >>> catalog.write_catalog(<your path here> / "demo_catalog", overwrite=True)