예제 #1
0
def cubeit(fromlist, to_file, proplab=None):
    params = {"fromlist": fromlist, "to": to_file}
    if proplab is not None:
        params["proplab"] = proplab

    s = isis_command("cubeit", params)
    return s
예제 #2
0
def cam2map(from_cube, to_cube, projection="equirectangular", map=None, resolution="CAMERA", minlat=None, maxlat=None, minlon=None, maxlon=None, defaultrange="CAMERA"):

    if map is None:
        map = "%s/base/templates/maps/%s.map"%(os.environ["ISIS3DATA"], projection)

    params = {
        "from": from_cube,
        "to": to_cube,
        "map": map
    }

    if defaultrange is None and is_any_not_none([minlat, minlon, maxlat, maxlon]):
        defaultrange = "camera"

    params["defaultrange"] = defaultrange

    if minlat is not None:
        params["minlat"] = minlat
    if maxlat is not None:
        params["maxlat"] = maxlat
    if minlon is not None:
        params["minlon"] = minlon
    if maxlon is not None:
        params["maxlon"] = maxlon



    if resolution == "MAP":
        params["pixres"] = "map"

    s = isis_command("cam2map", params)
    return s
예제 #3
0
def map2map(from_cube, to_cube, map=None, projection="equirectangular", minlat=None, maxlat=None, minlon=None, maxlon=None):

    resolution = "MAP"
    if map is None:
        map = "%s/../data/base/templates/maps/%s.map"%(os.environ["ISISROOT"], projection)
        resolution = "FROM"

    params = {
        "from": from_cube,
        "to": to_cube,
        "map": map,
        "pixres": resolution
    }

    if minlat is not None:
        params["minlat"] = minlat
    if maxlat is not None:
        params["maxlat"] = maxlat
    if minlon is not None:
        params["minlon"] = minlon
    if maxlon is not None:
        params["maxlon"] = maxlon
    s = isis_command("map2map", params)

    return s
예제 #4
0
def histeq(from_cube, to_cube, minper=0.5, maxper=99.5):
    s = isis_command("histeq", {
        "from": from_cube,
        "to": to_cube,
        "minper": minper,
        "maxper": maxper
    })
    return s
예제 #5
0
def map2cam(from_cube, to_cube, cam):
    params = {
        "from": from_cube,
        "to": to_cube,
        "match": cam
    }
    s = isis_command("map2cam", params)
    return s
예제 #6
0
def fillgap(from_cube, to_cube, interp="cubic", direction="sample"):
    s = isis_command("fillgap", {
        "from": from_cube,
        "to": to_cube,
        "interp": interp,
        "direction": direction
    })
    return s
예제 #7
0
def cam2cam(from_cube, to_cube, match_cube, interp="CUBICCONVOLUTION"):
    params = {
        "from": from_cube,
        "to": to_cube,
        "match": match_cube,
        "interp": interp
    }
    s = isis_command("cam2cam", params)
    return s
예제 #8
0
def junocam2isis(from_file, to_file, fullccd=False):

    params = {"from": from_file, "to": to_file}

    if fullccd is True:
        params["fullccd"] = "yes"

    s = isis_command("junocam2isis", params)
    return s
예제 #9
0
def caminfo(from_cube, to_pvl, isislabel=True, originallabel=True):
    cmd = "caminfo"
    params = {
        "from": from_cube,
        "to": to_pvl,
        "isislabel": ("yes" if isislabel is True else "no"),
        "originallabel": ("yes" if originallabel is True else "no")
    }
    s = isis_command(cmd, params)
    return s
예제 #10
0
def std2isis(from_file, to_file, mode=ColorMode.AUTO):
    params = {
        "from": from_file,
        "to": to_file,
    }

    if mode != ColorMode.AUTO:
        params["mode"] = mode

    s = isis_command("std2isis", params)
    return s
예제 #11
0
def pad(from_file, to_file, left=0, right=0, bottom=0, top=0):
    params = {
        "from": from_file,
        "to": to_file,
        "top": top,
        "bottom": bottom,
        "left": left,
        "right": right
    }
    s = isis_command("pad", params)
    return s
