def process_frames(frames, color, name, model, feature): ''' Processes WAC frames (uv or vis) into regionally constrained images LROWACCAL calibrates pixels to DN ''' subname = name+'.'+color mapname = feature+'.map' for frame in frames: isis.spiceinit(from_='+frame+', spksmithed='true', shape='user', model=model ) isis.lrowaccal(from_='+frame+', to='+frame+'.cal, RADIOMETRIC=FALSE ) isis.cam2map(from_='+frame+'.cal, to='+frame+'.proj, map=mapname, matchmap=true ) create_mosaic(subname)
def project_wac(image, map): """ Args: image: filename map: isis maptemplate mapfile """ isis.cam2map( from_ = frame.photrim, to = frame.proj, map = map, matchmap = True )
def project(img_from, img_to, **options): with img_from.make_child('map') as mapfile: with img_from.make_child('lis') as fromlist: write_file_list(unicode(fromlist), [unicode(img_from)]) isis.mosrange( fromlist = fromlist, to = mapfile, precision = 2, projection = 'equirectangular' ) isis.cam2map( from_ = img_from, to = img_to, pixres = 'map', map = mapfile )
def process_image(image, title, caption): image = ImageName(splitext(image)[0]) isis.lronac2isis.print_cmd(from_=image.IMG, to=image.cub) isis.lronac2isis(from_=image.IMG, to=image.cub) isis.spiceinit(from_=image.cub) #lronaccal default is IOF calibration isis.lronaccal(from_=image.cub, to=image.cal.cub) isis.trim(from_=image.cal.cub, to=image.trim.cub, left=45, right=45) write_file_list(image.map.lis, [image.trim.cub]) isis.mosrange(fromlist=image.map.lis, to=image.nac_eqr.map, precision=2, projection='equirectangular') isis.cam2map(from_=image.trim.cub, to=image.proj.cub, pixres='map', map=image.nac_eqr.map) create_yml(image, title) create_caption(image, caption)
def project(img, to, mapfile, matchmap=False): params = {'from_': img, 'map': mapfile, 'to': to, 'matchmap': matchmap} if GeoDataset(img).metadata['IsisCube'].get('Mapping', False): try: params['interp'] = 'NEARESTNEIGHBOR' logger.info('Running map2map on {} with params {}'.format( img, params)) map2map(**params) except ProcessError as e: logger.info('map2map Error') logger.error("STDOUT: {}".format(e.stdout.decode('utf-8'))) logger.error("STDERR: {}".format(e.stderr.decode('utf-8'))) else: try: logger.info('Running cam2map on {}'.format(img)) cam2map(**params) except ProcessError as e: logger.info('cam2map Error') logger.error("STDOUT: {}".format(e.stdout.decode('utf-8'))) logger.error("STDERR: {}".format(e.stderr.decode('utf-8')))
def postprocess_for_davinci(incube, kernel=None, latlon_bounds=[]): #Processing the temperature to a level2 image if kernel: try: isis.spiceinit(from_=incube, ck=kernel) except ProcessError as e: print(e.stderr) else: try: isis.spiceinit(from_=incube) except ProcessError as e: print(e.stderr) workingpath, fname = os.path.split(incube) fname = os.path.splitext(fname)[0] isiscube = os.path.join(workingpath, '{}_proj.cub'.format(fname)) try: isis.cam2map(from_=incube, to=isiscube, map='$base/templates/maps/simplecylindrical.map') except ProcessError as e: print(e.stderr) isis_cropped_cube = os.path.join(workingpath, '{}_proj_cropped.cub'.format(fname)) if latlon_bounds: try: isis.maptrim(from_=isiscube, to=isis_cropped_cube, minlat=latlon_bounds[0], maxlat=latlon_bounds[1], minlon=latlon_bounds[2], maxlon=latlon_bounds[3], mode='CROP') isiscube = isis_cropped_cube except ProcessError as e: print(e.stderr) return isiscube
print(img1proj) print(img2proj) cam2map_params1 = {'from_': img1, 'map': 'equidistant.map', 'to': img1proj} cam2map_params2 = { 'from_': img2, 'map': img1proj, 'to': img2proj, 'matchmap': 'yes' } try: print('Running cam2map on {}'.format(img1)) cam2map(**cam2map_params1) print('Running cam2map on {}'.format(img2)) cam2map(**cam2map_params2) except ProcessError as e: print('cam2map Error') print("STDOUT:", e.stdout.decode('utf-8')) print("STDERR:", e.stderr.decode('utf-8')) args = ['deplaid=1', 'wnremove=1', 'autoradcorr=1', 'destreak=1'] try: out1, err1 = run_davinci('thm_post_process.dv', img1proj, img1proj, args=args) out2, err2 = run_davinci('thm_post_process.dv', img2proj,