30 seconds example

In this example a new workflow consisting of Sentinel-2 L2A data and Sharpening Filter is created. The area of interest and workflow parameters are defined. After running the job, the results are downloaded and visualized.

In [ ]:
import up42
In [ ]:
up42.authenticate(project_id="12345", 
                  project_api_key="67890")
project = up42.initialize_project()
In [ ]:
# Construct workflow
workflow = project.create_workflow(name="30-seconds-workflow", use_existing=True)
#print(up42.get_blocks(basic=True))
input_tasks = ["Sentinel-2 L2A Visual (GeoTIFF)", "Sharpening Filter"]
workflow.add_workflow_tasks(input_tasks)
In [ ]:
# Define the aoi and input parameters of the workflow to run it.
# Can also use up42.draw_aoi(), up42.read_vector_file(), provide a FeatureCollection, GeoDataFrame etc.
aoi = up42.get_example_aoi(as_dataframe=True)
input_parameters = workflow.construct_parameters(geometry=aoi, 
                                                 geometry_operation="bbox", 
                                                 start_date="2018-01-01",
                                                 end_date="2020-12-31",
                                                 limit=1)
input_parameters["esa-s2-l2a-gtiff-visual:1"].update({"max_cloud_cover":5})
In [ ]:
# Price estimation
workflow.estimate_job(input_parameters)
In [ ]:
# Run a test job to query data availability and check the configuration.
test_job = workflow.test_job(input_parameters, track_status=True)
In [ ]:
# Run the actual job.
job = workflow.run_job(input_parameters, track_status=True)
In [ ]:
job.download_results()
In [ ]:
job.plot_results(figsize=(6,6))
In [ ]:
#job.map_results(bands=[1])
In [ ]: