def makemap(region, feature, scale, proj): ''' Uses a set of latitude and longitude boundaries, a projection, and a scale to create a mapfile. ''' clon = region[2]+abs(region[3]-region[2])/2 clat = region[0]+abs(region[1]-region[0])/2 isis.maptemplate(map=feature+'.map', projection=proj, clat=clat, clon=clon, rngopt='user', resopt='mpp' scale=scale, minlat=region[0], maxlat=region[1], minlon=region[2], maxlon=region[3] ) pass
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 post_cam_2_map(): """ Called when a client POSTs to /cam2map """ isis_request = ISISRequest(request) map_file = Utils.get_tmp_file("map") map_projection = request.json["args"]["projection"] proj_extras = dict() for kv_pair in request.json["args"]["extra_args"]["args"]: proj_extras[kv_pair["arg_key"]] = kv_pair["arg_val"] output_files = list() error = None try: Isis.maptemplate(map=map_file, projection=map_projection, **proj_extras) except ProcessError as e: error = e.stderr.decode("utf-8") logger.error("maptemplate threw an error: {}".format(error)) if error is None: cam2map = ISISCommand(CMD_NAME, {"map": map_file}) errors = cam2map.run(*isis_request.input_files) if len(errors) > 0: error = "\n".join(errors) else: output_files = isis_request.upload_output() isis_request.cleanup() Utils.remove_file_if_exists(map_file) return jsonify({"to": output_files, "err": error})
def makemap_freescale(region, feature, proj, listfile): ''' Uses a set of latitude and longitude boundaries, a projection, and a list of images to calculate the image scale A mapfile is created ''' clon = region[2]+abs(region[3]-region[2])/2 clat = region[0]+abs(region[1]-region[0])/2 isis.maptemplate(map=feature+'.map', fromlist=listfile, projection=proj, clat=clat, clon=clon, rngopt='user', resopt='calc' scale=scale, minlat=region[0], maxlat=region[1], minlon=region[2], maxlon=region[3] ) pass
def create_maptemplate(region, projection, scale): ''' Uses a set of latitude and longitude boundaries, a projection, and a scale to create a mapfile. region = (minlat, maxlat, minlon, maxlon) ''' # center_longitude = region[2] + abs(region[3]-region[2]) # center_latitude = region[0] + abs(region[1]-region[0]) center_latitude = 0.0 center_longitude = 0.0 isis.maptemplate( projection_=projection, map = 'temp_map.map', clat = center_latitude, clon = center_longitude, minlat = region[0], maxlat = region[1], minlon = region[2], maxlon = region[3], rngopt = 'user', resopt = 'mpp', resolution = scale )