예제 #12
0
def remrx(from_cube, to_cube, action="null", resvalid="false", sdim=9, ldim=9):

    params = {
        "from": from_cube,
        "to": to_cube,
        "action": action,
        "resvalid": resvalid,
        "SDIM": sdim,
        "LDIM": ldim
    }

    s = isis_command("remrx", params)
    return s
예제 #13
0
def isis2pds(from_file,
             to_file,
             labtype="fixed",
             bittype="32bit",
             pdsversion="pds3"):
    params = {
        "from": from_file,
        "to": to_file,
        "labtype": labtype,
        "bittype": bittype,
        "pdsversion": pdsversion
    }

    s = isis_command("isis2pds", params)
    return s
예제 #14
0
def ringscam2map(from_cube, to_cube, projection="ringscylindrical", map=None, resolution="CAMERA"):

    if map is None:
        map = "%s/../data/base/templates/maps/%s.map"%(os.environ["ISISROOT"], projection)

    params = {
        "from": from_cube,
        "to": to_cube,
        "map": map
    }

    if resolution == "MAP":
        params["pixres"] = "map"

    s = isis_command("ringscam2map", params)
    return s
예제 #15
0
def isis2std_rgb(from_cube_red,
                 from_cube_green,
                 from_cube_blue,
                 to_tiff,
                 minimum=None,
                 maximum=None,
                 match_stretch=False,
                 format="tiff",
                 bittype="u16bit",
                 maxpercent=99.999,
                 cleanup_print_file=True):
    cmd = "isis2std"
    params = {
        "red": "%s+1" % from_cube_red,
        "green": "%s+1" % from_cube_green,
        "blue": "%s+1" % from_cube_blue,
        "to": to_tiff,
        "format": format,
        "bittype": bittype,
        "mode": "rgb"
    }

    if match_stretch and minimum is not None and maximum is not None:
        params.update({
            "stretch": "manual",
            "rmin": minimum,
            "rmax": maximum,
            "gmin": minimum,
            "gmax": maximum,
            "bmin": minimum,
            "bmax": maximum
        })
    else:
        params["maxpercent"] = maxpercent

    s = isis_command(cmd, params)

    if cleanup_print_file:
        dirname = os.path.dirname(to_tiff)
        if len(dirname) > 0:
            dirname += "/"
        if os.path.exists("%sprint.prt" % dirname):
            os.unlink("%sprint.prt" % dirname)

    return s
예제 #16
0
def maptrim(from_cube,
            to_cube,
            mode="crop",
            minlat=-90,
            maxlat=90,
            minlon=-180,
            maxlon=180):
    s = isis_command(
        "maptrim", {
            "from": from_cube,
            "to": to_cube,
            "mode": mode,
            "minlat": minlat,
            "maxlat": maxlat,
            "minlon": minlon,
            "maxlon": maxlon
        })
    return s
예제 #17
0
def noisefilter(from_cube,
                to_cube,
                toldef="stddev",
                tolmin=2.5,
                tolmax=2.5,
                replace="null",
                samples=5,
                lines=5):
    s = isis_command(
        "noisefilter", {
            "from": from_cube,
            "to": to_cube,
            "toldef": toldef,
            "tolmin": tolmin,
            "tolmax": tolmax,
            "replace": replace,
            "samples": samples,
            "lines": lines
        })
    return s
예제 #18
0
def get_data_min_max(from_cube, band=-1):

    if band >= 1:
        from_cube = "%s+%s" % (from_cube, band)

    out = isis_command("stats", {"from": from_cube})

    min = 0
    max = 0

    pattern = re.compile(
        r"^ *(?P<key>[a-zA-Z0-9]*)[ =]+(?P<value>[\-A-Z0-9.e]*)")
    for line in out.split("\n"):
        match = pattern.match(line)
        if match is not None:
            key = match.group("key")
            value = match.group("value")
            if key == "Minimum":
                min = float(value)
            elif key == "Maximum":
                max = float(value)
    return min, max
