API Reference
- class capella_console_client.CapellaConsoleClient(api_key=None, token=None, verbose=False, no_token_check=False, base_url='https://api.capellaspace.com', search_url=None, no_auth=False)[source]
API client for https://api.capellaspace.com.
API docs: https://docs.capellaspace.com/accessing-data/searching-for-data
- Parameters:
Note
not providing either api_key (can be set by CAPELLA_API_KEY env) or token will prompt you for api_key, which is not what you want in a script
- NOTE: precedence order (high to low)
API key
JWT token
- cancel_repeat_requests(*repeat_request_ids)[source]
cancel repeat requests
Find more information here. For Cancellation fees please refer to Capella’s Tasking Cancellation Policy Overview.
- Parameters:
repeat_request_ids (
Optional[str]) – list of repeat_request_ids to cancel- Returns:
cancel results in the following format:
{ "<tr-id-1>": { "success": True, # → no "error" field }, "<tr-id-2>": { "success": False, # ← **only when success=False** "error": {} }, ... }
- Return type:
Dict[str, Any]
- cancel_tasking_requests(*tasking_request_ids)[source]
cancel tasking requests
Find more information at. For Cancellation fees please refer to Capella’s Tasking Cancellation Policy Overview.
- Parameters:
tasking_request_ids (
Optional[str]) – list of tasking_request_ids to cancel- Returns:
cancel results in the following format:
{ "<tr-id-1>": { "success": True, # → no "error" field }, "<tr-id-2>": { "success": False, # ← **only when success=False** "error": {} }, ... }
- Return type:
Dict[str, Any]
- create_repeat_request(**kwargs)[source]
Create a new repeat request
Find more information at https://docs.capellaspace.com/constellation-tasking/tasking-requests
- Parameters:
archive_holdback – If defined will specify a time period during which the resulting imagery will be kept from the publicly accessible archive. One of “none”, “one_year”, “thirty_day”, “permanent”. Default: “none”
asc_dsc – Constraint on ascending/descending pass. One of “ascending”, “descending”, “either”. Default: “either”
azimuth_angle_max – clockwise angle with respect to North in a topocentric geodetic ENZ coordinate system from the target to the satellite. Default: None
azimuth_angle_min – clockwise angle with respect to North in a topocentric geodetic ENZ coordinate system from the target to the satellite. Default: None
azimuth_angle_tolerance – Tolerance to azimuth-angle deviations across all acquisitions. Units: [degrees]
collection_tier – Preference for data to be collected within a certain time after window_open. Can be either “flexible” or “routine”. Default: “routine”
collection_type – The collection type sets the collect mode, number of looks, and resolutions for the resulting imagery. The available collection types can be found by submitting: GET https://api.capellaspace.com/collectiontypes
contract_id – charge repeat request on explicit contract (if omitted default contract is used)
custom_attribute_1 – Can be used along with custom_attribute_2 to help you track a Capella task with your own metadata or internal systems. Default: None
custom_attribute_2 – Can be used along with custom_attribute_1 to help you track a Capella task with your own metadata or internal systems. Default: None
description – Can be used along with name to help characterize and describe the tasking request. Default: “”
geometry – A GeoJSON representation of the area/point of interest. Must be either a polygon or point
image_width – Image width. Units: [m], Default: None
insar_orbit – Insar Orbit identifier - required for insar collection_tier, MIO_53_2P95
local_time – Times, in the timezone of the area where the image will be collected, during which the collect can be taken. Represented by a list of time ranges as seconds in the day. For example, [[21600, 64800]] would allow collects between 6 AM and 6 PM; [[0, 21600], [64800, 86400]] would allow collects between 6 PM and 12 AM as well as from 12 AM to 6 AM. Alternatively, you can pass string values of “day”, “night”, or “anytime” which are parsed to [[21600, 64800]], [[0, 21600], [64800, 86400]], and [[0, 86400]] respectively. Default: None
look_angle_tolerance – Tolerance to look-angle deviations across all acquisitions. Units: [degrees]
look_direction – Constraint on view angle. One of “right”, “left”, “either”. Default: “either”
maintain_scene_framing – Flag to maintain consistent framing (look-direction, ascending/descending, orbital-plane) across all acquisitions.
max_squint_angle – max. allowed absolute squint angle when generating collects. Units: [degrees]. Default: None
name – Can be used along with description to help characterize and describe the tasking request. Default: “”
off_nadir_max – Maximum off-nadir angle permitted. Must be greater than off_nadir_min. Default: None
off_nadir_min – Minimum off-nadir angle permitted. Must be less than off_nadir_max. Default: None
orbital_planes – List of orbital planes allowed to service request. If empty any spacecraft in any plane can service request. One of 45, 53, 97. Default: None
polarization – Image polarization. One of “HH”, “VV”. Default: None
product_types – List of analytics to add to the order along with the imagery. Currently available analytics are Vessel classification (VC), Default: None
repeat_end – Starting date (in UTC) when you would like data to stop being collected. This and repetition_count are mutually exclusive; only one of them can be defined per request. Default: None
repeat_start – Starting date (in UTC) when you would like data to begin being collected. Default: Now
repetition_count – Total number of acquisitions in the repeat series. This and repeat_end are mutually exclusive; only one of them can be defined per request. Default: None
repetition_interval – Number of days between the start of each derived request. Default: 7
squint – Determines if generated collects will be squinted. One of: enabled, forward, backward. Default: enabled for point requests, disabled for area requests
window_duration – Duration of derived repeat requests in seconds
- Returns:
created repeat request metadata
- Return type:
Dict[str, Any]
- create_tasking_request(**kwargs)[source]
Create a new tasking request
Find more information at https://docs.capellaspace.com/constellation-tasking/tasking-requests
- Parameters:
archive_holdback – If defined will specify a time period during which the resulting imagery will be kept from the publicly accessible archive. One of “none”, “one_year”, “thirty_day”, “permanent”. Default: “none”
asc_dsc – Constraint on ascending/descending pass. One of “ascending”, “descending”, “either”. Default: “either”
azimuth_angle_max – clockwise angle with respect to North in a topocentric geodetic ENZ coordinate system from the target to the satellite. Default: None
azimuth_angle_min – clockwise angle with respect to North in a topocentric geodetic ENZ coordinate system from the target to the satellite. Default: None
collection_tier – Preference for data to be collected within a certain time after window_open. Can be one of “urgent”, “priority”, “standard”, and “flexible”. Default: “standard”
collection_type – The collection type sets the collect mode, number of looks, and resolutions for the resulting imagery. The available collection types can be found by submitting: GET https://api.capellaspace.com/collectiontypes
contract_id – charge tasking request on explicit contract (if omitted default contract is used)
custom_attribute_1 – Can be used along with custom_attribute_2 to help you track a Capella task with your own metadata or internal systems. Default: None
custom_attribute_2 – Can be used along with custom_attribute_1 to help you track a Capella task with your own metadata or internal systems. Default: None
description – Can be used along with name to help characterize and describe the tasking request. Default: “”
geometry – A GeoJSON representation of the area/point of interest. Must be either a polygon or point
image_width – Image width. Units: [m], Default: None
local_time – Times, in the timezone of the area where the image will be collected, during which the collect can be taken. Represented by a list of time ranges as seconds in the day. For example, [[21600, 64800]] would allow collects between 6 AM and 6 PM; [[0, 21600], [64800, 86400]] would allow collects between 6 PM and 12 AM as well as from 12 AM to 6 AM. Alternatively, you can pass string values of “day”, “night”, or “anytime” which are parsed to [[21600, 64800]], [[0, 21600], [64800, 86400]], and [[0, 86400]] respectively. Default: None
look_direction – Constraint on view angle. One of “right”, “left”, “either”. Default: “either”
max_squint_angle – max. allowed absolute squint angle when generating collects. Units: [degrees]. Default: None
name – Can be used along with description to help characterize and describe the tasking request. Default: “”
off_nadir_max – Maximum off-nadir angle permitted. Must be greater than off_nadir_min. Default: None
off_nadir_min – Minimum off-nadir angle permitted. Must be less than off_nadir_max. Default: None
orbital_planes – List of orbital planes allowed to service request. If empty any spacecraft in any plane can service request. One of 45, 53, 97. Default: None
polarization – Image polarization. One of “HH”, “VV”. Default: None
pre_approval – will skip the tasking request cost review step if set to true. Default: false
product_types – List of analytics to add to the order along with the imagery. Currently available analytics are Vessel classification (VC), Default: None
squint – Determines if generated collects will be squinted. One of: enabled, forward, backward. Default: enabled for point requests, disabled for area requests
window_close – Latest time (in UTC) that you would like data to be collected. Default: Seven days after window_open
window_open – Earliest time (in UTC) that you would like data to be collected. Default: Now
- Returns:
created tasking request metadata
- Return type:
Dict[str, Any]
- download_asset(pre_signed_url, local_path=PosixPath('/tmp'), override=False, show_progress=False, enable_resume=True)[source]
downloads a presigned asset url to disk
- Parameters:
pre_signed_url (
str) – presigned asset url, seeget_presigned_items()local_path (
Path|S3Path|str) – output path - file is written to OS’s temp dir if not provided, if directory provided filename will be set to original asset filenameoverride (
bool) – override already existing local_pathshow_progress (
bool) – show download status progressbarenable_resume (
bool) – enable resuming partial downloads (default: True). If enabled, partially downloaded files will be resumed from the last byte using HTTP Range headers. If the server doesn’t support Range, the file will be re-downloaded from the start.
- Return type:
Path|S3Path
- download_product(assets_presigned=None, order_id=None, local_dir=PosixPath('/tmp'), include=None, exclude=None, override=False, threaded=True, show_progress=False)[source]
download all assets of a product (TO BE DEPRECATED)
- Parameters:
assets_presigned (
Optional[dict[str,Any]]) – mapping of presigned assets of multiple products, seeget_presigned_assets()optionally provide order_id instead of assets_presigned, see
submit_order()- NOTE: Precedence order (high to low)
assets_presigned
order_id
local_dir (
Path|S3Path|str) – Path where assets are saved to, tempdir if not providedinclude (
UnionType[list[str|AssetType],str,None]) – white-listing, which assets should be included, e.g. [“HH”] => only download HH assetexclude (
UnionType[list[str|AssetType],str,None]) –black-listing, which assets should be excluded, e.g. [“HH”, “thumbnail”] => download ALL except HH and thumbnail assets NOTE: explicit DENY overrides explicit ALLOW
- asset choices:
- ’HH’, ‘VV’, ‘raster’, ‘metadata’, ‘thumbnail’ (external)
Note: raster == ‘HH’ || ‘VV’
’log’, ‘profile’, ‘stats’, ‘stats_plots’ (internal accessible only)
override (
bool) – override already existingthreaded (
bool) – download assets of product in multiple threadsshow_progress (
bool) – show download status progressbar
- Returns:
Local paths of downloaded files keyed by asset type, e.g.
{ "<asset_type>": <path-to-asset>, ... }
- Return type:
Dict[str, Path]
- download_products(items_presigned=None, order_id=None, tasking_request_id=None, collect_id=None, local_dir=PosixPath('/tmp'), include=None, exclude=None, override=False, threaded=True, show_progress=False, separate_dirs=True, product_types=None, contract_id=None, enable_resume=True)[source]
download all assets of multiple products
- Parameters:
items_presigned (
Optional[list[dict[str,Any]]]) – stac items with presigned assets, seeget_presigned_items()order_id (
Optional[str]) – optionally provide order_id instead of assets_presigned, seesubmit_order()tasking_request_id (
Optional[str]) – tasking request UUID of the task request you wish to download all associated products forcollect UUID you wish to download all associated products for
- NOTE: Precedence order (high to low)
items_presigned
order_id
tasking_request_id
collect_id
Meaning e.g. assets_presigned takes precedence over order_id, …
local_dir (
Path|S3Path|str) – Path where assets are saved to, tempdir if not providedinclude (
UnionType[list[str|AssetType],str,None]) – white-listing, which assets should be included, e.g. [“HH”] => only download HH assetexclude (
UnionType[list[str|AssetType],str,None]) –black-listing, which assets should be excluded, e.g. [“HH”, “thumbnail”] => download ALL except HH and thumbnail assets
NOTE: explicit DENY overrides explicit ALLOW
- asset choices:
’HH’, ‘VV’, ‘raster’, ‘metadata’, ‘thumbnail’ (external) - raster == ‘HH’ || ‘VV’
’log’, ‘profile’, ‘stats’, ‘stats_plots’ (internal)
override (
bool) – override already existingthreaded (
bool) – download assets of product in multiple threadsshow_progress (
bool) – show download status progressbarseparate_dirs (
bool) –- set to True in order to save the respective product assets into products directories, i.e.
/tmp/<stac_id_1>/<stac_id_1>.tif /tmp/<stac_id_2>/<stac_id_2>.tif …
- set to False in order to the respective product assets directly into the provided local_dir, i.e.
/tmp/<stac_id_1>.tif /tmp/<stac_id_2>.tif …
product_types (
Optional[list[str|ProductType]]) – filter by product type, e.g. [“SLC”, “GEO”]contract_id (
Optional[str]) – charge order on explicit contract (if omitted default contract is used)enable_resume (
bool) – enable resuming partial downloads (default: True). If enabled, partially downloaded files will be resumed from the last byte using HTTP Range headers. If the server doesn’t support Range, files will be re-downloaded from the start.
- Returns:
Local paths of downloaded files keyed by STAC id and asset type, e.g.
{ "stac_id_1": { "<asset_type>": <path-to-asset>, ... } }
- Return type:
- get_collects_for_task(tasking_request_id)[source]
get all the collects associated with this task (see
get_task())- Parameters:
task – task metadata - return of
get_task()tasking_request_id (str) –
- Returns:
collect metadata associated
- Return type:
List[Dict[str, Any]]
- get_presigned_assets(order_id, stac_ids=None, sort_by=None, assets_only=True)[source]
get presigned assets hrefs for all products contained in order
- Parameters:
- Returns:
List of assets of respective product, e.g.
[ { "<asset_type>": { "title": ..., "href": ..., "type": ... }, ... } ]
- Return type:
List[Dict[str, Any]]
- get_presigned_items(order_id, stac_ids=None, sort_by=None)[source]
get presigned items hrefs for all products contained in order
- Parameters:
- Returns:
List of assets of respective product, e.g.
[ { "<asset_type>": { "title": ..., "href": ..., "type": ... }, ... } ]
- Return type:
List[Dict[str, Any]]
- search(**kwargs)[source]
search Capella’s [S]patio [T]emporal [A]ssets [C]atalog
Find more information here.
supported query filters:
azimuth_angle: float, e.g. 123.4
bbox: List[float, float, float, float], e.g. [12.35, 41.78, 12.61, 42]
billable_area: Billable Area in m^2
center_frequency: Union[int, float], Center Frequency (GHz)
collections: List[str], e.g. [“capella-open-data”]
collect_id: str, capella internal collect-uuid, e.g. “78616ccc-0436-4dc2-adc8-b0a1e316b095”
collection_type: str, capella collection type, e.g. “spotlight_ultra”
constellation: str, e.g. “capella”
datetime: str, e.g. “2020-02-12T00:00:00Z”
epsg: int, e.g. 32648
frequency_band: str, Frequency band, one of “P”, “L”, “S”, “C”, “X”, “Ku”, “K”, “Ka”
ids: List[str], e.g. [“CAPELLA_C02_SP_GEO_HH_20201109060434_20201109060437”]
image_formation_algorithm: str, Image Formation Algorithm, one of “pfa”, “backprojection”
intersects: geometry component of the GeoJSON, e.g. {‘type’: ‘Point’, ‘coordinates’: [-113.1, 51.1]}
incidence_angle: Union[int, float], Center incidence angle, between 0 and 90
instruments: List[str], leveraged instruments, e.g. [“capella-radar-5”]
instrument_mode: str, Instrument mode, one of “spotlight”, “stripmap”, “sliding_spotlight”
limit: int, default: 500
layover_angle: str, e.g. -0.1
local_datetime: str, local datetime, e.g. 2022-12-12TT07:37:42.324551+0800
local_time: str, local time, e.g. 07:37:42.324551
local_timezone: str, local timezone, e.g. Asia/Shanghai
look_angle: Union[int, float], e.g. 28.4
looks_azimuth: int, e.g. 5
looks_equivalent_number: int, Equivalent number of looks (ENL), e.g. 3
looks_range: int, e.g. 5
observation_direction: str, Antenna pointing direction, one of “right”, “left”
orbit_state: str, Orbit State, one of “ascending”, “descending”
orbital_plane: int, Orbital Plane, inclination angle of orbit
pixel_spacing_azimuth: Union[int, float], Pixel spacing azimuth (m), e.g. 0.5
pixel_spacing_range: Union[int, float], Pixel spacing range (m), e.g. 0.5
platform: str, e.g. “capella-2”
polarizations: str, one of “HH”, “VV”, “HV”, “VH”
product_type: str, one of “SLC”, “GEO”
resolution_azimuth: float, Resolution azimuth (m), e.g. 0.5
resolution_ground_range: float, Resolution ground range (m), e.g. 0.5
resolution_range: float, Resolution range (m), e.g. 0.5
squint_angle: float, Squint angle, e.g. 30.1
ownership: str, one of “ownedByOrganization”, “sharedWithOrganization”, “availableForPurchase”, “publiclyAvailable”
- supported operators:
eq: equality search
in: within group
gt: greater than
gte: greater than equal
lt: lower than
lte: lower than equal
- sorting:
sortby: List[str] - must be supported fields, e.g. [“+datetime”]
- Returns:
STAC items matched
- Return type:
StacSearchResult
- search_repeat_requests(**kwargs)[source]
search repeat requests
Find more information at https://docs.capellaspace.com/constellation-tasking/searching-tasking-and-repeat-requests
supported query filters:
collection_type: CollectionType, e.g. “spotlight_ultra”
collection_tier: CollectionTier, e.g. “priority”
last_status_time: str, UTC datetime of latest status, e.g. “2020-02-12T00:00:00Z”, “2020-02-12”
for_org: boolean: str, scope repeat request search to user’s org (requires elevated permissions), e.g. True
instrument_mode: InstrumentMode, e.g. “spotlight”
org_id: str, organization id to list repeat requests for (requires elevated permissions) – takes precedence over for_org – , e.g. “34c78a57-2d68-4b4a-a7ba-c188f9e2645d”
repeat_request_id: str, repeat request id, e.g. “34c78a57-2d68-4b4a-a7ba-c188f9e2645d”
repeat_start: str, UTC datetime of beginning of window recurrences, e.g. “2020-02-11”
repeat_end: str, UTC datetime of end of window recurrences, e.g. “2020-02-12”
repetition_interval: int, number of days between the start of derived requests, e.g. 7
status: current status of repeat request, one of received, review, submitted, active, accepted, rejected, expired, completed, anomaly, canceled, error, failed
submission_time: str, UTC datetime of task submission, e.g. “2020-02-12T00:00:00Z”, “2020-02-12”
user_id: str, user id to list repeat requests for (requires elevated permissions) – takes precedence over for_org – , e.g. “34c78a57-2d68-4b4a-a7ba-c188f9e2645d”
page_size: int, page size, default: 250, needs to be between 250 and 500
show_progress: bool, display interactive progress bar during pagination, default: False
threaded: bool, enable parallel pagination requests, default: True
- supported operators:
eq: equality search
gt: greater than
gte: greater than equal
lt: lower than
lte: lower than equal
- Returns:
matched repeat requests
- Return type:
RepeatRequestSearchResult
- Parameters:
kwargs (Any) –
- search_tasking_requests(**kwargs)[source]
search tasking requests
Find more information at https://docs.capellaspace.com/constellation-tasking/tasking-requests
supported query filters:
collection_type: CollectionType, e.g. “spotlight_ultra”
collection_tier: CollectionTier, e.g. “priority”
last_status_time: str, UTC datetime of latest status, e.g. “2020-02-12T00:00:00Z”, “2020-02-12”
for_org: boolean: str, scope tasking request search to user’s org (requires elevated permissions), e.g. True
instrument_mode: InstrumentMode, e.g. “spotlight”
org_id: str, organization id to list tasking requests for (requires elevated permissions) – takes precedence over for_org – , e.g. “34c78a57-2d68-4b4a-a7ba-c188f9e2645d”
status: current TaskingRequestStatus, one of received, review, submitted, active, accepted, rejected, expired, completed, anomaly, canceled, error, failed
submission_time: str, UTC datetime of task submission, e.g. “2020-02-12T00:00:00Z”, “2020-02-12”
tasking_request_id: str, tasking request id, e.g. “34c78a57-2d68-4b4a-a7ba-c188f9e2645d”
user_id: str, user id to list tasking requests for (requires elevated permissions) – takes precedence over for_org – , e.g. “34c78a57-2d68-4b4a-a7ba-c188f9e2645d”
window_open: str, Earliest UTC datetime of collection, e.g. “2020-02-11”
window_close: str, Latest UTC datetime of collection, e.g. “2020-02-12”
page_size: int, page size, default: 250, needs to be between 250 and 500
show_progress: bool, display interactive progress bar during pagination, default: False
threaded: bool, enable parallel pagination requests, default: True
- supported operators:
eq: equality search
gt: greater than
gte: greater than equal
lt: lower than
lte: lower than equal
- Returns:
matched tasking requests
- Return type:
TaskingRequestSearchResult
- Parameters:
kwargs (Any) –
- submit_order(stac_ids=None, items=None, check_active_orders=False, omit_search=False, omit_review=False, contract_id=None)[source]
submit an order by stac_ids or items.
- NOTE: Precedence order (high to low)
stac_ids
items
- Parameters:
stac_ids (
Optional[list[str]]) – STAC IDs that active order should includeitems (
UnionType[list[dict[str,Any]],StacSearchResult,None]) – STAC items, returned bysearch()check_active_orders (
bool) – check if any active order containing ALL stac_ids is available if True: returns that order ID if False: submits a new order and returns new order IDomit_search (
bool) – omit search to ensure provided STAC IDs are valid - only works if items are providedomit_review (
bool) – omit review stagecontract_id (
Optional[str]) – charge order on explicit contract (if omitted default contract is used)Returns – str: order UUID
- Return type:
- update_repeat_requests(*repeat_request_ids, **kwargs)[source]
Update multiple repeat requests with the same field values (parallel)
- Parameters:
repeat_request_ids (
str) – UUIDs of the repeat requests to updatename – updated name
description – updated description
custom_attribute_1 – updated custom attribute 1
custom_attribute_2 – updated custom attribute 2
product_types – updated list of product types
- Returns:
update results keyed by repeat request ID
- Return type:
Dict[str, Any]
- update_tasking_requests(*tasking_request_ids, **kwargs)[source]
Update multiple tasking requests with the same field values (parallel)
- Parameters:
tasking_request_ids (
str) – UUIDs of tasking requests to updatename – updated name
description – updated description
custom_attribute_1 – updated custom attribute 1
custom_attribute_2 – updated custom attribute 2
product_types – updated list of product types
- Returns:
results keyed by tasking request id — the updated TR dict on success, or
{"success": False, ...}on failure- Return type:
Dict[str, Any]