Skip to content

Commit

Permalink
Specify argument name for optional storage_options argument. (#358)
Browse files Browse the repository at this point in the history
  • Loading branch information
delucchi-cmu authored Jun 13, 2024
1 parent fc3c7ef commit 73948db
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions src/lsdb/io/to_hipscat.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def perform_write(
pixel_dir = hc.io.pixel_directory(base_catalog_dir, hp_pixel.order, hp_pixel.pixel)
hc.io.file_io.make_directory(pixel_dir, exist_ok=True, storage_options=storage_options)
pixel_path = hc.io.paths.pixel_catalog_file(base_catalog_dir, hp_pixel.order, hp_pixel.pixel)
hc.io.file_io.write_dataframe_to_parquet(df, pixel_path, storage_options, **kwargs)
hc.io.file_io.write_dataframe_to_parquet(df, pixel_path, storage_options=storage_options, **kwargs)
return len(df)


Expand All @@ -72,7 +72,7 @@ def to_hipscat(
"""
base_catalog_dir_fp = hc.io.get_file_pointer_from_path(base_catalog_path)
# Create the output directory for the catalog
if hc.io.file_io.directory_has_contents(base_catalog_dir_fp, storage_options):
if hc.io.file_io.directory_has_contents(base_catalog_dir_fp, storage_options=storage_options):
if not overwrite:
raise ValueError(
f"base_catalog_path ({base_catalog_dir_fp}) contains files."
Expand All @@ -81,12 +81,14 @@ def to_hipscat(
hc.io.file_io.remove_directory(base_catalog_dir_fp, storage_options=storage_options)
hc.io.file_io.make_directory(base_catalog_dir_fp, exist_ok=True, storage_options=storage_options)
# Save partition parquet files
pixel_to_partition_size_map = write_partitions(catalog, base_catalog_dir_fp, storage_options, **kwargs)
pixel_to_partition_size_map = write_partitions(
catalog, base_catalog_dir_fp, storage_options=storage_options, **kwargs
)
# Save parquet metadata
hc.io.write_parquet_metadata(base_catalog_path, storage_options)
hc.io.write_parquet_metadata(base_catalog_path, storage_options=storage_options)
# Save partition info
partition_info = _get_partition_info_dict(pixel_to_partition_size_map)
hc.io.write_partition_info(base_catalog_dir_fp, partition_info, storage_options)
hc.io.write_partition_info(base_catalog_dir_fp, partition_info, storage_options=storage_options)
# Save catalog info
new_hc_structure = create_modified_catalog_structure(
catalog.hc_structure,
Expand Down Expand Up @@ -136,7 +138,7 @@ def write_partitions(
partitions[partition_index],
pixel,
base_catalog_dir_fp,
storage_options,
storage_options=storage_options,
**kwargs,
)
)
Expand Down
2 changes: 1 addition & 1 deletion src/lsdb/loaders/hipscat/abstract_catalog_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _get_paths_from_pixels(
self, catalog: HCHealpixDataset, ordered_pixels: List[HealpixPixel]
) -> List[hc.io.FilePointer]:
paths = hc.io.paths.pixel_catalog_files(
catalog.catalog_base_dir, ordered_pixels, self.storage_options
catalog.catalog_base_dir, ordered_pixels, storage_options=self.storage_options
)
return paths

Expand Down

0 comments on commit 73948db

Please sign in to comment.