up42¶
authenticate(cfg_file=None, project_id=None, project_api_key=None, **kwargs)
¶
Authenticate with UP42, either via project_id & project_api_key, or a config JSON file containing both. Also see the documentation https://sdk.up42.com/authentication/
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cfg_file |
Union[str, Path]
|
A JSON file containing project_id & project_api_key |
None
|
project_id |
Optional[str]
|
The UP42 project id. |
None
|
project_api_key |
Optional[str]
|
The UP42 project api key. |
None
|
Examples:
up42.authenticate(
project_id="your-project-ID",
project_api_key="your-project-API-key"
)
Source code in up42/main.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
|
SDK conveniance functionality that is made available on the up42 import object (in the init) and is not directly related to API calls.
get_example_aoi(location='Berlin', as_dataframe=False)
¶
Gets predefined, small, rectangular example AOI for the selected location.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
location |
str
|
Location, one of Berlin, Washington. |
'Berlin'
|
as_dataframe |
bool
|
Returns a dataframe instead of dict FeatureColletions (default). |
False
|
Returns:
Type | Description |
---|---|
Union[dict, GeoDataFrame]
|
Feature collection JSON with the selected AOI. |
Source code in up42/tools.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
get_logger(name, level=logging.INFO, verbose=False)
¶
Use level=logging.CRITICAL to disable temporarily.
Source code in up42/utils.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
|
read_vector_file(filename='aoi.geojson', as_dataframe=False)
¶
Reads vector files (geojson, shapefile, kml, wkt) to a feature collection, for use as the AOI geometry in the workflow input parameters (see get_input_parameters).
Example AOI fields are provided, e.g. example/data/aoi_Berlin.geojson
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename |
str
|
File path of the vector file. |
'aoi.geojson'
|
as_dataframe |
bool
|
Return type, default FeatureCollection, GeoDataFrame if True. |
False
|
Returns:
Type | Description |
---|---|
Union[dict, GeoDataFrame]
|
Feature Collection |
Source code in up42/tools.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
|
settings(log=True)
¶
Configures settings about logging etc. when using the up42-py package.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
log |
bool
|
Activates/deactivates logging, default True is activated logging. |
True
|
Source code in up42/tools.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
|
Visualization tools available in various objects
draw_aoi()
¶
Displays an interactive map to draw an AOI by hand, returns the folium object if not run in a Jupyter notebook.
Export the drawn AOI via the export button, then read the geometries via up42.read_aoi_file().
Requires installation of up42-py[viz] extra dependencies.
Source code in up42/viztools.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|
Auth
¶
Source code in up42/auth.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
|
Webhook
¶
Webhook¶
Webhook class to control a specific UP42 webhook, e.g. modify, test or delete the specific webhook.
webhook = webhook.trigger_test_event()
Source code in up42/webhooks.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
delete()
¶
Deletes a registered webhook.
Source code in up42/webhooks.py
94 95 96 97 98 99 100 |
|
info: dict
property
¶
Gets and updates the webhook metadata information.
trigger_test_events()
¶
Triggers webhook test event to test your receiving side. The UP42 server will send test messages for each subscribed event to the specified webhook URL.
Returns:
Type | Description |
---|---|
dict
|
A dict with information about the test events. |
Source code in up42/webhooks.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
update(name=None, url=None, events=None, active=None, secret=None)
¶
Updates a registered webhook.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
Optional[str]
|
Updated webhook name |
None
|
url |
Optional[str]
|
Updated unique URL where the webhook will send the message (HTTPS required) |
None
|
events |
Optional[List[str]]
|
Updated list of event types [order.status, job.status]. |
None
|
active |
Optional[bool]
|
Updated webhook status. |
None
|
secret |
Optional[str]
|
Updated string that acts as signature to the https request sent to the url. |
None
|
Returns:
Type | Description |
---|---|
Webhook
|
The updated webhook object. |
Source code in up42/webhooks.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
Webhooks
¶
Contains UP42 webhooks functionality to set up a custom callback e.g. when an order is finished he webhook is triggered and an event notification is transmitted via HTTPS to a specific URL.
Also see the full webhook documentation.
Create a new webhook or query a existing ones via the up42
object, e.g.
webhooks = up42.get_webhooks()
webhook = up42.initialize_webhook(webhook_id = "...")
The resulting Webhook object lets you modify, test or delete the specific webhook, e.g.
webhook = webhook.trigger_test_event()
Source code in up42/webhooks.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
|
create_webhook(name, url, events, active=False, secret=None)
¶
Registers a new webhook in the system.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
Webhook name |
required |
url |
str
|
Unique URL where the webhook will send the message (HTTPS required) |
required |
events |
List[str]
|
List of event types e.g. [order.status, job.status] |
required |
active |
bool
|
Webhook status. |
False
|
secret |
Optional[str]
|
String that acts as signature to the https request sent to the url. |
None
|
Returns:
Type | Description |
---|---|
Webhook
|
A dict with details of the registered webhook. |
Source code in up42/webhooks.py
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
|
get_webhook_events()
¶
Gets all available webhook events.
Returns:
Type | Description |
---|---|
dict
|
A dict of the available webhook events. |
Source code in up42/webhooks.py
128 129 130 131 132 133 134 135 136 137 |
|
get_webhooks(return_json=False)
¶
Gets all registered webhooks for this workspace.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
return_json |
bool
|
If true returns the webhooks information as JSON instead of webhook class objects. |
False
|
Returns:
Type | Description |
---|---|
List[Webhook]
|
A list of the registered webhooks for this workspace. |
Source code in up42/webhooks.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
|
create_webhook(name, url, events, active=False, secret=None)
¶
Registers a new webhook in the system.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
Webhook name |
required |
url |
str
|
Unique URL where the webhook will send the message (HTTPS required) |
required |
events |
List[str]
|
List of event types (order status / job task status) |
required |
active |
bool
|
Webhook status. |
False
|
secret |
Optional[str]
|
String that acts as signature to the https request sent to the url. |
None
|
Returns:
Type | Description |
---|---|
A dict with details of the registered webhook. |
Source code in up42/main.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
|
format_time(date, set_end_of_day=False)
¶
Formats date isostring to datetime string format
Parameters:
Name | Type | Description | Default |
---|---|---|---|
date |
Optional[Union[str, datetime]]
|
datetime object or isodatetime string e.g. "YYYY-MM-DD" or "YYYY-MM-DDTHH:MM:SS". |
required |
set_end_of_day |
Sets the date to end of day, as required for most image archive searches. Only applies for type date string without time, e.g. "YYYY-MM-DD", not explicit datetime object or time of day. |
False
|
Source code in up42/utils.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
|
get_block_coverage(block_id)
¶
Gets the spatial coverage of a data/processing block as url or GeoJson Feature Collection.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
block_id |
str
|
The block id. |
required |
Returns:
Type | Description |
---|---|
dict
|
A dict of the spatial coverage for the specific block. |
Source code in up42/main.py
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
|
get_block_details(block_id, as_dataframe=False)
¶
Gets the detailed information about a specific public block from the server, includes all manifest.json and marketplace.json contents. Can not access custom blocks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
block_id |
str
|
The block id. |
required |
as_dataframe |
bool
|
Returns a dataframe instead of JSON (default). |
False
|
Returns:
Type | Description |
---|---|
dict
|
A dict of the block details metadata for the specific block. |
Source code in up42/main.py
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
|
get_blocks(block_type=None, basic=True, as_dataframe=False)
¶
Gets a list of all public blocks on the marketplace. Can not access custom blocks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
block_type |
Optional[str]
|
Optionally filters to "data" or "processing" blocks, default None. |
None
|
basic |
bool
|
Optionally returns simple version {block_id : block_name} |
True
|
as_dataframe |
bool
|
Returns a dataframe instead of JSON (default). |
False
|
Returns:
Type | Description |
---|---|
Union[List[Dict], dict]
|
A list of the public blocks and their metadata. Optional a simpler version |
Union[List[Dict], dict]
|
dict. |
Source code in up42/main.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
|
get_credits_balance()
¶
Display the overall credits available in your account.
Returns:
Type | Description |
---|---|
dict
|
A dict with the balance of credits available in your account. |
Source code in up42/main.py
237 238 239 240 241 242 243 244 245 246 247 248 |
|
get_credits_history(start_date=None, end_date=None)
¶
Display the overall credits history consumed in your account. The consumption history will be returned for all workspace_ids on your account.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start_date |
Optional[Union[str, datetime]]
|
The start date for the credit consumption search, datetime or isoformat string e.g. 2021-12-01. Default start_date None uses 2000-01-01. |
None
|
end_date |
Optional[Union[str, datetime]]
|
The end date for the credit consumption search, datetime or isoformat string e.g. 2021-12-31. Default end_date None uses current date. |
None
|
Returns:
Type | Description |
---|---|
Dict[str, Union[str, int, Dict]]
|
A dict with the information of the credit consumption records for all the users linked by the account_id. |
Source code in up42/main.py
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
|
get_logger(name, level=logging.INFO, verbose=False)
¶
Use level=logging.CRITICAL to disable temporarily.
Source code in up42/utils.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
|
get_webhook_events()
¶
Gets all available webhook events.
Returns:
Type | Description |
---|---|
dict
|
A dict of the available webhook events. |
Source code in up42/main.py
128 129 130 131 132 133 134 135 136 137 |
|
get_webhooks(return_json=False)
¶
Gets all registered webhooks for this workspace.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
return_json |
bool
|
If true returns the webhooks information as JSON instead of webhook class objects. |
False
|
Returns:
Type | Description |
---|---|
List[Webhook]
|
A list of the registered webhooks for this workspace. |
Source code in up42/main.py
88 89 90 91 92 93 94 95 96 97 98 99 |
|
validate_manifest(path_or_json)
¶
Validates a block manifest JSON.
The block manifest is required to build a custom block on UP42 and contains the metadata about the block as well as block input and output capabilities.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path_or_json |
Union[str, Path, dict]
|
The input manifest, either a filepath or JSON string, see example. |
required |
Returns:
Type | Description |
---|---|
dict
|
A dictionary with the validation results and potential validation errors. |
Source code in up42/main.py
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
|
Asset
¶
The Asset class enables access to the UP42 assets in the storage. Assets are results of orders or results of jobs with download blocks.
Use an existing asset:
asset = up42.initialize_asset(asset_id="8c2dfb4d-bd35-435f-8667-48aea0dce2da")
Source code in up42/asset.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
|
download(output_directory=None, unpacking=True)
¶
Downloads the asset. Unpacking the downloaded file will happen as default.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
output_directory |
Union[str, Path, None]
|
The file output directory, defaults to the current working directory. |
None
|
unpacking |
bool
|
By default the download TGZ/TAR or ZIP archive file will be unpacked. |
True
|
Returns:
Type | Description |
---|---|
List[str]
|
List of the downloaded asset filepaths. |
Source code in up42/asset.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
|
info: dict
property
¶
Gets and updates the asset metadata information.
stac_info: Union[dict, None]
property
¶
Gets the storage STAC information for the asset as a FeatureCollection.
One asset can contain multiple STAC items (e.g. the pan- and multispectral images).
update_metadata(title=None, tags=None, **kwargs)
¶
Update the metadata of the asset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
title |
str
|
The title string to be assigned to the asset. |
None
|
tags |
List[str]
|
A list of tag strings to be assigned to the asset. |
None
|
Returns:
Type | Description |
---|---|
dict
|
The updated asset metadata information |
Source code in up42/asset.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
Catalog
¶
The Catalog class enables access to the UP42 catalog functionality (data archive search & ordering).
Use catalog:
catalog = up42.initialize_catalog()
Source code in up42/catalog.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 |
|
construct_order_parameters(data_product_id, image_id, aoi=None)
¶
Helps constructing the parameters dictionary required for the catalog order. Some collections have
additional parameters that are added to the output dictionary with value None. The potential values to
select from are given in the logs, for more detail on the parameter use catalog.get_data_product_schema()
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_product_id |
str
|
Id of the desired UP42 data product, see |
required |
image_id |
str
|
The id of the desired image (from search results) |
required |
aoi |
Union[dict, Feature, FeatureCollection, list, GeoDataFrame, Polygon]
|
The geometry of the order, one of dict, Feature, FeatureCollection, list, GeoDataFrame, Polygon. Optional for "full-image products". |
None
|
Returns:
Type | Description |
---|---|
The order parameters dictionary. |
Example
order_parameters = catalog.construct_order_parameters(
data_product_id='647780db-5a06-4b61-b525-577a8b68bb54',
image_id='6434e7af-2d41-4ded-a789-fb1b2447ac92',
aoi={'type': 'Polygon',
'coordinates': (((13.375966, 52.515068),
(13.375966, 52.516639),
(13.378314, 52.516639),
(13.378314, 52.515068),
(13.375966, 52.515068)),)})
Source code in up42/catalog.py
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 |
|
construct_parameters(**kwargs)
¶
Deprecated, see construct_search_parameters
Source code in up42/catalog.py
200 201 202 203 |
|
construct_search_parameters(geometry, collections, start_date='2020-01-01', end_date='2020-01-30', usage_type=None, limit=10, max_cloudcover=None, sortby='acquisitionDate', ascending=True)
staticmethod
¶
Helps constructing the parameters dictionary required for the search.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
geometry |
Union[FeatureCollection, Feature, dict, list, GeoDataFrame, Polygon]
|
The search geometry, default a Polygon. One of FeatureCollection, Feature, dict (geojson geometry), list (bounds coordinates), GeoDataFrame, shapely.Polygon, shapely.Point. All assume EPSG 4326! |
required |
collections |
List[str]
|
The satellite sensor collections to search for, e.g. ["phr"] or ["phr", "spot"]. Also see catalog.get_collections(). |
required |
start_date |
str
|
Query period starting day, format "2020-01-01". |
'2020-01-01'
|
end_date |
str
|
Query period ending day, format "2020-01-01". |
'2020-01-30'
|
usage_type |
List[str]
|
Optional. Filter for imagery that can be purchased & downloaded or also processed. ["DATA"] (can only be downloaded), ["ANALYTICS"] (can be downloaded or used directly with a processing algorithm), ["DATA", "ANALYTICS"] (can be any combination). The filter is inclusive, using ["DATA"] can also result in results with ["DATA", "ANALYTICS"]. |
None
|
limit |
int
|
The maximum number of search results to return (1-max.500). |
10
|
max_cloudcover |
Optional[int]
|
Optional. Maximum cloud coverage percent - e.g. 100 will return all scenes, 8.4 will return all scenes with 8.4 or less cloud coverage. |
None
|
sortby |
str
|
The property to sort by, "cloudCoverage", "acquisitionDate", "acquisitionIdentifier", "incidenceAngle", "snowCover". |
'acquisitionDate'
|
ascending |
bool
|
Ascending sort order by default, descending if False. |
True
|
Returns:
Type | Description |
---|---|
dict
|
The constructed parameters dictionary. |
Source code in up42/catalog.py
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
|
download_quicklooks(image_ids, collection, output_directory=None)
¶
Gets the quicklooks of scenes from a single sensor. After download, can be plotted via catalog.map_quicklooks() or catalog.plot_quicklooks().
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image_ids |
List[str]
|
List of provider image_ids e.g. ["6dffb8be-c2ab-46e3-9c1c-6958a54e4527"].
Access the search results id column via |
required |
collection |
str
|
The data collection corresponding to the image ids. |
required |
output_directory |
Union[str, Path, None]
|
The file output directory, defaults to the current working directory. |
None
|
Returns:
Type | Description |
---|---|
List[str]
|
List of quicklook image output file paths. |
Source code in up42/catalog.py
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 |
|
estimate_order(order_parameters, **kwargs)
¶
Estimate the cost of an order.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
order_parameters |
Union[dict, None]
|
A dictionary like {dataProduct: ..., "params": {"id": ..., "aoi": ...}} |
required |
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
An estimated cost for the order in UP42 credits. |
Warning "Deprecated order parameters" The use of the 'scene' and 'geometry' parameters for the data estimation is deprecated. Please use the new order_parameters parameter as described above.
Source code in up42/catalog.py
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
|
search(search_parameters, as_dataframe=True)
¶
Searches the catalog for the the search parameters and returns the metadata of the matching scenes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
search_parameters |
dict
|
The catalog search parameters, see example. |
required |
as_dataframe |
bool
|
return type, GeoDataFrame if True (default), FeatureCollection if False. |
True
|
Returns:
Type | Description |
---|---|
Union[GeoDataFrame, dict]
|
The search results as a GeoDataFrame, optionally as JSON dict. |
Example
search_parameters={
"datetime": "2019-01-01T00:00:00Z/2019-01-15T23:59:59Z",
"collections": ["phr"],
"intersects": {
"type": "Polygon",
"coordinates": [[[13.32113746,52.73971768],[13.15981158,52.2092959],
[13.62204483,52.15632025],[13.78859517,52.68655119],[13.32113746,
52.73971768]]]},
"limit": 10,
"sortby": [{"field" : "properties.acquisitionDate", "direction" : "asc"}]
}
Source code in up42/catalog.py
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 |
|
Job
¶
The Job class is the result of running a workflow. It lets you download, visualize and manipulate the results of the job, and keep track of the status or cancel a job while still running.
Run a new job:
job = workflow.run_job(name="new_job", input_parameters={...})
Use an existing job:
job = up42.initialize_job(job_id="de5806aa-5ef1-4dc9-ab1d-06d7ec1a5021")
Source code in up42/job.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 |
|
cancel_job()
¶
Cancels a pending or running job.
Source code in up42/job.py
127 128 129 130 131 |
|
download_quicklooks(output_directory=None)
¶
Conveniance function that downloads the quicklooks of the data (dirst) jobtask.
After download, can be plotted via job.plot_quicklooks().
Source code in up42/job.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
|
download_results(output_directory=None, unpacking=True)
¶
Downloads the job results. Unpacking the final file will happen as default.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
output_directory |
Union[str, Path, None]
|
The file output directory, defaults to the current working directory. |
None
|
unpacking |
bool
|
By default the final result which is in TAR archive format will be unpacked. |
True
|
Returns:
Type | Description |
---|---|
List[str]
|
List of the downloaded results' filepaths. |
Source code in up42/job.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
|
get_credits()
¶
Gets the credit costs of the job.
Returns:
Type | Description |
---|---|
dict
|
The consumed credits for the job. |
Source code in up42/job.py
347 348 349 350 351 352 353 354 355 356 357 358 359 |
|
get_jobtasks(return_json=False)
¶
Get the individual items of the job as a list of JobTask objects or JSON.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
return_json |
bool
|
If True returns the JSON information of the job tasks. |
False
|
Returns:
Type | Description |
---|---|
Union[List[JobTask], List[dict]]
|
The job task objects in a list. |
Source code in up42/job.py
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 |
|
get_jobtasks_results_json()
¶
Convenience function to get the resulting data.json of all job tasks in a dictionary of strings.
Returns:
Type | Description |
---|---|
dict
|
The data.json of all single job tasks. |
Source code in up42/job.py
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 |
|
get_logs(as_print=True, as_return=False)
¶
Convenience function to print or return the logs of all job tasks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
as_print |
bool
|
Prints the logs, no return. |
True
|
as_return |
bool
|
Also returns the log strings. |
False
|
Returns:
Type | Description |
---|---|
Optional[dict]
|
The log strings (only if as_return was selected). |
Source code in up42/job.py
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 |
|
get_results_json(as_dataframe=False)
¶
Gets the Job results data.json.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
as_dataframe |
bool
|
Return type, Default Feature Collection. GeoDataFrame if True. |
False
|
Returns:
Type | Description |
---|---|
Union[dict, GeoDataFrame]
|
The job data.json. |
Source code in up42/job.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
|
info: dict
property
¶
Gets and updates the job metadata information.
is_succeeded: bool
property
¶
Gets True
if the job succeeded, False
otherwise.
Also see status attribute.
status: str
property
¶
Gets the job progress status. One of SUCCEEDED
, NOT STARTED
, PENDING
,
RUNNING
, CANCELLED
, CANCELLING
, FAILED
, ERROR
.
track_status(report_time=30)
¶
` Continuously gets the job status until job has finished or failed.
Internally checks every five seconds for the status, prints the log every time interval given in report_time argument.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
report_time |
int
|
The intervall (in seconds) when to query the job status. |
30
|
Source code in up42/job.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
|
upload_results_to_bucket(gs_client, bucket, folder, extension='.tgz', version='v0')
¶
Uploads the results of a job directly to a custom google cloud storage bucket.
Source code in up42/job.py
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
|
JobCollection
¶
The JobCollection class provides facilities for handling and downloading multiple jobs results as one object.
A jobcollection is created as the result of e.g. running multiple jobs in parallel:
jobcollection = workflow.run_jobs_parallel()
Initialize a jobcollection from existing jobs:
jobcollection = up42.initialize_jobcollection(job_ids=["12345", "6789"])
Source code in up42/jobcollection.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
apply(worker, only_succeeded=True, **kwargs)
¶
Helper function to apply worker
on all jobs in the collection.
worker
needs to accept Job
as first argument. For example, a
lambda function that returns the job info:
self.apply(lambda job: job.info)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
worker |
Callable
|
A function to apply on all jobs in the collection. |
required |
only_succeeded |
bool
|
Only apply to succeeded jobs (default is |
True
|
kwargs |
additional keyword arguments to pass to |
{}
|
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
Dictionary where the key is the job id and the value the return |
Dict[str, Any]
|
of |
Source code in up42/jobcollection.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|
download_results(output_directory=None, merge=True, unpacking=True)
¶
Downloads the job results. The final results are individually downloaded and by default a merged data.json is generated with all the results in a single feature collection. Unpacking the final will happen as default.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
output_directory |
Union[str, Path, None]
|
The file output directory, defaults to the current working directory. |
None
|
merge |
bool
|
Wether to generate a merged data.json with all results. |
True
|
unpacking |
bool
|
By default the final result which is in TAR archive format will be unpacked. |
True
|
Returns:
Type | Description |
---|---|
Dict[str, List[str]]
|
Dict of the job_ids and jobs' downloaded results filepaths. In addition, |
Dict[str, List[str]]
|
an additional key merged_result is added with the path to the merged |
Dict[str, List[str]]
|
data.json. |
Source code in up42/jobcollection.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
info: Dict[str, dict]
property
¶
Gets and updates the metadata information for each job in the jobcollection, dictionary of job_id : job_information.
status: Dict[str, str]
property
¶
Gets the status for each job in the jobcollection, a dictionary with job_id : job status.
JobTask
¶
The JobTask class provides access to the result of a specific block in the workflow. Each job contains one or multiple JobTasks, one for each block.
Use an existing jobtask:
jobtask = up42.initialize_jobtask(jobtask_id="3f772637-09aa-4164-bded-692fcd746d20",
job_id="de5806aa-5ef1-4dc9-ab1d-06d7ec1a5021")
Source code in up42/jobtask.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
|
download_quicklooks(output_directory=None)
¶
Downloads quicklooks of the job task to disk.
After download, can be plotted via jobtask.plot_quicklooks().
Parameters:
Name | Type | Description | Default |
---|---|---|---|
output_directory |
Union[str, Path, None]
|
The file output directory, defaults to the current working directory. |
None
|
Returns:
Type | Description |
---|---|
List[str]
|
The quicklooks filepaths. |
Source code in up42/jobtask.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
|
download_results(output_directory=None)
¶
Downloads and unpacks the jobtask results. Default download to Desktop.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
output_directory |
Union[str, Path, None]
|
The file output directory, defaults to the current working directory. |
None
|
Returns:
Type | Description |
---|---|
List[str]
|
List of the downloaded results' filepaths. |
Source code in up42/jobtask.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
|
get_results_json(as_dataframe=False)
¶
Gets the Jobtask results data.json.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
as_dataframe |
bool
|
"fc" for FeatureCollection dict, "df" for GeoDataFrame. |
False
|
Returns:
Type | Description |
---|---|
Union[dict, GeoDataFrame]
|
Json of the results, alternatively geodataframe. |
Source code in up42/jobtask.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|
info: dict
property
¶
Gets and updates the jobtask metadata information.
Order
¶
The Order class enables you to place, inspect and get information on orders.
Use an existing order:
order = up42.initialize_order(order_id="ea36dee9-fed6-457e-8400-2c20ebd30f44")
Source code in up42/order.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
|
estimate(auth, order_parameters)
staticmethod
¶
Returns an estimation of the cost of an order.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
auth |
Auth
|
An authentication object. |
required |
order_parameters |
dict
|
A dictionary like {dataProduct: ..., "params": {"id": ..., "aoi": ...}} |
required |
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
The estimated cost of the order |
Source code in up42/order.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
|
get_assets()
¶
Gets the Order assets or results.
Source code in up42/order.py
73 74 75 76 77 78 79 80 81 82 |
|
info: dict
property
¶
Gets and updates the order information.
is_fulfilled: bool
property
¶
Gets True
if the order is fulfilled, False
otherwise.
Also see status attribute.
place(auth, order_parameters)
classmethod
¶
Places an order.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
auth |
Auth
|
An authentication object. |
required |
order_parameters |
dict
|
A dictionary like {dataProduct: ..., "params": {"id": ..., "aoi": ...}} |
required |
Returns:
Name | Type | Description |
---|---|---|
Order |
Order
|
The placed order. |
Source code in up42/order.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
|
status: str
property
¶
Gets the Order status. One of PLACED
, FAILED
, FULFILLED
, BEING_FULFILLED
, FAILED_PERMANENTLY
.
track_status(report_time=120)
¶
Continuously gets the order status until order is fulfilled or failed.
Internally checks every report_time
(s) for the status and prints the log.
Warning
When placing orders of items that are in archive or cold storage,
the order fulfillment can happen up to 24h after order placement.
In such cases,
please make sure to set an appropriate report_time
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
report_time |
int
|
The interval (in seconds) when to get the order status. |
120
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The final order status. |
Source code in up42/order.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
|
Project
¶
The Project is the top-level class of the UP42 hierarchy. With it you can create new workflows, query already existing workflows & jobs in the project and manage the project settings.
Create a new project on the UP42 Console website.
Use an existing project:
up42.authenticate(project_id="uz92-8uo0-4dc9-ab1d-06d7ec1a5321",
project_api_key="9i7uec8a-45be-41ad-a50f-98bewb528b10")
project = up42.initialize_project()
Source code in up42/project.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 |
|
create_workflow(name, description='', use_existing=False)
¶
Creates a new workflow and returns a workflow object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
Name of the new workflow. |
required |
description |
str
|
Description of the new workflow. |
''
|
use_existing |
bool
|
If True, instead of creating a new workflow, uses the most recent workflow with the same name & description. |
False
|
Returns:
Type | Description |
---|---|
Workflow
|
The workflow object. |
Source code in up42/project.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
|
get_jobs(return_json=False, test_jobs=True, real_jobs=True, limit=500, sortby='createdAt', descending=True)
¶
Get all jobs in the project as a JobCollection or JSON.
Use Workflow().get_job() to get a JobCollection with jobs associated with a specific workflow.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
return_json |
bool
|
If true, returns the job info JSONs instead of JobCollection. |
False
|
test_jobs |
bool
|
Return test jobs or test queries. |
True
|
real_jobs |
bool
|
Return real jobs. |
True
|
limit |
int
|
Only return n first jobs by sorting criteria and order, default 500. |
500
|
sortby |
str
|
The sorting criteria, one of "createdAt", "name", "id", "mode", "status", "startedAt", "finishedAt". |
'createdAt'
|
descending |
bool
|
The sorting order, True for descending (default), False for ascending. |
True
|
Returns:
Type | Description |
---|---|
Union[JobCollection, List[dict]]
|
All job objects in a JobCollection, or alternatively the jobs info as JSON. |
Source code in up42/project.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
|
get_project_settings()
¶
Gets the project settings.
Returns:
Type | Description |
---|---|
List[Dict[str, str]]
|
The project settings. |
Source code in up42/project.py
211 212 213 214 215 216 217 218 219 220 221 |
|
get_workflows(return_json=False)
¶
Gets all workflows in a project as workflow objects or JSON.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
return_json |
bool
|
True returns infos of workflows as JSON instead of workflow objects. |
False
|
Returns:
Type | Description |
---|---|
Union[List[Workflow], List[dict]]
|
List of Workflow objects in the project or alternatively JSON info of the workflows. |
Source code in up42/project.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
|
info: dict
property
¶
Gets and updates the project metadata information.
max_concurrent_jobs: int
property
¶
Gets the maximum number of concurrent jobs allowed by the project settings.
update_project_settings(max_aoi_size=None, max_concurrent_jobs=None, number_of_images=None)
¶
Updates a project's settings.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
max_aoi_size |
Optional[int]
|
The maximum area of interest geometry size, from 1-1000 sqkm, default 10 sqkm. |
None
|
max_concurrent_jobs |
Optional[int]
|
The maximum number of concurrent jobs, from 1-10, default 1. |
None
|
number_of_images |
Optional[int]
|
The maximum number of images returned with each job, from 1-20, default 10. |
None
|
Source code in up42/project.py
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 |
|
Storage
¶
The Storage class enables access to the UP42 storage. You can list your assets and orders within an UP42 workspace.
Use the storage:
storage = up42.initialize_storage()
Source code in up42/storage.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 |
|
get_assets(created_after=None, created_before=None, acquired_after=None, acquired_before=None, geometry=None, workspace_id=None, collection_names=None, producer_names=None, tags=None, sources=None, search=None, custom_filter=None, limit=None, sortby='createdAt', descending=True, return_json=False)
¶
Gets a list of assets in storage as Asset objects or in JSON format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
created_after |
Optional[Union[str, datetime]]
|
Search for assets created after the specified timestamp, in |
None
|
created_before |
Optional[Union[str, datetime]]
|
Search for assets created before the specified timestamp, in |
None
|
acquired_after |
Optional[Union[str, datetime]]
|
Search for assets that contain data acquired after the specified timestamp, in |
None
|
acquired_before |
Optional[Union[str, datetime]]
|
Search for assets that contain data acquired before the specified timestamp, in |
None
|
geometry |
Optional[Union[dict, Feature, FeatureCollection, list, GeoDataFrame, Polygon]]
|
Search for assets that contain STAC items intersecting the provided geometry, in EPSG:4326 (WGS84) format. For more information on STAC items, see Introduction to STAC. |
None
|
workspace_id |
Optional[str]
|
Search by the workspace ID. |
None
|
collection_names |
List[str]
|
Search for assets from any of the provided geospatial collections. |
None
|
producer_names |
List[str]
|
Search for assets from any of the provided producers. |
None
|
tags |
List[str]
|
Search for assets with any of the provided tags. |
None
|
sources |
List[str]
|
Search for assets from any of the provided sources. The allowed values: |
None
|
search |
str
|
Search for assets that contain the provided search query in their name, title, or order ID. |
None
|
custom_filter |
dict
|
CQL2 filters used to search for assets that contain STAC items with specific property values. For more information on filters, see CQL2 Filtering. For more information on STAC items, see Introduction to STAC. |
None
|
limit |
Optional[int]
|
The number of results on a results page. |
None
|
sortby |
str
|
The property to sort by. |
'createdAt'
|
descending |
bool
|
The sorting order:
|
True
|
return_json |
bool
|
If |
False
|
Returns:
Type | Description |
---|---|
Union[List[Asset], dict]
|
A list of Asset objects. |
Source code in up42/storage.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
|
get_orders(return_json=False, limit=None, sortby='createdAt', descending=True)
¶
Gets all orders in the workspace as Order objects or JSON.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
return_json |
bool
|
If set to True, returns JSON object. |
False
|
limit |
Optional[int]
|
Optional, only return n first assets by sorting criteria and order. Optimal to select if your workspace contains many assets. |
None
|
sortby |
str
|
The sorting criteria, one of "createdAt", "updatedAt", "status", "dataProvider", "type". |
'createdAt'
|
descending |
bool
|
The sorting order, True for descending (default), False for ascending. |
True
|
Returns:
Type | Description |
---|---|
Union[List[Order], dict]
|
Order objects in the workspace or alternatively JSON info of the orders. |
Source code in up42/storage.py
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 |
|
pystac_client
property
¶
PySTAC client, a Python package for working with UP42 STAC API and accessing storage assets. For more information, see PySTAC Client Documentation.
Tasking
¶
The Tasking class enables access to the UP42 tasking functionality.
Use tasking:
tasking = up42.initialize_tasking()
Source code in up42/tasking.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
|
construct_order_parameters(data_product_id, name, acquisition_start, acquisition_end, geometry)
¶
Helps constructing the parameters dictionary required for the tasking order. Each sensor has additional
parameters that are added to the output dictionary with value None. The potential values for to select from
are given in the logs, for more detail on the parameter use tasking.get_data_product_schema()
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_product_id |
str
|
Id of the desired UP42 data product, see |
required |
name |
str
|
Name of the tasking order project. |
required |
acquisition_start |
Union[str, datetime]
|
Start date of the acquisition period, datetime or isoformat string e.g. "2022-11-01" |
required |
acquisition_end |
Union[str, datetime]
|
End date of the acquisition period, datetime or isoformat string e.g. "2022-11-01" |
required |
geometry |
Union[FeatureCollection, Feature, dict, list, GeoDataFrame, Polygon, Point]
|
Geometry of the area to be captured, default a Polygon. Allows Point feature for specific data products. One of FeatureCollection, Feature, dict (geojson geometry), list (bounds coordinates), GeoDataFrame, shapely.Polygon, shapely.Point. All assume EPSG 4326! |
required |
Returns:
Type | Description |
---|---|
The constructed order parameters dictionary. |
Example
order_parameters = tasking.construct_order_parameters(
data_product_id='647780db-5a06-4b61-b525-577a8b68bb54',
name="My tasking order",
acquisition_start=2022-11-01,
acquisition_end=2022-12-01,
geometry={'type': 'Polygon',
'coordinates': (((13.375966, 52.515068),
(13.375966, 52.516639),
(13.378314, 52.516639),
(13.378314, 52.515068),
(13.375966, 52.515068)),)}
)
Source code in up42/tasking.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
|
Webhook
¶
Webhook¶
Webhook class to control a specific UP42 webhook, e.g. modify, test or delete the specific webhook.
webhook = webhook.trigger_test_event()
Source code in up42/webhooks.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
delete()
¶
Deletes a registered webhook.
Source code in up42/webhooks.py
94 95 96 97 98 99 100 |
|
info: dict
property
¶
Gets and updates the webhook metadata information.
trigger_test_events()
¶
Triggers webhook test event to test your receiving side. The UP42 server will send test messages for each subscribed event to the specified webhook URL.
Returns:
Type | Description |
---|---|
dict
|
A dict with information about the test events. |
Source code in up42/webhooks.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
update(name=None, url=None, events=None, active=None, secret=None)
¶
Updates a registered webhook.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
Optional[str]
|
Updated webhook name |
None
|
url |
Optional[str]
|
Updated unique URL where the webhook will send the message (HTTPS required) |
None
|
events |
Optional[List[str]]
|
Updated list of event types [order.status, job.status]. |
None
|
active |
Optional[bool]
|
Updated webhook status. |
None
|
secret |
Optional[str]
|
Updated string that acts as signature to the https request sent to the url. |
None
|
Returns:
Type | Description |
---|---|
Webhook
|
The updated webhook object. |
Source code in up42/webhooks.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
Workflow
¶
The Workflow class lets you configure & run jobs and query existing jobs related to this workflow.
Create a new workflow:
workflow = project.create_workflow(name="new_workflow")
Use an existing workflow:
workflow = up42.initialize_workflow(workflow_id="7fb2ec8a-45be-41ad-a50f-98ba6b528b98")
Source code in up42/workflow.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 |