def main(parser): """Run as a script with args coming from argparse.""" args = parser.parse_args() if not (args.roi or args.input): print("ERROR: requires '-r' or '-i' argument") parser.print_help() sys.exit(1) if args.input: args.roi = asf.ogr2snwe(args.input, args.buffer) asf.snwe2file(args.roi) asf.query_asf(args.roi, 'SA', orbit=args.orbit) asf.query_asf(args.roi, 'SB', orbit=args.orbit) gf = asf.merge_inventories('query_SA.json', 'query_SB.json') asf.summarize_inventory(gf) asf.summarize_orbits(gf) asf.save_inventory(gf) if args.csvs: asf.query_asf(args.roi, 'SA', 'csv', orbit=args.orbit) asf.query_asf(args.roi, 'SB', 'csv', orbit=args.orbit) if args.kmls: asf.query_asf(args.roi, 'SA', 'kml', orbit=args.orbit) asf.query_asf(args.roi, 'SB', 'kml', orbit=args.orbit) if args.meta: asf.query_asf(args.roi, 'SA', 'metalink', orbit=args.orbit) asf.query_asf(args.roi, 'SB', 'metalink', orbit=args.orbit) if args.footprints: asf.save_geojson_footprints(gf)
def main(): """Run as a script with args coming from argparse.""" parser = cmdLineParse() args = parser.parse_args() if not (args.roi or args.input): print("ERROR: requires '-r' or '-i' argument") parser.print_help() sys.exit(1) if args.input: args.roi = asf.ogr2snwe(args.input, args.buffer) asf.snwe2file(args.roi) asf.query_asf(args.roi, "SA", orbit=args.orbit) asf.query_asf(args.roi, "SB", orbit=args.orbit) gf = asf.merge_inventories("query_SA.json", "query_SB.json") asf.summarize_inventory(gf) asf.summarize_orbits(gf) asf.save_inventory(gf) if args.csvs: asf.query_asf(args.roi, "SA", "csv", orbit=args.orbit) asf.query_asf(args.roi, "SB", "csv", orbit=args.orbit) if args.kmls: asf.query_asf(args.roi, "SA", "kml", orbit=args.orbit) asf.query_asf(args.roi, "SB", "kml", orbit=args.orbit) if args.meta: asf.query_asf(args.roi, "SA", "metalink", orbit=args.orbit) asf.query_asf(args.roi, "SB", "metalink", orbit=args.orbit) if args.footprints: asf.save_geojson_footprints(gf)
def test_extract_bounds(): """Extract SNWE bounds from a OGR-recognized vector file.""" bounds = asf.ogr2snwe('./tests/data/UnionGap.shp') assert type(bounds) == list assert len(bounds) == 4 assert bounds == [46.51905923587083, 46.53477259526909, -120.471510549134, -120.4502650392162]
def test_ogr2swe(): bounds = asf.ogr2snwe("tests/data/UnionGap.shp") assert type(bounds) == list assert len(bounds) == 4 assert bounds == [ 46.51905923587083, 46.53477259526909, -120.471510549134, -120.4502650392162, ]