Global Seeps Sample¶
This example shows how to use the Airbus Global Seeps Sample data block with the UP42 Python SDK. This block provides free sample data from the Global Seeps database in the UK region, giving information about oil seeps, ship rigs etc. It demonstrates the application of the paid Global Seeps block, which can be used globally.
In the example, the workflow, the area of interest and the workflow parameters are defined. After running the job, the results are downloaded and visualized. For more information, refer to the block's UP42 Marketplace page and Documentation.
In [1]:
Copied!
import up42
import up42
In [2]:
Copied!
up42.authenticate(project_id="12345",
project_api_key="12345")
project = up42.initialize_project()
up42.authenticate(project_id="12345",
project_api_key="12345")
project = up42.initialize_project()
2021-03-11 12:54:45,785 - Authentication with UP42 successful! 2021-03-11 12:54:46,521 - Initialized Project(name: sdk-test, project_id: 6df5f59e-706d-4102-a136-b83b87c6006c, description: , createdAt: 2021-03-05T14:27:13.550603Z)
In [3]:
Copied!
# Update the project aoi size limit to 1000 sqkm to able to query bigger areas
project.update_project_settings(max_aoi_size=1000)
# Update the project aoi size limit to 1000 sqkm to able to query bigger areas
project.update_project_settings(max_aoi_size=1000)
2021-03-11 12:54:47,838 - Updated project settings: [{'name': 'JOB_QUERY_MAX_AOI_SIZE', 'value': '1000'}, {'name': 'MAX_CONCURRENT_JOBS', 'value': '10'}, {'name': 'JOB_QUERY_LIMIT_PARAMETER_MAX_VALUE', 'value': '10'}]
In [4]:
Copied!
# Construct the workflow
workflow = project.create_workflow(name="Global-Seeps-Sample Example", use_existing=True)
input_tasks = ["Global Seeps Sample"]
workflow.add_workflow_tasks(input_tasks)
# Construct the workflow
workflow = project.create_workflow(name="Global-Seeps-Sample Example", use_existing=True)
input_tasks = ["Global Seeps Sample"]
workflow.add_workflow_tasks(input_tasks)
2021-03-11 12:54:47,844 - Getting existing workflows in project ... 2021-03-11 12:54:48,379 - Got 4 workflows for project 6df5f59e-706d-4102-a136-b83b87c6006c. 100%|██████████| 4/4 [00:02<00:00, 1.53it/s] 2021-03-11 12:54:51,012 - Using existing workflow: Global Seeps Sample Example - 0788eec1-3d43-48e5-ae18-7e002ac7be88
In [6]:
Copied!
# We select an area off the east-coast of England
aoi_bbox = [0.330963, 53.960126, 0.65918, 54.106918]
# Can also use up42.draw_aoi(), up42.read_vector_file(), provide a FeatureCollection, GeoDataFrame etc.
# We select an area off the east-coast of England
aoi_bbox = [0.330963, 53.960126, 0.65918, 54.106918]
# Can also use up42.draw_aoi(), up42.read_vector_file(), provide a FeatureCollection, GeoDataFrame etc.
In [15]:
Copied!
# Define the aoi and input parameters of the workflow to run it.
input_parameters = workflow.construct_parameters(geometry=aoi_bbox,
geometry_operation="bbox",
start_date="2018-01-01",
end_date="2021-12-31",
limit=1)
input_parameters
# Define the aoi and input parameters of the workflow to run it.
input_parameters = workflow.construct_parameters(geometry=aoi_bbox,
geometry_operation="bbox",
start_date="2018-01-01",
end_date="2021-12-31",
limit=1)
input_parameters
Out[15]:
{'airbus-globalseeps-sample:1': {'object_type': ['Scenes', 'Ships_Rigs', 'Slick_Points', 'Slick_Outlines'], 'limit': 1, 'time': '2018-01-01T00:00:00Z/2021-12-31T23:59:59Z', 'bbox': [0.330963, 53.960126, 0.65918, 54.106918]}}
In [10]:
Copied!
# Price estimation
workflow.estimate_job(input_parameters)
# Price estimation
workflow.estimate_job(input_parameters)
2021-03-11 12:55:08,500 - Estimated: 1-1 Credits, Duration: 715-2462 min.
Out[10]:
{'airbus-globalseeps-sample:1': {'blockConsumption': {'resources': {'unit': 'MEGABYTE', 'min': 0.005, 'max': 0.03}, 'credit': {'min': 0, 'max': 0}}, 'machineConsumption': {'duration': {'min': 42935, 'max': 147750}, 'credit': {'min': 1, 'max': 1}}}}
In [20]:
Copied!
# Run the workflow and download the results.
job = workflow.run_job(input_parameters=input_parameters, track_status=True)
# Run the workflow and download the results.
job = workflow.run_job(input_parameters=input_parameters, track_status=True)
2021-03-11 13:05:16,156 - Selected input_parameters: {'airbus-globalseeps-sample:1': {'object_type': ['Scenes', 'Ships_Rigs', 'Slick_Points', 'Slick_Outlines'], 'limit': 1, 'time': '2018-01-01T00:00:00Z/2021-12-31T23:59:59Z', 'bbox': [0.330963, 53.960126, 0.65918, 54.106918]}} 2021-03-11 13:05:18,963 - Created and running new job: 530f4103-1482-43e4-94e8-ebd99b399068. 2021-03-11 13:05:19,576 - Tracking job status continuously, reporting every 30 seconds... 2021-03-11 13:05:46,846 - Job finished successfully! - 530f4103-1482-43e4-94e8-ebd99b399068
In [ ]:
Copied!
job.download_results()
job.download_results()
When downloading and visualizing the results, we can see multiple ship rig point geometries with their respective properties.
In [22]:
Copied!
job.map_results()
job.map_results()
Out[22]:
Make this Notebook Trusted to load map: File -> Trust Notebook