def test_log(self): # Example of data reference passed as input input_reference = "https://data2.terradue.com/eop/sentinel2/dataset/search?uid=S2A_OPER_PRD_MSIL1C_PDMC_20160508T221513_R008_V20160508T104027_20160508T104027" # The log function uses ciop.log, which writes on stderr. Therefore we # need to check the stderr to test the function. stderr = StringIO() sys.stderr = stderr log_input(input_reference) output = stderr.getvalue() log_message = string.split(output ,'\n')[1][27:] self.assertEqual(log_message, "[INFO ] [user process] processing input: "+ input_reference, "Input reference not logged")
ciop.log("INFO", "Set projection info") dst_ds.SetGeoTransform(georef) dst_ds.SetProjection(proj) ciop.log("INFO", "Saving LAI finished") return laifile # Input references come from STDIN (standard input) and they are retrieved # line-by-line. for input in sys.stdin: # Logs the inputs received from the previous node. Since it is configured # as 'aggregator' (see application.xml), it collects the inputs of all the # instances of the previous node. log_input(input) ciop.log("INFO", "Running python {}".format(sys.version)) try: template_path = os.path.dirname(os.path.realpath(__file__)) template = template_path + "/" + "nextgeoss_template.xml" url_list = ciop.search(end_point = input, output_fields = "enclosure", params = dict()) for v in url_list: url = v.values()[0] ciop.log("INFO", "Copying tile: {}".format(url)) sentinel_zip = ciop.copy(url, ciop.tmp_dir, extract=False) ciop.log("INFO", "Copying tile finished") prod_name, bdata, proj, georef = extract_R_B_NIR(sentinel_zip)
sys.path.append(os.environ['_CIOP_APPLICATION_PATH'] + '/util') from util import log_input from util import pass_next_node # Input references come from STDIN (standard input) and they are retrieved # line-by-line. for input in sys.stdin: start = ciop.getparam('startdate') stop = ciop.getparam('enddate') cloudcover = ciop.getparam('cloud_cover') boundingarea = ciop.getparam('bounding_area') prod_type = ciop.getparam('type') # for test password = ciop.getparam('storname') ciop.log("INFO", "storname=|{}|".format(password)) # for test log_input('searching with:') log_input(start) log_input(stop) log_input(cloudcover) log_input(boundingarea) log_input(prod_type) # search_params = dict([('start',start),('stop', stop), ('geom', boundingarea), ('pt', prod_type), ('cc', cloudcover)]) search_params = dict([('start',start),('stop', stop), ('geom', boundingarea), ('pt', prod_type)]) search_result = ciop.search(end_point="https://catalog.terradue.com/sentinel2/search", params=search_params, output_fields='self') for elem in search_result: ciop.log("INFO", elem.values()[0]) ciop.publish(sources=elem.values()[0] + '\n', mode = 'silent')