hats.io.paths#
Methods for creating partitioned data paths
Attributes#
Functions#
|
Create path pointer for the dataset directory. This will not create the directory. |
|
Create path pointer for a pixel directory. This will not create the directory. |
Find the pixel_order and pixel_number from a string like the |
|
|
Converts a dictionary to a url query parameter string |
|
Create path pointer for a pixel catalog file. This will not create the directory |
|
Get file pointer to |
|
Get file pointer to _common_metadata parquet metadata file |
|
Get file pointer to _metadata parquet metadata file |
|
Get file pointer to data_thumbnail parquet file |
|
Get file pointer to point_map.fits FITS image file. |
|
Get file pointer to skymap.fits or skymap.K.fits FITS image file. |
Module Contents#
- dataset_directory(catalog_base_dir: str | pathlib.Path | upath.UPath | None) upath.UPath[source]#
Create path pointer for the dataset directory. This will not create the directory.
The directory name will take the HiPS standard form of:
<catalog_base_dir>/dataset/
- Parameters:
- catalog_base_dirstr | Path | UPath | None
base directory of the catalog (includes catalog name)
- Returns:
- UPath
dataset directory name
- pixel_directory(catalog_base_dir: str | pathlib.Path | upath.UPath | None, pixel_order: int, pixel_number: int | None = None, directory_number: int | None = None) upath.UPath[source]#
Create path pointer for a pixel directory. This will not create the directory.
One of pixel_number or directory_number is required. The directory name will take the HiPS standard form of:
<catalog_base_dir>/dataset/Norder=<pixel_order>/Dir=<directory number>
Where the directory number is calculated using integer division as:
(pixel_number/10000)*10000
- Parameters:
- catalog_base_dirstr | Path | UPath | None
base directory of the catalog (includes catalog name)
- pixel_orderint
the healpix order of the pixel
- pixel_numberint | None
the number of the healpix pixel at
pixel_order- directory_numberint | None
directory number (or inferred from pixel number)
- Returns:
- UPath
directory name
- get_healpix_from_path(path: str) hats.pixel_math.healpix_pixel.HealpixPixel[source]#
Find the pixel_order and pixel_number from a string like the following:
Norder=<pixel_order>/Dir=<directory number>/Npix=<pixel_number>.parquet
NB: This expects the format generated by the pixel_catalog_file method
- Parameters:
- pathstr
path to parse
- Returns:
- HealpixPixel
Constructed HealpixPixel object representing the pixel in the path.
INVALID_PIXELif the path doesn’t match the expected pattern for any reason.
- dict_to_query_urlparams(query_params: dict | None = None) str[source]#
Converts a dictionary to a url query parameter string
- Parameters:
- query_params: dict | None
(Default value = None) set of URL query parameters.
- Returns:
- str
query parameter string to append to a url
- pixel_catalog_file(catalog_base_dir: str | pathlib.Path | upath.UPath | None, pixel: hats.pixel_math.healpix_pixel.HealpixPixel, query_params: dict | None = None, npix_suffix: str = '.parquet') upath.UPath[source]#
Create path pointer for a pixel catalog file. This will not create the directory or file.
The catalog file name will take the HiPS standard form of:
<catalog_base_dir>/Norder=<pixel_order>/Dir=<directory number>/Npix=<pixel_number>.parquet
Where the directory number is calculated using integer division as:
(pixel_number/10000)*10000
- Parameters:
- catalog_base_dirstr | Path | UPath | None
base directory of the catalog (includes catalog name)
- pixelHealpixPixel
the healpix pixel to create path to
- query_params: dict | None
(Default value = None) Params to append to URL. Ex:
{'cols': ['ra', 'dec'], 'fltrs': ['r>=10', 'g<18']}
- npix_suffix: str
(Default value = “.parquet”) extension for the parquet file (or / if a directory)
- Returns:
- UPath
catalog file name
- get_partition_info_pointer(catalog_base_dir: str | pathlib.Path | upath.UPath) upath.UPath[source]#
Get file pointer to
partition_info.csvmetadata file- Parameters:
- catalog_base_dir: str | Path | UPath
base directory of the catalog (includes catalog name)
- Returns:
- UPath
File Pointer to the catalog’s
partition_info.csvfile
- get_common_metadata_pointer(catalog_base_dir: str | pathlib.Path | upath.UPath) upath.UPath[source]#
Get file pointer to _common_metadata parquet metadata file
- Parameters:
- catalog_base_dir: str | Path | UPath
base directory of the catalog (includes catalog name)
- Returns:
- UPath
File Pointer to the catalog’s _common_metadata file
- get_parquet_metadata_pointer(catalog_base_dir: str | pathlib.Path | upath.UPath) upath.UPath[source]#
Get file pointer to _metadata parquet metadata file
- Parameters:
- catalog_base_dir: str | Path | UPath
base directory of the catalog (includes catalog name)
- Returns:
- UPath
File Pointer to the catalog’s _metadata file
- get_data_thumbnail_pointer(catalog_base_dir: str | pathlib.Path | upath.UPath) upath.UPath[source]#
Get file pointer to data_thumbnail parquet file
- Parameters:
- catalog_base_dir: str | Path | UPath
base directory of the catalog (includes catalog name)
- Returns:
- UPath
File Pointer to the catalog’s data_thumbnail file
- get_point_map_file_pointer(catalog_base_dir: str | pathlib.Path | upath.UPath) upath.UPath[source]#
Get file pointer to point_map.fits FITS image file.
- Parameters:
- catalog_base_dir: str | Path | UPath
base directory of the catalog (includes catalog name)
- Returns:
- UPath
File Pointer to the catalog’s point_map.fits FITS image file.
- get_skymap_file_pointer(catalog_base_dir: str | pathlib.Path | upath.UPath, order: int | None = None) upath.UPath[source]#
Get file pointer to skymap.fits or skymap.K.fits FITS image file.
- Parameters:
- catalog_base_dir: str | Path | UPath
base directory of the catalog (includes catalog name)
- order: int | None
(Default value = None) desired order for the map, if looking for a down-sampled map.
- Returns:
- UPath
File Pointer to the FITS image file.