def query(collection, long_0, lat_0, radius, filename, end_date, start_date, api_key): """Perform a spatial query on the Earth Explorer API """ lst = getSceneList(collection, long_0, lat_0, radius, filename, end_date, start_date, api_key) print '\n'.join(lst)
def sp_order(collection, long_0, lat_0, radius, filename, end_date, start_date, proj, resampling_method, resize, xmin, xmax, ymin, ymax, api_key, username, password, debug): """Query and order data for a given location """ scenelist = getSceneList(collection, long_0 = long_0, lat_0 = lat_0, xmin = xmin, xmax = xmax, ymin = ymin, ymax = ymax, radius = radius, filename = filename,\ end_date = end_date, start_date= start_date, api_key = api_key) r = orderList(username, password, scenelist, proj, resampling_method, resize, xmin, xmax, ymin, ymax, long_0, lat_0, filename, radius, debug) if isinstance(r, requests.models.Response): print r.text else: print r
def order_batch(filename, collection, radius, start_date, end_date, proj, resampling_method, resize, api_key, username, password, debug): """Query and order data from a list of coordinates read from file """ # with open(filename) as src: coord_list = [tuple(line) for line in csv.reader(filename)] for coord in coord_list: long_0 = float(coord[0]) lat_0 = float(coord[1]) scenelist = getSceneList(collection, long_0 = long_0, lat_0 = lat_0, radius = radius, filename = None,\ end_date = end_date, start_date = start_date, api_key = api_key) r = orderList(username, password, scenelist, proj, resampling_method, resize,\ long_0 = long_0, lat_0 = lat_0, radius = radius, debug = debug) if isinstance(r, requests.models.Response): print r.text else: print r print "Order complete"