Projection


source

stitch_cubenorm


def stitch_cubenorm(
    spid1, spid2
):

Stitch together the 2 CCD chip images and perform a cubenorm operation. Parameters ———- spid1 : object The first CCD chip image object. Must have attributes local_cube and stitched_cube_path. spid2 : object The second CCD chip image object. Must have attributes local_cube and stitched_cube_path. Returns ——- normed : pathlib.Path The path to the normalized stitched cube file. Raises —— ProcessError If there is an error during the stitching or cubenorm process.


source

ensure_spice


def ensure_spice(
    cubepath
):

Check cube for SPICE data and run spiceinit if missing.

Returns True if SPICE data is present (or was successfully added), False on failure.


source

has_spice


def has_spice(
    cubepath
):

Check if an ISIS cube has SPICE data by looking for NaifKeywords in its label.


source

nocal_hi


def nocal_hi(
    source_product, # Class object managing the precise filenames and locations for HiRISE source products
):

Import HiRISE product into ISIS and spice-init it.


source

P4Mosaic


def P4Mosaic(
    obsid
):

A class to handle mosaic operations for a given observation ID. Parameters ———- obsid : str The observation ID used to locate the source product and mosaic path. Attributes ———- mosaic_path : pathlib.Path The path to the mosaic file. Methods ——- read() Reads the mosaic file and returns it as an xarray DataArray. show(xslice=None, yslice=None) Displays the mosaic image using hvplot with optional slicing.


source

create_RED45_mosaic


def create_RED45_mosaic(
    obsid, # The observation ID for which the RED45 mosaic is to be created.
    overwrite:bool=False, # If True, existing mosaic files will be overwritten. Default is False.
):

Create a RED45 mosaic from EDR data associated with a given observation ID.

If a single CCD channel fails to download (e.g. 404 from PDS), a NULL-filled dummy cube is created from the sibling channel so that histitch can proceed. The dummy contributes only NULL pixels — handmos treats these as transparent.


source

get_RED45_mosaic_inputs


def get_RED45_mosaic_inputs(
    obsid:str, # HiRISE observation id, e.g. ESP_011350_0945
    saveroot:Path=None, # Path to where the data is stored
)->list: # List of 4 hirise.RED_PRODUCTs: [RED4_0, RED4_1, RED5_0, RED5_1]

Create list with filenames for RED4 and RED5 CCD chips 0 and 1, respectively.


source

do_campt


def do_campt(
    mosaicname, savepath, temppath
):

Executes the campt command with the provided parameters from ISIS. Campt computes the geometric information like longitude and lattitude at a given pixel location. Parameters ———- mosaicname : str The name of the mosaic file to process. savepath : str The path where the output should be saved. temppath : str The path to the temporary file containing coordinates. Returns ——- tuple A tuple containing the mosaicname and a boolean indicating success (False if an error occurred).


source

XY2LATLON


def XY2LATLON(
    df, inpath, overwrite:bool=False, obsid:NoneType=None
):

A class to convert XY coordinates to latitude and longitude using ground projection data. Attributes ———- edrpath : str Path to the ground projection root directory. df : pandas.DataFrame DataFrame containing the data to be processed. obsid : str Observation ID, derived from the DataFrame if not provided. inpath : pathlib.Path Input path where the files are located. overwrite : bool Flag to indicate whether to overwrite existing files. p4m : P4Mosaic Instance of the P4Mosaic class for handling mosaic paths. Properties ———- obsid : str Gets or sets the observation ID. mosaicpath : str Returns the path to the mosaic file. savepath : pathlib.Path Returns the path to save the campt output CSV file. savepath_blotch : pathlib.Path Returns the path to save the blotch campt output CSV file. savepath_fan : pathlib.Path Returns the path to save the fan campt output CSV file. temppath : pathlib.Path Returns the temporary path for intermediate files. Methods ——- process_inpath(): Processes the input path and generates the necessary campt output files.


source

TileCalculator


def TileCalculator(
    cubepath, read_data:bool=True, dbname:NoneType=None
):

A class to calculate tile coordinates for HiRISE images. Parameters ———- cubepath : str or Path The path to the HiRISE image cube. read_data : bool, optional If True, reads data from the database (default is True). dbname : str, optional The name of the database to read data from (default is None). Attributes ———- cubepath : Path The path to the HiRISE image cube. data : DataFrame The observation ID markings data from the database. img_name : str The image name derived from the cube path. x_tile_max : int The maximum x tile value. y_tile_max : int The maximum y tile value. campt_results_path : Path The path to save the campt results. temppath : Path The temporary path for campt input coordinates. final_path : Path The final path to save the tile coordinates. tile_coords_df : DataFrame The DataFrame containing tile coordinates. Methods ——- get_xy_tiles() Returns a grid of x and y tile values. get_campt_input_coords() Returns a DataFrame with campt input coordinates. calc_tile_coords() Calculates and saves the tile coordinates.


source

p4tile_center_to_hirise_pix


def p4tile_center_to_hirise_pix(
    tile, x_or_y
):

source

p4pix_to_hirise_pix


def p4pix_to_hirise_pix(
    p4pix, # Coordinate value for either x or y dimension of P4 pixel
    tile, # x or y tile coordinate of PlanetFour
    x_or_y, # Switch between different coordinate transformations
):

This convert either x or y coordinate of a planet4 pixel to Hirise coordinate.