Skip to main content

AppEEARS API Client

Python client for interacting with NASA Earthdata's AρρEEARS API. This package facilitates authentication, querying, and handling of data from AppEEARS, allowing Python users to efficiently access and manipulate remote sensing data.

Features

  • Easy Authentication: Seamlessly authenticate using NASA Earthdata Login.
  • Data Retrieval: Functions to query and manipulate available product data.
  • Error Handling: Integrated API-specific error handling to manage and respond to API issues effectively.

Installation

Install the package using pip:

pip install appears-api-client

Usage

Initial configuration

Import the client and create an instance with your credentials:

from appears_api.client import APIClient

client = APIClient(username='your_username', password='your_password')

Authentication

Log in to authenticate and begin your session:

client.login()

Obtain product data

Retrieve information about a specific product by its ID:

product_info = client.get_product_info(product_id='MOD11A1.061')
print(product_info)

Retrieve All Products and Layers

Get details on all available products and their respective layers:

all_products = client.product_manager.get_all_products_and_layers()
print(all_products)

Fetch and Store Point Data

Submit a task for specific coordinates, bands, and time period, and retrieve the processed data:

response = client.submit_and_retrieve_point_task(
    latitude=34.05, 
    longitude=-118.25, 
    product_id='MOD11A1.061', 
    band_names=['LST_Day_1km', 'LST_Night_1km'], 
    start_date='2023-01-01', 
    end_date='2023-01-31'
)
print(response)

Sending Area-Based Tasks

The API client also supports submitting tasks based on a specific geographical area. This is particularly useful for processing large datasets that cover geographical regions. Below is an example of how to submit an area-based task using the API client:

Example: Retrieve Temperature Data for a Defined Area

This example demonstrates how to submit a task to retrieve daytime and nighttime land surface temperature data for a specific area defined by GeoJSON coordinates.

import os
from datetime import datetime
from src.appears import APIClient

# Load environment variables (ensure your .env file contains the necessary API credentials)
from dotenv import load_dotenv
load_dotenv()

# Create an instance of the API client with your credentials
client = APIClient(username=os.getenv('APPEARS_USER'), password=os.getenv('APPEARS_PASS'))

# Define the geographical area of interest in GeoJSON format
geo_json = {
    "type": "FeatureCollection",
    "features": [
        {
            "type": "Feature",
            "properties": {},
            "geometry": {
                "type": "Polygon",
                "coordinates": [
                    [
                        [-78.54051709643014, 18.699926638788938],
                        [-78.54051709643014, 17.571631940899735],
                        [-75.89563723926521, 17.571631940899735],
                        [-75.89563723926521, 18.699926638788938],
                        [-78.54051709643014, 18.699926638788938]
                    ]
                ]
            }
        }
    ]
}

# Define the time period for the data
start_date = datetime.strptime("01-01-2023", "%m-%d-%Y")
end_date = datetime.strptime("01-31-2023", "%m-%d-%Y")

# Define the product and layers to retrieve
layers = [
    {"product": "MOD11A1.061", "layer": "LST_Day_1km"},
    {"product": "MOD11A1.061", "layer": "LST_Night_1km"}
]

# Submit the area-based task and get the response
response = client.submit_and_retrieve_area_task(
    geo_json=geo_json,
    product_id="MOD11A1.061",
    band_names=["LST_Day_1km", "LST_Night_1km"],
    start_date=start_date,
    end_date=end_date
)

# Handle the response
if 'task_id' in response:
    print("Area task submitted successfully. Task ID:", response['task_id'])
else:
    print("Error submitting area task:", response)

Logout

Don't forget to log out when you are finished:

client.logout()

Contributions

Contributions are welcome! If you wish to contribute, please:

  • Fork the repository.
  • Create a new branch for your modifications.
  • Make your changes and write tests when possible.
  • Send a pull request with a clear description of the changes.

License

Distributed under the MIT license. See LICENSE for more information.

Contact

Francisco Furey

GMAIL LinkedIn

Follow the project and contribute on GitHub.

Metadata

Release files for appears-api-client 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for appears-api-client 0.1.2
File Size Uploaded
appears_api_client-0.1.2.tar.gz 44.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for appears-api-client 0.1.2
File Interpreter ABI Platform
appears_api_client-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 98.5 kB

Release files / appears_api_client-0.1.2.tar.gz

Download URL appears_api_client-0.1.2.tar.gz
Size 44.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6a74a583bb2ca866855e6d05255f2094d7c0a686885c529ac37ad1e0c723c6a0
BLAKE2b-256 checksum
How to use checksums
0f03d62d132fca4638d6fc8d1eee01ad15363e69e9ed421797e71a8d7f3d36ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.3

Release files / appears_api_client-0.1.2-py3-none-any.whl

Download URL appears_api_client-0.1.2-py3-none-any.whl
Size 53.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3e7bfbbd625138a955503ce764982b40dce5c2e35f2b9c2e60e1a3a23171f7e0
BLAKE2b-256 checksum
How to use checksums
10178650a94728814476b1fdc4074ecad17fc122700a98028e94b5b497a3f584
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page