Skip to main content

Namespace package for api_24sea.ai, as indicated by PEP 420.

Project description

api-24sea-ai

api-24sea-ai is an extension package for API-24SEA that provides tools to interact with the AI models hosted on the 24SEA platform.

Installation

The package supports Python [3.8:3.12). To install it, run the following command in your terminal:

pip install api-24sea-ai

Importing the package

# %%
# **Package Imports**
# - From the Python Standard Library
import logging
import os
import sys

# - From third party libraries
import pandas as pd
import dotenv  # <-- Not necessary to api-24sea-ai per se, but useful for
               #     loading environment variables. Install it with
               #     `pip install python-dotenv`

# - Local imports
from api_24sea.ai.version import __version__, parse_version
# %%
# **Package Versions**
print("Working Folder: ", os.getcwd())
print(f"Python Version: {sys.version}")
print(f"Pandas Version: {pd.__version__}")
print(f"Package {parse_version(__version__)}")
# **Notebook Configuration**
logging.basicConfig(level=logging.INFO)

Setting up the environment variables (optional)

This step assumes that you have a file structure similar to the following one:

.
├── env
│   └── .env
├── notebooks
│   └── example.ipynb
└── requirements.txt

The [.env]{.title-ref} file should look like this:

API_24SEA_USERNAME=your_value
API_24SEA_PASSWORD=your_value

With this in mind, the following code snippet shows how to load the environment variables from the [.env]{.title-ref} file:

# %%
# **Load Environment Variables from .env File**
_ = dotenv.load_dotenv("../env/.env")
if _:
    print("Environment Variables Loaded Successfully")
    print(os.getenv("API_24SEA_USERNAME"))
    print(os.getenv("API_24SEA_PASSWORD"))
else:
    raise Exception("Environment Variables Not Loaded")
    print("Environment Variables Loaded Successfully")
    print(os.getenv("API_24SEA_USERNAME"))
    # print(os.getenv("API_24SEA_PASSWORD"))  # <-- Avoid printing sensitive info
else:
    raise Exception("Environment Variables Not Loaded")

###Performing AI model predictions

# %%
# **Authenticating AI Client and Viewing Models Overview**
from api_24sea.ai.core import AsyncAPI
api = AsyncAPI()
api.authenticate()  # <-- Ensure that the environment variables are set
api.models_overview  # <-- View the models overview
# %%
# **Making Predictions**
api.get_predictions(
    sites="WF",
    locations="A01",
    model="mean_WF_A01_some_ai_model",
    start_timestamp="2020-03-01",
    end_timestamp="2020-06-01",
).head()

Project Structure

    .
    ├── .azure/
    ├── .github/
    ├── docs/
    ├── api-24sea/
       └── ai/
           ├── __init__.py
           ├── core.py
           ├── schemas.py
           ├── utils.py
           └── version.py
    ├── notebooks/
    ├── tasks/
    ├── tests/
    ├── .flake8
    ├── .gitignore
    ├── .pre-commit-config.yaml
    ├── .pylintrc
    ├── .bitbucket-pipelines.yml
    ├── bumpversion.py
    ├── invoke.yaml
    ├── pyproject.toml
    ├── README.md
    ├── VERSION
    └── LICENSE

License

The package is licensed under the GNU General Public License v3.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

api_24sea_ai-0.2.1.tar.gz (30.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

api_24sea_ai-0.2.1-py3-none-any.whl (28.7 kB view details)

Uploaded Python 3

File details

Details for the file api_24sea_ai-0.2.1.tar.gz.

File metadata

  • Download URL: api_24sea_ai-0.2.1.tar.gz
  • Upload date:
  • Size: 30.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for api_24sea_ai-0.2.1.tar.gz
Algorithm Hash digest
SHA256 c1a52436a9965bdd33a5284c5e8b392ed8019b52c84406f01ae6d4c0f4d82da1
MD5 381245ac185e072afa4de8e3db9ad9a2
BLAKE2b-256 c2f5e00dfbb398696f2a4009594837ec61e7a7fbfe9f8635ba9d0ccf08a63597

See more details on using hashes here.

File details

Details for the file api_24sea_ai-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: api_24sea_ai-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 28.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for api_24sea_ai-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 470648ccfdd66f862a0b531f3462e455872fdc4267444ef7a9289ef2619a4a8d
MD5 5e71541e4690d62f46dedb80b188b803
BLAKE2b-256 1f7cc05a1d165a1c043308ccbbdfbb995d11d3b00f6c2b3412e76bb3b18e7c92

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page