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 main(): parser = ArgumentParser(description='Create plots for topo data') #parser.add_argument('image', metavar='cub', # help='the cube file(s) (.cub) to process, no NULL pixels') parser.add_argument('outname', help='the output filename, no extension') parser.add_argument('GLD_slice', metavar='cub', help='the WAC GLD100 slice to use (full path) (.cub)') parser.add_argument('--type', '-t', default='2D', help='type of plot: 2D or 3D') parser.add_argument('--contours', '-c', default=True, help='set to True for contour lines') parser.add_argument('--cinterval', '-i', default='10', help='interval in meters for contour lines') args = parser.parse_args() minlat, maxlat, minlon, maxlon = get_center_lat_lon() center_lat = minlat + (maxlat - minlat)/2 center_lon = minlon + (maxlon - minlon)/2 # TODO: equirectangular is hardcoded at the moment # TODO: orthographic gives incorrect output... why? isis.maptemplate(map='wac_GLD100.map', projection='equirectangular', clat=center_lat, clon=center_lon, rngopt='user', resopt='mpp', resolution=100, minlat=minlat, maxlat=maxlat, minlon=minlon, maxlon=maxlon) isis.map2map(from_=args.GLD_slice, map='wac_GLD100.map', to=args.outname+'.cub', matchmap='true') img = CubeFile.open(args.outname+'.cub') if args.type == '2D': color_plot_2D(img, args) if args.type == '3D': color_topo_3D(img, args) img.data # np array with the image data
def main(): image_list = read_in_list(source_dir+'temp.txt') # read in image list for img_name in image_list: # extract corner sample, line max_xy = get_max_sample_line(img_name) print max_xy #debug min_xy = (1,1) # get min max lat lon min_latitude, max_longitude = get_lat_lon_from_x_y(max_xy, img_name) print min_latitude, max_longitude #debug max_latitude, min_longitude = get_lat_lon_from_x_y(min_xy, img_name) region = (min_latitude, max_latitude, min_longitude, max_longitude) # make new maptemplate create_maptemplate(region, projection, scale) # make new cub file isis.map2map( from_ = clem_dir + 'clementine_uvvis_warp_mosaic_400m.cub', to = source_dir + img_name[:-4]+'_clem.cub', map = 'temp_map.map', matchmap = 'true' )
def prepare_image(image): # reproj map=ROLO_ortho.map isis.map2map(from_=image, map=base_dir+'ROLO_ortho.map', to=rolo_dir+'_ortho.cub', matchmap='true') # explode original uncalibrated cubes into new directory isis.explode(from_=rolo_dir+'_ortho.cub', to=rolo_dir+'/'+rolo_name)