Ejemplo n.º 1
0
def output_filename(file_name):
    dirname = os.path.dirname(file_name)
    if len(dirname) > 0:
        dirname += "/"
    target = info.get_target(file_name)
    filter1, filter2 = info.get_filters(file_name)
    image_time = info.get_image_time(file_name)
    spacecraft = info.get_spacecraft_name(file_name)
    image_id = file_name[:file_name.index(".")]
    camera = info.get_instrument_id(file_name)

    if camera is not None and len(camera) > 0:
        camera = "NAC" if camera == "NARROW_ANGLE_CAMERA" else "WAC"
    else:
        camera = "UNK"

    sc = "Vg1" if spacecraft == "VOYAGER_1" else "Vg2"

    out_file = "{dirname}{image_id}_{spacecraft}_{camera}_{target}_{filter1}_{image_date}".format(
        dirname=dirname,
        image_id=image_id,
        spacecraft=sc,
        camera=camera,
        target=target,
        filter1=filter1,
        image_date=image_time.strftime('%Y-%m-%d_%H.%M.%S'))
    return out_file
Ejemplo n.º 2
0
def match(files, targets, filters, require_width, require_height, band=-1):
    matching_files = []

    for f in files:
        if f[-3:].upper() != "CUB":
            print("File %s is not supported, skipping" % f)
            continue
        target = None
        try:
            target = info.get_target(f)
        except:
            pass

        filter1, filter2 = None, None
        try:
            filter1, filter2 = info.get_filters(f)
        except:
            pass

        width = info.get_num_line_samples(f)
        height = info.get_num_lines(f)

        if len(targets) > 0 and target.upper() not in targets:
            continue
        elif len(filters) > 0 and (filter1.upper() not in filters and filter2.upper() not in filters):
            continue
        elif len(require_width) > 0 and str(width) not in require_width:
            continue
        elif len(require_height) > 0 and str(height) not in require_height:
            continue
        else:
            matching_files.append(f)

    values = []
    for f in matching_files:
        _min, _max = mathandstats.get_data_min_max(f, band)
        values.append(_min)
        values.append(_max)
        print(_min, _max)

    minimum = np.min(values)
    maximum = np.max(values)

    print("Minimun:", minimum, "Maximum:", maximum)
    # maximum -= ((maximum - minimum) * 0.45)
    # minimum += ((maximum - minimum) * 0.35)

    for f in matching_files:
        totiff = f[:-4] + ".tif"
        print(totiff)
        importexport.isis2std_grayscale(f, totiff, minimum=minimum, maximum=maximum, band=band)
Ejemplo n.º 3
0
def output_filename(file_name):
    dirname = os.path.dirname(file_name)
    if len(dirname) > 0:
        dirname += "/"
    product_id = str(info.get_product_id(file_name)).replace("+", "_")
    target = info.get_target(file_name)
    filter1, filter2 = info.get_filters(file_name)
    image_time = info.get_image_time(file_name)
    image_id = file_name[:file_name.index(".")]

    out_file = "{dirname}{image_id}_{product_id}_{target}_{filter1}_{image_date}".format(dirname=dirname,
                                                                                        image_id=image_id,
                                                                                        product_id=product_id,
                                                                                        target=target,
                                                                                        filter1=filter1,
                                                                                        image_date=image_time.strftime('%Y-%m-%d_%H.%M.%S'))
    return out_file
Ejemplo n.º 4
0
def output_filename(file_name):
    dirname = os.path.dirname(file_name)
    if len(dirname) > 0:
        dirname += "/"
    product_id = info.get_product_id(file_name)
    target = info.get_target(file_name)
    filter1, filter2 = info.get_filters(file_name)
    image_time = info.get_image_time(file_name)

    out_file = "{dirname}{product_id}_{target}_{filter1}_{filter2}_{image_date}".format(
        dirname=dirname,
        product_id=product_id[2:-4],
        target=target,
        filter1=filter1,
        filter2=filter2,
        image_date=image_time.strftime('%Y-%m-%d_%H.%M.%S'))
    return out_file
Ejemplo n.º 5
0
def printInfo(lbl_file_name):
    target = info.get_target(lbl_file_name)
    filter1, filter2 = info.get_filters(lbl_file_name)
    image_time = info.get_image_time(lbl_file_name)
    num_lines = info.get_num_lines(lbl_file_name)
    num_line_samples = info.get_num_line_samples(lbl_file_name)
    sample_bits = info.get_sample_bits(lbl_file_name)

    instrument = info.get_instrument_id(lbl_file_name)
    if instrument in ("ISSNA", "NARROW_ANGLE_CAMERA"):
        camera = "Narrow"
    elif instrument in ("ISSWA", "WIDE_ANGLE_CAMERA"):
        camera = "Wide"
    else:
        camera = "NA"

    print "%25s|%10s|%10s|%22s|%5s|%5s|%4s|%8s| %s" % (
        target, filter1, filter2, image_time.strftime('%Y-%m-%d %H:%M:%S'),
        num_lines, num_line_samples, sample_bits, camera, lbl_file_name)