Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update docs and fix .readthedocs build #60

Merged
merged 3 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ build:
sphinx:
configuration: docs/conf.py
fail_on_warning: false

python:
install:
- requirements: docs/requirements.txt
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Capella Space - A New Perspective on Earth Observation
Copyright (c) 2024 Capella Space - A New Perspective on Earth Observation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[![Supported Python Versions](https://img.shields.io/pypi/pyversions/capella-console-client.svg)](https://pypi.org/project/capella-console-client/)
[![Documentation](https://readthedocs.org/projects/capella-console-client/badge/?version=main)](https://capella-console-client.readthedocs.io)

Python SDK for api.capellaspace.com (search, order, download)
Python SDK for api.capellaspace.com (task, search, order, download)


## Installation
Expand Down Expand Up @@ -87,4 +87,4 @@ Contributions are very much welcomed and appreciated. See [how to contribute](ht


## License
• Licensed under the [MIT License](https://github.com/capellaspace/console-client/blob/master/LICENSE) • Copyright 2023 • Capella Space •
• Licensed under the [MIT License](https://github.com/capellaspace/console-client/blob/master/LICENSE) • Copyright 2024 • Capella Space •
16 changes: 11 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import os
import sys
import importlib
from datetime import date

sys.path.insert(0, os.path.abspath("../"))
from capella_console_client.version import __version__
# import os
# import toml
# from pathlib import Path

# pyproject = toml.load(Path(__file__).parent.parent / "pyproject.toml")
# __version__ = pyproject["tool"]["poetry"]["version"]

project = "capella-console-client"
copyright = "2022, Capella Space"
__version__ = importlib.metadata.version(project)

author = "Capella Space"
copyright = f"{date.today().year}, {author}"

version = __version__
release = __version__
Expand Down
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
:alt: Supported Python Versions


**capella-console-client** is the Python SDK for `api.capellaspace.com <https://api.capellaspace.com>`_ (search, order, download - `see API docs <https://docs.capellaspace.com/api/data-access>`_)
**capella-console-client** is the Python SDK for `api.capellaspace.com <https://api.capellaspace.com>`_ (task, search, order, download - `see API docs <https://docs.capellaspace.com/api/data-access>`_)

Installation
============
Expand Down Expand Up @@ -55,7 +55,7 @@ For more detail see :ref:`wizard`

License
=======
• Licensed under the `MIT License <https://github.com/capellaspace/console-client/blob/master/LICENSE>`_ • 2023 • Capella Space •
• Licensed under the `MIT License <https://github.com/capellaspace/console-client/blob/master/LICENSE>`_ • 2024 • Capella Space •

.. toctree::
:hidden:
Expand Down
170 changes: 84 additions & 86 deletions docs/pages/example_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -715,90 +715,8 @@ Issue the following snippet to view the ordering history
specific_orders = client.list_orders(order_ids=[specific_order_id])


tasking requests
################

search for tasking requests

.. code:: python3

tasking_request_id = "27a71826-7819-48cc-b8f2-0ad10bee0f97" # provide valid taskingrequest_id

# get task info
task = client.get_task(tasking_request_id)

# was it completed?
client.is_task_completed(task)

advanced tasking request search

.. code:: python3

# get ALL completed tasking requests of user
user_completed_trs = client.list_tasking_requests(status="completed")

# get all COMPLETED tasking requests of ORG (requires org manager/ admin role)
org+completed_trs = client.list_tasking_requests(
for_org=True,
status="completed"
)

# get all completed tasking requests of org SUBMITTED AFTER 2022-12-01 (UTC)
org_completed_trs_submitted_dec_22 = client.list_tasking_requests(
for_org=True,
status="completed",
submission_time__gt=datetime.datetime(2022, 12, 1)
)



.. _read imagery:


read imagery
############

Given a presigned asset href (see `presigned items`_) load imagery into memory

NOTE: requires `rasterio <https://pypi.org/project/rasterio/>`_ (not part of this package)

.. code:: python3

import rasterio

# raster profile
raster_presigned_href = assets_presigned[0]["HH"]["href"]
with rasterio.open(raster_presigned_href) as ds:
print(ds.profile)

# read chunk of raster
with rasterio.open(raster_presigned_href) as ds:
chunk = ds.read(1, window=rasterio.windows.Window(2000, 2000, 7000, 7000))
print(chunk.shape)

# read thumbnail
thumb_presigned_href = assets_presigned[0]["thumbnail"]["href"]
with rasterio.open(thumb_presigned_href) as ds:
thumb = ds.read(1)
print(thumb.shape)


.. _read metadata:

read metadata
#############

.. code:: python3

import httpx

# read extended metadata .json
metadata_presigned_href = assets_presigned[0]["metadata"]["href"]
metadata = httpx.get(metadata_presigned_href).json()


create tasking request
##############
######################

Create a tasking request with basic parameters

Expand Down Expand Up @@ -838,7 +756,7 @@ Create a tasking request with basic parameters


create repeating tasking request
##############
################################

Create a repeating tasking request with basic parameters

Expand Down Expand Up @@ -873,7 +791,7 @@ Create a repeating tasking request with basic parameters
]
),
name="I<3SAR",
description="My first tasking request"
description="My first repeat request"
)

# Note that you can only define either repeat_end OR repetition_count, not both. The following request will fail:
Expand All @@ -890,8 +808,88 @@ Create a repeating tasking request with basic parameters
]
),
name="I<3SAR",
description="My first tasking request",
description="My first repeat request",
repeat_start="2023-12-24 3:30 PM"
repeat_end="2023-12-31 3:30 PM",
repetition_count=23
)

search tasking request
######################


.. code:: python3

tasking_request_id = "27a71826-7819-48cc-b8f2-0ad10bee0f97" # provide valid taskingrequest_id

# get task info
task = client.get_task(tasking_request_id)

# was it completed?
client.is_task_completed(task)

advanced tasking request search

.. code:: python3

# get ALL completed tasking requests of user
user_completed_trs = client.list_tasking_requests(status="completed")

# get all COMPLETED tasking requests of ORG (requires org manager/ admin role)
org+completed_trs = client.list_tasking_requests(
for_org=True,
status="completed"
)

# get all completed tasking requests of org SUBMITTED AFTER 2022-12-01 (UTC)
org_completed_trs_submitted_dec_22 = client.list_tasking_requests(
for_org=True,
status="completed",
submission_time__gt=datetime.datetime(2022, 12, 1)
)



.. _read imagery:


read imagery
############

Given a presigned asset href (see `presigned items`_) load imagery into memory

NOTE: requires `rasterio <https://pypi.org/project/rasterio/>`_ (not part of this package)

.. code:: python3

import rasterio

# raster profile
raster_presigned_href = assets_presigned[0]["HH"]["href"]
with rasterio.open(raster_presigned_href) as ds:
print(ds.profile)

# read chunk of raster
with rasterio.open(raster_presigned_href) as ds:
chunk = ds.read(1, window=rasterio.windows.Window(2000, 2000, 7000, 7000))
print(chunk.shape)

# read thumbnail
thumb_presigned_href = assets_presigned[0]["thumbnail"]["href"]
with rasterio.open(thumb_presigned_href) as ds:
thumb = ds.read(1)
print(thumb.shape)


.. _read metadata:

read metadata
#############

.. code:: python3

import httpx

# read extended metadata .json
metadata_presigned_href = assets_presigned[0]["metadata"]["href"]
metadata = httpx.get(metadata_presigned_href).json()
9 changes: 7 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
sphinx==2.4.4
sphinx_rtd_theme==0.5.0
Sphinx==5.1.1
sphinx_rtd_theme==1.0.0
sphinx-autobuild==2021.3.14
sphinx-copybutton==0.5.0
sphinx-autodoc-typehints==1.19.2
Jinja2<3.1
-e .
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]
name = "capella-console-client"
version = "0.11.0"
description = "Python SDK for api.capellaspace.com (search, order, download)"
description = "Python SDK for api.capellaspace.com (task, search, order, download)"
authors = ["Thomas Beyer <[email protected]>"]
repository = "https://github.com/capellaspace/console-client"
documentation = "https://capella-console-client.readthedocs.io/"
Expand Down