AgroET API
The AgroET remote sensing model has a Python binding that allows the user to run the AgroET remotely. Below is a sample of an API code.
- Download API Script
import csip import glob import os import time process_url = "http://agroet.com:8080/csip-reset/m/process/2.0" c = csip.Client(url=process_url) c.add_data("api_key", "") # DATE OF THE IMAGE BEING PROCESSED c.add_data('date', '2019-08-25') # NAME OF THE AREA OF INTEREST (aoi) SHAPEFILE (in this example is “aoi.shp”) # SHAPEFILE NEEDS TO BE IN THE SAME DIRECTORY AS THE SCRIPT c.add_data('aoi', 'aoi.shp') # ROW OF THE LANDSAT IMAGE c.add_data('row', '036') # PATH OF THE LANDSAT IMAGE c.add_data('path', '042') # NAME OF THE RUN c.add_data('run_name', 'Irvvin_8_25_19') # THIS ASSUMES SHAPEFILES ARE IN SAME DIRECTORY AS SCRIPT. # IF NOT YOU NEED TO CHANGE THE REFERENCE TO THE CORRECT DIRECTORY (ADD PATH BEFORE ‘aoi.*’) files = glob.glob('aoi.*') log = [] def progress(r, prog): global log if prog: lines = prog.split("\n") new_lines = lines[len(log) :] if new_lines: print("\n".join(new_lines)) log = lines r = c.execute_async( process_url, files=files, first_poll=5000, next_poll=5000, callback=progress ) print(r.get_data_value("status")) sleep(10) r.download_data_files(files=r.get_data_files())