-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathjunocam_png_to_img.py
More file actions
executable file
·46 lines (35 loc) · 1.83 KB
/
junocam_png_to_img.py
File metadata and controls
executable file
·46 lines (35 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python
"""
There's probably a much better way to do this. But it works so I'm using it for now...
"""
import argparse
from sciimg.processes.junocam_conversions import png_to_img
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("-m", "--metadata", help="Input JunoCam Metadata JSON File", required=True, type=str)
parser.add_argument("-p", "--png", help="Input JunoCam PNG File", required=True, type=str)
parser.add_argument("-f", "--fill", help="Fill dead pixels", action="store_true")
parser.add_argument("-v", "--verbose", help="Verbose output", action="store_true")
parser.add_argument("-d", "--decompand", help="Decompand pixel values", action="store_true")
parser.add_argument("-F", "--flat", help="Apply flat fields (Don't use)", action="store_true")
parser.add_argument("-r", "--redweight", help="Apply a weight for the red band", type=float, default=0.902) # 0.510
parser.add_argument("-g", "--greenweight", help="Apply a weight for the green band", type=float, default=1.0) # 0.630
parser.add_argument("-b", "--blueweight", help="Apply a weight for the blue band", type=float, default=1.8879) # 1.0
args = parser.parse_args()
metadata = args.metadata
img_file = args.png
fill_dead_pixels = args.fill
verbose = args.verbose
do_decompand = args.decompand
do_flat_fields = args.flat
use_red_weight = args.redweight
use_green_weight = args.greenweight
use_blue_weight = args.blueweight
png_to_img(img_file, metadata,
fill_dead_pixels=fill_dead_pixels,
do_decompand=do_decompand,
do_flat_fields=do_flat_fields,
use_red_weight=use_red_weight,
use_green_weight=use_green_weight,
use_blue_weight=use_blue_weight,
verbose=verbose)