예제 #19
0
def spiceinit(from_cube, is_ringplane=False, spkpredict=False, ckpredicted=False, cknadir=False, web=False):
    params = {
        "from": from_cube
    }

    if web is True:
        params["web"] = "yes"

    if spkpredict is True:
        params["spkpredict"] = "yes"

    if ckpredicted is True:
        params["ckpredicted"] = "yes"

    if cknadir is True:
        params["cknadir"] = "yes"

    if is_ringplane is True:
        params["shape"] = "ringplane"

    s = isis_command("spiceinit", params)
    return s
예제 #20
0
def getkey(from_file_name, keyword, objname=None, grpname=None, verbose=False):
    if from_file_name[-3:].upper() == "IMQ":
        return __getkey_voy2isis(from_file_name, keyword, objname, grpname, verbose)
    else:
        try:
            cmd = "getkey"
            params = {
                "from" : from_file_name,
                "keyword": keyword
            }

            if objname is not None:
                params["objname"] = objname

            if grpname is not None:
                params["grpname"] = grpname

            s = isis_command(cmd, params)
            return s.strip()
        except:
            if verbose is True:
                traceback.print_exc(file=sys.stdout)
            return None
예제 #21
0
def isis2std_grayscale(from_cube,
                       to_tiff,
                       format="tiff",
                       bittype="u16bit",
                       minimum=None,
                       maximum=None,
                       maxpercent=99.999,
                       cleanup_print_file=True,
                       band=1):
    cmd = "isis2std"

    from_cube = "%s+%s" % (from_cube, band)

    params = {
        "from": from_cube,
        "to": to_tiff,
        "format": format,
        "bittype": bittype
    }

    if minimum is not None and maximum is not None:
        params["stretch"] = "manual"
        params["minimum"] = minimum
        params["maximum"] = maximum
    else:
        params["maxpercent"] = maxpercent

    s = isis_command(cmd, params)

    if cleanup_print_file:
        dirname = os.path.dirname(to_tiff)
        if len(dirname) > 0:
            dirname += "/"
        if os.path.exists("%sprint.prt" % dirname):
            os.unlink("%sprint.prt" % dirname)

    return s
예제 #22
0
def lowpass(from_cube,
            to_cube,
            samples=5,
            lines=3,
            filter="outside",
            null="yes",
            hrs="no",
            his="no",
            lrs="no",
            replacement="center"):
    s = isis_command(
        "lowpass", {
            "from": from_cube,
            "to": to_cube,
            "samples": samples,
            "lines": lines,
            "filter": filter,
            "null": null,
            "hrs": hrs,
            "his": his,
            "lrs": lrs,
            "replacement": replacement
        })
    return s
예제 #23
0
def automos(from_list,
            to_file,
            priority=Priority.ONTOP,
            grange=Grange.AUTO,
            minlat=None,
            maxlat=None,
            minlon=None,
            maxlon=None):

    params = {"fromlist": from_list, "mosaic": to_file, "priority": priority}

    if grange == Grange.USER:
        params["grange"] = Grange.USER
        if minlat is not None:
            params["minlat"] = minlat
        if maxlat is not None:
            params["maxlat"] = maxlat
        if minlon is not None:
            params["minlon"] = minlon
        if maxlon is not None:
            params["maxlon"] = maxlon

    s = isis_command("automos", params)
    return s
예제 #24
0
def stretch(from_file, to_file, null="0.0", lis="0.0"):
    params = {"from": from_file, "to": to_file, "null": null, "lis": lis}
    s = isis_command("stretch", params)
    return s
예제 #25
0
def catlab(from_file):
    s = isis_command("catlab", {"from": from_file})
    return s
예제 #26
0
def voycal(from_file, to_file):
    s = isis_command("voycal", {"from": from_file, "to": to_file})
    return s
예제 #27
0
def cisscal(from_file, to_file, units="intensity"):
    params = {"from": from_file, "to": to_file}
    if units is not None:
        params["units"] = units
    s = isis_command("cisscal", params)
    return s
예제 #28
0
def findrx(from_cube):
    s = isis_command("findrx", {"from": from_cube})
    return s
예제 #29
0
def pds2isis(from_file, to_file):
    s = isis_command("pds2isis", {"from": from_file, "to": to_file})
    return s