Unverified Commit 8472c0c8 authored by Timothy Clark's avatar Timothy Clark Committed by GitHub
Browse files

add Dawn PCK kernels (#5131)



* add switch for granual kernals

* add exception for invalid source types

* Updated CHANGELOG.md

* Updated source type check to include all keys in constant SOURCE_PATH

---------

Co-authored-by: default avatarClark <tclark@igswzawglt00014.gs.doi.net>
parent 330343e0
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -36,6 +36,7 @@ release.
## [Unreleased]
## [Unreleased]


### Changed
### Changed
- Updated download location for Dawn source files to include updated pck from HAMO Dawn mosaic [#4001](https://github.com/USGS-Astrogeology/ISIS3/issues/4001)
- Pinned cspice version to 67 [#5083](https://github.com/USGS-Astrogeology/ISIS3/issues/5083) 
- Pinned cspice version to 67 [#5083](https://github.com/USGS-Astrogeology/ISIS3/issues/5083) 


### Added
### Added
+8 −0
Original line number Original line Diff line number Diff line
@@ -16,6 +16,10 @@ url = http://naif.jpl.nasa.gov/
type = http
type = http
url = http://www.darts.isas.jaxa.jp/
url = http://www.darts.isas.jaxa.jp/


[sbn]
type =http
url =https://sbnarchive.psi.edu/pds3/

[control_usgs]
[control_usgs]
type = alias
type = alias
remote = asc_s3:asc-isisdata/usgs_data/control/
remote = asc_s3:asc-isisdata/usgs_data/control/
@@ -52,6 +56,10 @@ remote = naif:/pub/naif/DAWN/kernels/
type = alias
type = alias
remote = asc_s3:asc-isisdata/usgs_data/dawn/
remote = asc_s3:asc-isisdata/usgs_data/dawn/


[dawn_pck]
type =alias
remote = sbn:dawn/fc/DWNCHSPG_2/GEOMETRY/

[cassini_naifKernels]
[cassini_naifKernels]
type = alias
type = alias
remote = naif:/pub/naif/CASSINI/kernels/
remote = naif:/pub/naif/CASSINI/kernels/
+27 −4
Original line number Original line Diff line number Diff line
@@ -12,6 +12,18 @@ from shutil import which
from os import path
from os import path
from collections import OrderedDict
from collections import OrderedDict


SOURCE_PATH = {
    "naifKernels": "kernels",
    "pck": "kernels/pck",
    "ck":"kernels/ck",
    "spk":"kernels/spk",
    "fk": "kernels/fk",
    "iak":"kernels/iak",
    "sclk":"kernels/sclk",
    "tspk":"kernels/tspk",
    "usgs":""
}

def find_conf():
def find_conf():
    from pathlib import Path
    from pathlib import Path
    local_path = Path("rclone.conf")
    local_path = Path("rclone.conf")
@@ -88,6 +100,18 @@ def rclone(command, config=None, extra_args=[], redirect_stdout=True, redirect_s
        raise Exception(message)
        raise Exception(message)




def get_kernal_destination_path(source_type):

    try:
        source_path = SOURCE_PATH.get(source_type)
    except KeyError as e:
        
        raise KeyError(f"kernal path not found. Source type {source_type} is invalid")

    log.debug(f"source path for {source_type} is {source_path}" )
    return source_path


def create_rclone_arguments(destination, mission_name, ntransfers=10, rclone_kwargs=[]):
def create_rclone_arguments(destination, mission_name, ntransfers=10, rclone_kwargs=[]):
    """
    """
    Parameters
    Parameters
@@ -107,9 +131,8 @@ def create_rclone_arguments(destination, mission_name, ntransfers=10, rclone_kwa
    log.debug(f"Mission_dir_name: {mission_dir_name}, source_type: {source_type}")
    log.debug(f"Mission_dir_name: {mission_dir_name}, source_type: {source_type}")


    destination = os.path.join(destination, str(mission_dir_name).replace(":",""))
    destination = os.path.join(destination, str(mission_dir_name).replace(":",""))
    if source_type == "naifKernels":
    #add kernal directory path if needed
        destination = os.path.join(destination, "kernels")
    destination = os.path.join(destination, get_kernal_destination_path(source_type))

    extra_args=[f"{mission_name}",f"{destination}", "--progress", f"--checkers={ntransfers}", f"--transfers={ntransfers}", "--track-renames", f"--log-level={log.getLevelName(log.getLogger().getEffectiveLevel())}"]
    extra_args=[f"{mission_name}",f"{destination}", "--progress", f"--checkers={ntransfers}", f"--transfers={ntransfers}", "--track-renames", f"--log-level={log.getLevelName(log.getLogger().getEffectiveLevel())}"]


    extra_args.extend(rclone_kwargs)
    extra_args.extend(rclone_kwargs)
@@ -146,7 +169,7 @@ def main(mission, dest, cfg_path, ntransfers, kwargs):
    for source in sorted(config_sources, key=lambda x: x.split("_")[-1]):
    for source in sorted(config_sources, key=lambda x: x.split("_")[-1]):
        parsed_name = source.split("_")
        parsed_name = source.split("_")
        # If it is a mission, it should be in the format <mission_nam>_<source_type>
        # If it is a mission, it should be in the format <mission_nam>_<source_type>
        if len(parsed_name) == 2 and parsed_name[1] in ["usgs:", "naifKernels:"]:
        if len(parsed_name) == 2 and parsed_name[1].replace(":","") in SOURCE_PATH.keys():
            remotes_mission_name = parsed_name[0]
            remotes_mission_name = parsed_name[0]
            supported_missions[remotes_mission_name] = supported_missions.get(remotes_mission_name, []) + [source]
            supported_missions[remotes_mission_name] = supported_missions.get(remotes_mission_name, []) + [source]