From 8c204a24c01ed7cd4e9890c8ed03a6e2adcc3411 Mon Sep 17 00:00:00 2001 From: Thomas Beyer Date: Tue, 19 Dec 2023 17:03:33 -0800 Subject: [PATCH 1/2] migrating readthedocs.yml to use build.os --- .readthedocs.yml | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 8f5cfe6..4df04ca 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,15 +1,10 @@ version: 2 -sphinx: - configuration: docs/source/conf.py +build: + os: ubuntu-22.04 + tools: + python: "3.11" sphinx: + configuration: docs/source/conf.py fail_on_warning: false - -python: - version: 3.8 - install: - - method: pip - path: . - extra_requirements: - - docs \ No newline at end of file From d6badf7c648cf14351573b24f4e3e31d86766d01 Mon Sep 17 00:00:00 2001 From: Thomas Beyer Date: Thu, 4 Jan 2024 13:03:50 -0800 Subject: [PATCH 2/2] docs 2024 --- .readthedocs.yml | 6 +- LICENSE | 2 +- README.md | 4 +- docs/conf.py | 16 ++-- docs/index.rst | 4 +- docs/pages/example_usage.rst | 170 +++++++++++++++++------------------ docs/requirements.txt | 9 +- pyproject.toml | 2 +- 8 files changed, 113 insertions(+), 100 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 4df04ca..3c0d323 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -6,5 +6,9 @@ build: python: "3.11" sphinx: - configuration: docs/source/conf.py + configuration: docs/conf.py fail_on_warning: false + +python: + install: + - requirements: docs/requirements.txt diff --git a/LICENSE b/LICENSE index 424ccc5..00ef764 100644 --- a/LICENSE +++ b/LICENSE @@ -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 diff --git a/README.md b/README.md index 00c7d46..4380e27 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 • diff --git a/docs/conf.py b/docs/conf.py index 3e1882f..b11d22b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -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__ diff --git a/docs/index.rst b/docs/index.rst index 40d2cd9..04b614e 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -15,7 +15,7 @@ :alt: Supported Python Versions -**capella-console-client** is the Python SDK for `api.capellaspace.com `_ (search, order, download - `see API docs `_) +**capella-console-client** is the Python SDK for `api.capellaspace.com `_ (task, search, order, download - `see API docs `_) Installation ============ @@ -55,7 +55,7 @@ For more detail see :ref:`wizard` License ======= -• Licensed under the `MIT License `_ • 2023 • Capella Space • +• Licensed under the `MIT License `_ • 2024 • Capella Space • .. toctree:: :hidden: diff --git a/docs/pages/example_usage.rst b/docs/pages/example_usage.rst index 10cdad7..7b61e12 100644 --- a/docs/pages/example_usage.rst +++ b/docs/pages/example_usage.rst @@ -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 `_ (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 @@ -838,7 +756,7 @@ Create a tasking request with basic parameters create repeating tasking request -############## +################################ Create a repeating tasking request with basic parameters @@ -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: @@ -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 `_ (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() diff --git a/docs/requirements.txt b/docs/requirements.txt index 44add91..50a0f63 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -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 . diff --git a/pyproject.toml b/pyproject.toml index 07d0a42..41fc918 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 "] repository = "https://github.com/capellaspace/console-client" documentation = "https://capella-console-client.readthedocs.io/"