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 |
|
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 fiels 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 |
|
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 |
|
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. |
Dict[str, Union[str, int, Dict]]
|
(see https://docs.up42.com/developers/api#operation/getHistory for output description) |
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 305 |
|
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. Also see the manifest chapter in the UP42 documentation.
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
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 |
|
initialize_asset(asset_id)
¶
Returns an Asset object (has to exist on UP42).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
asset_id |
str
|
The UP42 asset_id |
required |
Source code in up42/initialization.py
145 146 147 148 149 150 151 152 153 154 |
|
initialize_catalog()
¶
Returns a Catalog object for using the catalog search.
Source code in up42/initialization.py
47 48 49 50 51 52 |
|
initialize_job(job_id)
¶
Returns a Job object (has to exist on UP42).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
job_id |
str
|
The UP42 job_id |
required |
Source code in up42/initialization.py
77 78 79 80 81 82 83 84 85 86 |
|
initialize_jobcollection(job_ids)
¶
Returns a JobCollection object (the referenced jobs have to exist on UP42).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
job_ids |
List[str]
|
List of UP42 job_ids |
required |
Source code in up42/initialization.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|
initialize_jobtask(jobtask_id, job_id)
¶
Returns a JobTask object (has to exist on UP42).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
jobtask_id |
str
|
The UP42 jobtask_id |
required |
job_id |
str
|
The UP42 job_id |
required |
Source code in up42/initialization.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|
initialize_order(order_id)
¶
Returns an Order object (has to exist on UP42).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
order_id |
str
|
The UP42 order_id |
required |
Source code in up42/initialization.py
133 134 135 136 137 138 139 140 141 142 |
|
initialize_project()
¶
Returns the correct Project object (has to exist on UP42).
Source code in up42/initialization.py
37 38 39 40 41 42 43 44 |
|
initialize_storage()
¶
Returns a Storage object to list orders and assets.
Source code in up42/initialization.py
125 126 127 128 129 130 |
|
initialize_tasking()
¶
Returns a Tasking object for creating satellite tasking orders.
Source code in up42/initialization.py
55 56 57 58 59 60 |
|
initialize_webhook(webhook_id)
¶
Returns a Webhook object (has to exist on UP42).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
webhook_id |
str
|
The UP42 webhook_id |
required |
Source code in up42/initialization.py
157 158 159 160 161 162 163 164 165 166 |
|
initialize_workflow(workflow_id)
¶
Returns a Workflow object (has to exist on UP42).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
workflow_id |
str
|
The UP42 workflow_id |
required |
Source code in up42/initialization.py
63 64 65 66 67 68 69 70 71 72 73 74 |
|