JobTask¶
Analytics platform discontinued after January 31, 2024
The current analytics platform will be discontinued after January 31, 2024, and will be replaced by new advanced processing functionalities. This change will affect projects, workflows, jobs, data blocks, processing blocks, and custom blocks. For more information, see the blog post.
The JobTask class enables access to results of a specific job task. Job tasks are unique configurations of workflow tasks in a job.
jobtask = up42.initialize_jobtask(
jobtask_id="3f772637-09aa-4164-bded-692fcd746d20",
job_id="de5806aa-5ef1-4dc9-ab1d-06d7ec1a5021",
project_id="55434287-31bc-3ad7-1a63-d61aac11ac55",
)
Job tasks¶
info¶
The info
attribute returns metadata of a specific job task.
The returned format is dict
.
Example
jobtask.info
download_quicklooks()¶
The download_quicklooks()
function allows you to download low-resolution preview images. Not all job tasks have quicklooks.
download_quicklooks(output_directory)
The returned format is list[str]
. If an empty list []
is returned, no quicklooks are available.
Arguments
Argument | Overview |
---|---|
output_directory |
Union[str, Path, None] The file output directory. The default value is the current directory. |
Example
jobtask.download_quicklooks(output_directory="/Users/max.mustermann/Desktop/")
get_results_json()¶
The get_results_json()
function allows you to get the data.json
from a specific job task.
get_results_json(as_dataframe)
The returned format is Union[dict, GeoDataFrame]
.
Arguments
Argument | Overview |
---|---|
as_dataframe |
bool Determines how data.json is returned:
False . |
Example
jobtask.get_results_json(as_dataframe=True)
download_results()¶
The download_results()
function allows you to download a specific job task's results and returns a list of download paths.
download_results(output_directory)
The returned format is list[str]
.
Arguments
Argument | Overview |
---|---|
output_directory |
Union[str, Path, None] The file output directory. The default value is the current directory. |
Example
jobtask.download_results(output_directory="/Users/max.mustermann/Desktop/")
Visualization¶
To use the visualization functions, install the SDK's advanced installation with plotting functionalities.
map_results()¶
The map_results()
function allows you to visualize a specific job task's results on a Folium map. Use together with download_results()
.
map_results(
bands,
aoi,
show_images,
show_features,
name_column,
save_html,
)
The returned format is folium.Map
.
Arguments
Argument | Overview |
---|---|
bands |
list[int] A list of image bands to show on the map and their order. |
aoi |
GeoDataFrame An additional geometry to visualize on the map. |
show_images |
bool Determines whether to visualize the job task results:
True . |
show_features |
bool Determines whether to visualize the geometry of the job task results:
True . |
name_column |
str The name of the feature property that provides the feature name. The default value is uid . |
save_html |
path Use to specify a path to save the map as an HTML file. |
Example
jobtask.map_results(
bands=[1],
aoi="/Users/max.mustermann/Desktop/sentinel-job.geojson",
show_images=True,
show_features=False,
name_column="uid",
save_html="/Users/max.mustermann/Desktop/",
)
plot_results()¶
The plot_results()
function allows you to visualize downloaded job task's results. Use together with download_results()
.
plot_results(
figsize,
bands,
titles,
filepaths,
plot_file_format,
**kwargs,
)
Arguments
Argument | Overview |
---|---|
figsize |
tuple[int, int] The size of the visualization, in inches. The first number is height, the second one is width. The default value is (14, 8) . |
bands |
list[int] A list of image bands to plot and their order. |
titles |
list[str] The titles for the subplots. |
filepaths |
Union[list[Union[str, Path]], dict, None] The file paths. By default, the last downloaded results will be used. |
plot_file_format |
list[str] Accepted file formats. The default value is [".tif"] . |
**kwargs |
Any additional arguments of rasterio.plot.show. |
Example
jobtask.plot_results(
figsize=(10, 10),
bands=[1],
titles=["SPOT imagery over Berlin"],
filepaths="/Users/max.mustermann/Desktop/IMG_SPOT6_PMS.TIF",
plot_file_format=[".tif"],
)
plot_quicklooks()¶
The plot_quicklooks()
function allows you to visualize downloaded quicklooks. Use together with download_quicklooks()
.
plot_quicklooks(
figsize,
filepaths,
titles
)
Arguments
Argument | Overview |
---|---|
figsize |
tuple[int, int] The size of the visualization, in inches. The first number is height, the second one is width. The default value is (8, 8) . |
filepaths |
Union[list[Union[str, Path]], dict, None] The file paths. By default, the last downloaded quicklooks will be used. |
titles |
list[str] The titles for the subplots. |
Example
# Download quicklooks
jobtask.download_quicklooks(output_directory="/Users/max.mustermann/Desktop/")
# Map quicklooks
jobtask.plot_quicklooks(
figsize=(10, 10),
filepaths=[
"/Users/max.mustermann/Desktop/quicklook_d0a7e38a-0087-48c9-b3f7-8b422388e101.jpg",
"/Users/max.mustermann/Desktop/quicklook_b7f2c82f-641d-4119-baff-7001a5ceb4f6.jpg",
],
titles=["Scene 1", "Scene 2"],
)