### Basic EarthDaily v1 Client Setup Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/docs/migration-v0-to-v1.md A complete example demonstrating the basic setup of the EarthDaily v1 client, including loading environment variables for authentication and initializing the `EDSClient`. ```python from dotenv import load_dotenv from earthdaily import EDSClient, EDSConfig load_dotenv(".env") # Load credentials client = EDSClient(EDSConfig()) ``` -------------------------------- ### Install EarthDaily Python Client Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/docs/migration-v0-to-v1.md Instructions for installing the EarthDaily Python Client using pip, including basic installation and options for platform API functionality, legacy v0 compatibility, or both. ```bash pip install earthdaily ``` ```bash pip install earthdaily[platform] ``` ```bash pip install earthdaily[legacy] ``` ```bash pip install earthdaily[platform,legacy] ``` -------------------------------- ### Run EarthDaily Python Client Example Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/examples/GALLERY_HEADER.md Execute a specific EarthDaily Python client example script from the command line. This command initiates the 'quick_start.py' example, demonstrating basic client usage. ```bash python quick_start.py ``` -------------------------------- ### Install EarthDaily Python Client Dependencies Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/examples/GALLERY_HEADER.md Install the required Python packages and optional components for the EarthDaily client using pip. The '[platform,legacy]' extras ensure all necessary functionalities, including backward compatibility, are available. ```bash pip install earthdaily[platform,legacy] ``` -------------------------------- ### Install EarthDaily Python Client Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/README.md Provides various installation options for the EarthDaily Python client, including basic, platform-specific, legacy support, and full installations to suit different use cases. ```bash pip install earthdaily ``` ```bash pip install earthdaily[platform] ``` ```bash pip install earthdaily[legacy] ``` ```bash pip install earthdaily[platform,legacy] ``` -------------------------------- ### Configure EarthDaily Client Authentication Environment Variables Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/docs/migration-v0-to-v1.md Example of a `.env` file structure required for authenticating the EarthDaily Python Client, specifying client ID, secret, authentication URL, and API URL. ```bash # .env file (required) EDS_CLIENT_ID=your_client_id EDS_SECRET=your_client_secret EDS_AUTH_URL=https://your-auth-url.com/oauth/token EDS_API_URL=https://api.earthdaily.com ``` -------------------------------- ### EarthDaily Client v0 vs v1 Architectural Differences Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/docs/migration-v0-to-v1.md A comparison table outlining the key architectural and functional differences between EarthDaily Python Client v0 (Legacy) and v1 (Current), covering main entry points, configuration, API access, STAC operations, error handling, and installation. ```APIDOC Aspect: v0 (Legacy) -> v1 (Current) Main Entry Point: Various modules -> EDSClient Configuration: Manual setup -> EDSConfig API Access: Datacube functionality -> Full platform API access STAC Operations: Read-only via STAC client -> Full CRUD operations Error Handling: Basic exceptions -> Comprehensive with EDSAPIError Installation: Single package -> Optional dependencies (platform, legacy) ``` -------------------------------- ### Set EarthDaily Client Environment Variables Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/examples/GALLERY_HEADER.md Configure necessary environment variables for authentication and API access before running EarthDaily Python client examples. These credentials and API endpoints are crucial for the client to function correctly. ```bash export EDS_CLIENT_ID="your_client_id" export EDS_SECRET="your_client_secret" export EDS_AUTH_URL="your_auth_url" export EDS_API_URL="https://api.earthdaily.com" ``` -------------------------------- ### Install Project Dependencies with Poetry Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/CONTRIBUTING.md Installs all project dependencies, including optional extras, using Poetry for dependency management. ```bash poetry install --all-extras ``` -------------------------------- ### Set Up Pre-commit Hooks Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/CONTRIBUTING.md Installs the configured pre-commit hooks to automate code quality checks before commits. ```bash pre-commit install ``` -------------------------------- ### EarthDaily Python Client v0 to v1 Breaking Changes Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/docs/migration-v0-to-v1.md Details the key breaking changes introduced in EarthDaily Python Client v1, specifically regarding client initialization, access patterns for legacy functionality, configuration requirements, and installation dependencies. ```APIDOC Initialization: - Old: EarthDataStore() - New: EDSClient(EDSConfig()) Access Pattern (for v0 functionality): - Old: eds.method() - New: client.legacy.method() Configuration: - Environment variables now required (e.g., via .env file) Installation: - Optional dependencies available: [platform], [legacy] ``` -------------------------------- ### Initialize EarthDaily Python Client Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/docs/migration-v0-to-v1.md Shows the updated method for initializing the EarthDaily client, moving from direct `EarthDataStore` instantiation in v0 to using `EDSConfig` and `EDSClient` in v1 for unified client management. ```python # Old way - direct initialization eds = EarthDataStore() ``` ```python # New way - unified client initialization config = EDSConfig() client = EDSClient(config) ``` -------------------------------- ### Create Datacubes with EarthDaily Client Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/docs/migration-v0-to-v1.md Compares the process of creating a datacube in v0 and v1, highlighting the use of `client.legacy.datacube` for v1's backward compatibility while maintaining similar functionality. ```python # Load geometry and initialize geometry = datasets.load_pivot() eds = EarthDataStore() # Create datacube in one step s2_datacube = eds.datacube( "sentinel-2-l2a", assets=["blue", "green", "red", "nir"], intersects=geometry, datetime=["2022-08-01", "2022-08-09"], mask_with="native", clear_cover=50, ) ``` ```python # Load geometry and initialize client from earthdaily.legacy.datasets import load_pivot geometry = load_pivot() client = EDSClient(EDSConfig()) # Create datacube using legacy functionality in v1 s2_datacube = client.legacy.datacube( "sentinel-2-l2a", assets=["blue", "green", "red", "nir"], intersects=geometry, datetime=["2022-08-01", "2022-08-09"], mask_with="native", clear_cover=50, ) ``` -------------------------------- ### Access Legacy Datacube Functionality in EarthDaily Client v1 Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/docs/migration-v0-to-v1.md Shows how to utilize the legacy datacube functionality, which is accessible through the `client.legacy` interface in EarthDaily Python Client v1. This example demonstrates loading a pivot geometry and querying a datacube for specific assets and datetime ranges. ```python from earthdaily.legacy.datasets import load_pivot geometry = load_pivot() datacube = client.legacy.datacube( "sentinel-2-l2a", assets=["blue", "green", "red"], intersects=geometry, datetime=["2022-08-01", "2022-08-09"], mask_with="native", ) ``` -------------------------------- ### Load Environment Variables for EarthDaily Client Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/docs/migration-v0-to-v1.md Python code snippet demonstrating how to load environment variables from a `.env` file using the `python-dotenv` library, which is required for client authentication. ```python from dotenv import load_dotenv load_dotenv(".env") # Required for authentication ``` -------------------------------- ### Upload Data and Start EarthDaily Bulk Insert Job Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/README.md Prepares a JSONL file containing STAC items, uploads it to the bulk insert job, and then initiates the job. ```python # Prepare STAC items file and upload items_file = Path("./stac_items.jsonl") # JSONL format insert_job.upload(items_file) # Start the job insert_job.start() ``` -------------------------------- ### Discover Available Collections (EarthDaily Python) Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/README.md A practical example of how to find and list all available STAC collections using the EarthDaily Python client's `pystac_client` module. ```python # Find available collections collections = client.platform.pystac_client.get_collections() print([c.id for c in collections]) ``` -------------------------------- ### Download Assets from Search Results (EarthDaily Python) Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/README.md An example demonstrating how to iterate through STAC search results and download specific assets (e.g., 'blue', 'green', 'red' bands) for each item to a local path. ```python # Download assets from search results for item in items: client.platform.stac_item.download_item_assets( item, assets=["blue", "green", "red"], path="./downloads" ) ``` -------------------------------- ### Migrate EarthDataStore v0 Code to EDSClient v1 Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/docs/migration-v0-to-v1.md Compares the initialization and search patterns between the deprecated EarthDataStore (v0) and the new EDSClient (v1) for the EarthDaily Python Client. It highlights that v0 methods are now consistently accessible via the `client.legacy` attribute in v1. ```python # v0 code eds = EarthDataStore() items = eds.search("sentinel-2-l2a", intersects=geometry) # v1 equivalent - same functionality via client.legacy client = EDSClient(EDSConfig()) items = client.legacy.search("sentinel-2-l2a", intersects=geometry) ``` -------------------------------- ### Upload Item IDs and Start EarthDaily Bulk Delete Job Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/README.md Prepares a file containing item IDs to be deleted, uploads it to the bulk delete job, and then starts the deletion process. ```python # Prepare file with item IDs to delete ids_file = Path("./items_to_delete.txt") delete_job.upload(ids_file) # Start the deletion delete_job.start() ``` -------------------------------- ### Create STAC Item Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/README.md Provides an example of creating a new STAC item using the EarthDaily client's STAC item management functionality. It shows the structure of a basic STAC item dictionary and how to pass it to the `create_item` method. ```python # Create a new STAC item stac_item = { "type": "Feature", "stac_version": "1.0.0", "id": "example-item-123", "collection": "your-collection", "geometry": {"type": "Point", "coordinates": [-67.7, -37.8]}, "properties": {"datetime": "2024-01-01T00:00:00Z"}, "links": [], "assets": {} } client.platform.stac_item.create_item("your-collection", stac_item) ``` -------------------------------- ### Update EarthDaily Python Client Imports Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/docs/migration-v0-to-v1.md Demonstrates the change in import statements from the v0 client to the new v1 client, including `EDSClient`, `EDSConfig`, and `EDSAPIError` for enhanced error handling. ```python # Old v0 imports import earthdaily from earthdaily import EarthDataStore, datasets ``` ```python # New v1 imports from earthdaily import EDSClient, EDSConfig from earthdaily.exceptions import EDSAPIError ``` -------------------------------- ### Search for STAC Items with EarthDaily Client Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/docs/migration-v0-to-v1.md Illustrates the different approaches to searching for STAC items in v0, v1 (using the new Platform API), and v1 (using legacy functionality for backward compatibility). ```python items = eds.search( "sentinel-2-l2a", intersects=geometry, datetime=["2022-08-01", "2022-08-09"], ) ``` ```python search_result = client.platform.pystac_client.search( collections=["sentinel-2-l2a"], datetime="2022-08-01T00:00:00Z/2022-08-09T00:00:00Z", max_items=50, ) items = list(search_result.items()) ``` ```python items = client.legacy.search( "sentinel-2-l2a", intersects=geometry, datetime=["2022-08-01", "2022-08-09"], ) ``` -------------------------------- ### Initialize DataTables for Computation Times Table Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/docs/sg_execution_times.rst This JavaScript snippet initializes the DataTables library on an HTML table identified by the class 'sg-datatable'. It configures the table to be sortable, with a default descending order applied to the second column (Time), thereby enhancing the user experience for viewing computation times. ```JavaScript $(document).ready( function () { $('table.sg-datatable').DataTable({order: [[1, 'desc']]}); } ); ``` -------------------------------- ### Create a STAC Item using EarthDaily Python Client Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/docs/migration-v0-to-v1.md Demonstrates how to construct a STAC item dictionary with essential metadata and then use the client's platform API to create this item within a specified collection. This involves defining the item's type, version, ID, collection, geometry, properties, links, and assets. ```python stac_item = { "type": "Feature", "stac_version": "1.0.0", "id": "example-item-123", "collection": "eda-labels-vessels", "geometry": {"type": "Point", "coordinates": [-67.7, -37.8]}, "properties": {"datetime": "2017-12-08T14:38:16.000000Z"}, "links": [], "assets": {}, } client.platform.stac_item.create_item("eda-labels-vessels", stac_item) ``` -------------------------------- ### Search STAC Items with EarthDaily Platform API Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/docs/migration-v0-to-v1.md Illustrates how to perform a search for STAC items using the client's platform pystac_client interface. It shows how to filter results by specifying collections, a datetime range, and limiting the maximum number of items returned. ```python search_result = client.platform.pystac_client.search( collections=["sentinel-2-l2a"], datetime="2024-06-01T00:00:00Z/2024-08-01T00:00:00Z", max_items=10, ) items = list(search_result.items()) ``` -------------------------------- ### Search Satellite Data with STAC Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/README.md Illustrates how to search for satellite data, specifically Sentinel-2 L2A imagery, using the STAC client within the EarthDaily platform API. The example specifies collections, a datetime range, and a maximum number of items to retrieve. ```python # Search for Sentinel-2 data search_result = client.platform.pystac_client.search( collections=["sentinel-2-l2a"], datetime="2024-06-01T00:00:00Z/2024-08-01T00:00:00Z", max_items=10 ) items = list(search_result.items()) ``` -------------------------------- ### Initialize EarthDaily Client Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/README.md Demonstrates how to initialize the EarthDaily client using `EDSConfig`. This can be done by loading credentials from a '.env' file using `dotenv` or by providing the client ID, secret, and API URLs directly to the `EDSConfig` constructor. ```python from dotenv import load_dotenv from earthdaily import EDSClient, EDSConfig # Load environment variables load_dotenv(".env") # Initialize client config = EDSConfig() client = EDSClient(config) ``` ```python # Direct configuration (without .env file) config = EDSConfig( client_id="your_client_id", client_secret="your_client_secret", token_url="https://your-auth-url.com/oauth/token", api_url="https://api.earthdaily.com" ) client = EDSClient(config) ``` -------------------------------- ### Build Python Package Distributions Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/CONTRIBUTING.md Builds the wheel and source distributions of the Python package, placing them in the `dist/` directory. ```bash poetry build ``` -------------------------------- ### Create Analysis-Ready Datacube (EarthDaily Legacy) Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/README.md Demonstrates how to create an analysis-ready datacube using the legacy interface. It specifies collections, assets, geometry, datetime, and applies cloud masking and clear pixel filtering, with an option to aggregate by date. ```python from earthdaily.legacy.datasets import load_pivot # Load sample geometry geometry = load_pivot() # Create analysis-ready datacube datacube = client.legacy.datacube( collections="sentinel-2-l2a", assets=["blue", "green", "red", "nir"], intersects=geometry, datetime=["2022-08-01", "2022-08-09"], mask_with="native", # Apply cloud masking clear_cover=50, # Minimum 50% clear pixels groupby_date="mean" # Aggregate by date ) ``` -------------------------------- ### EarthDaily Client Architecture Overview Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/README.md Outlines the main modules and their functionalities within the EarthDaily Python client. It distinguishes between the modern `client.platform` for new API access and `client.legacy` for backward compatibility with v0 features. ```APIDOC client.platform: Modern platform API access pystac_client: STAC catalog search stac_item: STAC item CRUD operations bulk_search: Bulk search operations bulk_insert: Bulk data insertion bulk_delete: Bulk data deletion client.legacy: v0 compatibility layer datacube(): Create analysis-ready datacubes search(): Legacy search functionality Access to existing v0 methods ``` -------------------------------- ### Run All Project Tests Locally with Tox Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/CONTRIBUTING.md Executes all configured tests across multiple Python environments using Tox via Poetry. ```bash poetry run tox ``` -------------------------------- ### Clone EarthDaily Python Client Repository Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/CONTRIBUTING.md Clones the EarthDaily Python Client repository from GitHub and navigates into the project directory. ```bash git clone git@github.com:earthdaily/earthdaily-python-client.git cd earthdaily-python-client ``` -------------------------------- ### Configure EarthDaily Client Environment Variables Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/README.md Shows how to set up environment variables for EarthDaily client credentials and API URLs by creating a '.env' file in your project root. These variables are crucial for authentication and connecting to the EarthDaily platform. ```bash # .env EDS_CLIENT_ID=your_client_id EDS_SECRET=your_client_secret EDS_AUTH_URL=https://your-auth-url.com/oauth/token EDS_API_URL=https://api.earthdaily.com ``` -------------------------------- ### Access Legacy Datacube Functionality Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/README.md Demonstrates how to use the legacy v0 datacube functionality through the EarthDaily client. It shows loading a pivot geometry and creating an analysis-ready datacube with specified assets, intersection geometry, and datetime range. ```python from earthdaily.legacy.datasets import load_pivot # Load geometry and create datacube geometry = load_pivot() datacube = client.legacy.datacube( "sentinel-2-l2a", assets=["blue", "green", "red", "nir"], intersects=geometry, datetime=["2022-08-01", "2022-08-09"], mask_with="native" ) ``` -------------------------------- ### Create Multi-Collection Datacube (EarthDaily Legacy) Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/README.md Illustrates creating a datacube from multiple STAC collections, specifying common assets, intersecting geometry, and datetime. It also includes an option for cross-calibration between collections. ```python # Create datacube from multiple collections datacube = client.legacy.datacube( collections=["sentinel-2-l2a", "landsat-c2l2-sr"], assets=["red", "green", "blue"], intersects=geometry, datetime="2022-08", cross_calibration_collection="landsat-c2l2-sr" ) ``` -------------------------------- ### Jinja2 Template for Python Class API Documentation Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/docs/templates/class.rst This template defines the structure for automatically generating API documentation for a Python class using Sphinx. It includes directives to display class details, inherited members, special methods, and dynamically lists public methods and attributes using `autosummary`. ```APIDOC {{ fullname | escape | underline}} .. currentmodule:: {{ module }} .. autoclass:: {{ objname }} :members: :show-inheritance: :inherited-members: :special-members: __call__, __add__, __mul__ {% block methods %} {% if methods %} .. rubric:: {{ _('Methods') }} .. autosummary:: :nosignatures: {% for item in methods %} {%- if not item.startswith('_') %} ~{{ name }}.{{ item }} {%- endif -%} {%- endfor %} {% endif %} {% endblock %} {% block attributes %} {% if attributes %} .. rubric:: {{ _('Attributes') }} .. autosummary:: {% for item in attributes %} ~{{ name }}.{{ item }} {%- endfor %} {% endif %} {% endblock %} ``` -------------------------------- ### Push Local Branch to Origin Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/CONTRIBUTING.md Pushes the current feature branch to the remote origin repository. ```bash git push origin feature/your-feature-name ``` -------------------------------- ### Run Specific Tox Test Environments Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/CONTRIBUTING.md Executes specific test environments like linting, formatting checks, or type checking using Tox. ```bash poetry run tox -e lint # Run linting poetry run tox -e format # Check formatting poetry run tox -e mypy # Run type checking ``` -------------------------------- ### Create Bulk STAC Item Insert Job (EarthDaily Python) Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/README.md Sets up a bulk insert job for STAC items, defining error handling ('CONTINUE' or 'STOP') and conflict resolution modes ('SKIP' or 'OVERRIDE'). ```python # Create bulk insert job insert_job = client.platform.bulk_insert.create( collection_id="your-collection", error_handling_mode="CONTINUE", # or "STOP" conflict_resolution_mode="SKIP" # or "OVERRIDE" ) ``` -------------------------------- ### Jinja2 Template for Project Version Display Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/docs/templates/versions.html This Jinja2 template snippet is responsible for rendering a list of available project versions. It checks for a `current_version` and then iterates through `versions.tags` and `versions.branches` to create hyperlinked lists. This is typically used in documentation portals or release pages to navigate between different software versions. ```Jinja2 {%- if current_version %}\n\nOther Versions v: {{ current_version.name }}\n\n{%- if versions.tags %}\n\nTags\n\n{%- for item in versions.tags %}\n\n[{{ item.name }}]({{ item.url }})\n\n{%- endfor %}\n\n{%- endif %} {%- if versions.branches %}\n\nBranches\n\n{%- for item in versions.branches %}\n\n[{{ item.name }}]({{ item.url }})\n\n{%- endfor %}\n\n{%- endif %}\n\n{%- endif %} ``` -------------------------------- ### Download STAC Item Assets with EarthDaily Python Client Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/README.md Shows how to download specific assets (e.g., 'blue', 'green', 'red' bands) from a STAC item to a local directory, with an option to limit concurrent downloads. ```python # Download item assets downloads = client.platform.stac_item.download_assets( item=item, asset_keys=["blue", "green", "red"], output_dir="./downloads", max_workers=3 ) ``` -------------------------------- ### Jinja2 Template for Sphinx Automodule Documentation Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/docs/templates/custom.rst This template defines the layout for Sphinx documentation pages, utilizing Jinja2 control flow (if, for blocks) to conditionally include `automodule`, `autosummary`, and `rubric` directives. It's intended to be used by Sphinx's autodoc extension to generate API reference documentation for Python projects, dynamically populating sections for functions, classes, and exceptions based on the module's contents. ```Jinja2 Project: /earthdaily/earthdaily-python-client Content: {{ objname }} {{ underline }} .. automodule:: {{ fullname }} {% block functions %} {% if functions %} .. rubric:: Functions prout .. autosummary:: :toctree: {{ objname }} :template: function.rst {% for item in functions %} {{ item }} {%- endfor %} {% endif %} {% endblock %} {% block classes %} {% if classes %} .. rubric:: Classes .. autosummary:: :toctree: {{ objname }} :template: class.rst {% for item in classes %} {{ item }} {%- endfor %} {% endif %} {% endblock %} {% block exceptions %} {% if exceptions %} .. rubric:: Exceptions .. autosummary:: {% for item in exceptions %} {{ item }} {%- endfor %} {% endif %} {% endblock %} ``` -------------------------------- ### Run Tests for Specific Python Versions Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/CONTRIBUTING.md Executes project tests using Tox for a particular Python version, such as 3.10, 3.11, or 3.12. ```bash poetry run tox -e py310 # for Python 3.10 poetry run tox -e py311 # for Python 3.11 poetry run tox -e py312 # for Python 3.12 ``` -------------------------------- ### Handle API Errors (EarthDaily Python Client) Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/README.md Shows how to implement basic error handling for API calls using a try-except block to catch `EDSAPIError` specifically, providing a robust way to manage potential issues. ```python from earthdaily.exceptions import EDSAPIError try: search_result = client.platform.pystac_client.search( collections=["invalid-collection"] ) except EDSAPIError as e: print(f"API Error: {e}") ``` -------------------------------- ### Create STAC Item via Platform API Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/README.md Shows how to create a STAC item using the `create_item` method of `client.platform.stac_item`. This method allows specifying the collection ID, the item's data, and the desired return format (dictionary, JSON, or pystac object). ```python # Create a new STAC item item = client.platform.stac_item.create_item( collection_id="your-collection", item_data={ "type": "Feature", "stac_version": "1.0.0", "id": "item-123", "geometry": {"type": "Point", "coordinates": [-67.7, -37.8]}, "properties": {"datetime": "2024-01-01T00:00:00Z"} }, return_format="dict" # "dict", "json", or "pystac" ) ``` -------------------------------- ### Create Bulk STAC Search Job (EarthDaily Python) Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/README.md Initiates a bulk search job for STAC items across specified collections, datetime ranges, and bounding boxes. It also allows setting a limit on results and an export format, then prints the job ID. ```python # Create a bulk search job search_job = client.platform.bulk_search.create( collections=["sentinel-2-l2a"], datetime="2024-01-01T00:00:00Z/2024-02-01T00:00:00Z", bbox=[-74.2, 40.6, -73.9, 40.9], # NYC area limit=1000, export_format="json" ) print(f"Job ID: {search_job.job_id}") ``` -------------------------------- ### Create New Feature or Bugfix Branch Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/CONTRIBUTING.md Creates and switches to a new Git branch for developing a feature or bugfix. ```bash git checkout -b feature/your-feature-name ``` -------------------------------- ### Jinja2 Template for Sphinx Python Class API Doc Generation Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/docs/templates/custom-class-template.rst This template provides the core structure for generating API documentation for Python classes in Sphinx. It uses Jinja2 logic to conditionally include sections for methods and attributes, applying Sphinx directives like `autoclass` for overall class documentation and `autosummary` for concise listings of methods and attributes, filtering out private members. ```Jinja2 {{ fullname | escape | underline}} .. currentmodule:: {{ module }} .. autoclass:: {{ objname }} :members: :show-inheritance: :inherited-members: :special-members: __call__, __add__, __mul__ {% block methods %} {% if methods %} .. rubric:: {{ _('Methods') }} .. autosummary:: :nosignatures: {% for item in methods %} {%- if not item.startswith('_') %} ~{{ name }}.{{ item }} {%- endif -%} {%- endfor %} {% endif %} {% endblock %} {% block attributes %} {% if attributes %} .. rubric:: {{ _('Attributes') }} .. autosummary:: {% for item in attributes %} ~{{ name }}.{{ item }} {%- endfor %} {% endif %} {% endblock %} ``` -------------------------------- ### Commit Code Changes to Git Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/CONTRIBUTING.md Stages all modified files and commits them to the current Git branch with a specified message. ```bash git add . git commit -m "your commit message" ``` -------------------------------- ### List Available STAC Collections (EarthDaily Python) Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/README.md Retrieves and prints the IDs of all available STAC collections from the EarthDaily platform. ```python # List available collections collections = client.platform.pystac_client.get_collections() for collection in collections: print(f"Collection: {collection.id}") ``` -------------------------------- ### Create Bulk STAC Item Delete Job (EarthDaily Python) Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/README.md Initializes a bulk delete job for items within a specified collection. ```python # Create bulk delete job delete_job = client.platform.bulk_delete.create( collection_id="your-collection" ) ``` -------------------------------- ### Monitor EarthDaily Bulk Insert Job Progress Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/README.md Fetches and displays the current progress of a bulk insert job, including the count of items successfully written and the count of items with errors. ```python # Check insert job status job_status = client.platform.bulk_insert.fetch(insert_job.job_id) print(f"Items written: {job_status.items_written_count}") print(f"Errors: {job_status.items_error_count}") ``` -------------------------------- ### Perform Standard STAC Search with EarthDaily Python Client Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/README.md Executes a standard STAC API search for items based on collections, datetime, bounding box, and maximum item limits. It then processes and prints the number of found items. ```python # Search for items using STAC API search_results = client.platform.pystac_client.search( collections=["sentinel-2-l2a"], datetime="2024-01-01T00:00:00Z/2024-02-01T00:00:00Z", bbox=[-74.2, 40.6, -73.9, 40.9], max_items=50 ) # Process results items = list(search_results.items()) print(f"Found {len(items)} items") ``` -------------------------------- ### Download EarthDaily Bulk Search Results Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/README.md Downloads the results of a completed bulk search job to a specified local directory. This operation is conditional on the job status being 'COMPLETED'. ```python # Download search results when completed if job_status.status == "COMPLETED": job_status.download_assets(save_location=Path("./bulk_results")) ``` -------------------------------- ### Monitor EarthDaily Bulk Delete Job Progress Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/README.md Fetches and displays the current progress of a bulk delete job, including the count of items successfully deleted and the count of items with errors. ```python # Check delete job status job_status = client.platform.bulk_delete.fetch(delete_job.job_id) print(f"Items deleted: {job_status.items_deleted_count}") print(f"Errors: {job_status.items_error_count}") ``` -------------------------------- ### Read STAC Item via Platform API Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/README.md Demonstrates how to retrieve a specific STAC item using the `get_item` method of `client.platform.stac_item`. You need to provide the collection ID, the item ID, and can specify the desired return format for the item. ```python # Get a specific item item = client.platform.stac_item.get_item( collection_id="your-collection", item_id="item-123", return_format="pystac" ) ``` -------------------------------- ### Monitor EarthDaily Bulk Search Job Status Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/README.md Fetches and displays the current status and asset count of a previously created bulk search job using its job ID. ```python # Check job status job_status = client.platform.bulk_search.fetch(search_job.job_id) print(f"Status: {job_status.status}") print(f"Assets: {len(job_status.assets)}") ``` -------------------------------- ### Search STAC Items (EarthDaily Legacy Interface) Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/README.md Performs a STAC item search using the legacy client interface, filtering by collections, intersecting geometry, datetime range, and a maximum limit. ```python # Search for items (legacy interface) items = client.legacy.search( collections="sentinel-2-l2a", intersects=geometry, datetime=["2022-08-01", "2022-08-09"], limit=100 ) print(f"Found {len(items)} items") ``` -------------------------------- ### Update STAC Item via Platform API Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/README.md Illustrates how to update an existing STAC item using the `update_item` method of `client.platform.stac_item`. This method requires the collection ID, item ID, and a dictionary containing the data to be updated within the item's properties. ```python # Update an existing item updated_item = client.platform.stac_item.update_item( collection_id="your-collection", item_id="item-123", item_data={"properties": {"updated": "2024-01-02T00:00:00Z"}}, return_format="dict" ) ``` -------------------------------- ### Delete STAC Item using EarthDaily Python Client Source: https://github.com/earthdaily/earthdaily-python-client/blob/main/README.md Demonstrates how to delete a specific STAC item from a collection using its collection ID and item ID. ```python client.platform.stac_item.delete_item( collection_id="your-collection", item_id="item-123" ) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.