Skip to main content

Salient Predictions Software Development Kit

Project description

Intended Use

The Salient SDK is a python convenience wrapper around Salient Predictions' customer-facing
web API. It also contains utility functions for manipulating and analyzing the data delivered from the API.

Setting up the SDK

Prerequisites

The Salient SDK requires Python 3.11 to use. If you have Python installed, you can check your version with:

python3 --version

To get version 3.11:

# Ubuntu:
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.11
# macOS:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew update
brew install python@3.11

Installing the SDK

The easiest way to get the Salient SDK is to install it like any other package:

pip install salientsdk --upgrade
# to verify version with
pip show salientsdk

Usage

Command Line

The Salient SDK contains a full command line interface that can access each of the primary API functions without even opening python. You can get help for all options or specific commands:

python3 -m salientsdk --help
python3 -m salientsdk forecast_timeseries --help

To verify that you are set up to execute the sdk, ask for its version number:

python3 -m salientsdk version

To verify that you can access Salient's API, use the limited universal credentials testusr and testpwd to log in:

python3 -m salientsdk login -u testusr -p testpwd

To verify that you can download data from Salient, try the testusr/testpwd credentials to download historical data with the data_timeseries function. This will download a NetCDF file to your current directory and display its contents.

python3 -m salientsdk data_timeseries -lat 42 -lon -73 -fld all --start 2020-01-01 --end 2020-12-31 -u testusr -p testpwd

To test that your specific Salient-issued credentials are functioning properly, try them with the forecast_timeseries function. Replace username and password in the example below with your credentials. Note that you may need to change the location (North America) and timescale (seasonal) if your license does not include them.

python3 -m salientsdk forecast_timeseries -lat 42 -lon -73 --variable precip --timescale seasonal --date 2020-01-01 -u username -p password

Via Python

In a python 3.11 script, this example code will login and request a historical ERA5 data timeseries.

import salientsdk as sk
import xarray as xr
import netcdf4

session = sk.login("testusr","testpwd")
history = sk.data_timeseries(loc = Location(lat=42, lon=-73), field="all", variable="temp", session=session)
print(xr.open_file(history))

Note that this example uses the limited credentials testusr and testpwd. To access the full capabilities of your license, use your Salient-provided credentials.

See all available functions in the API Reference.

The examples directory contains ipynb notebooks to help you get started with common operations.

License

This SDK is licensed for use by Salient customers details.

Copyright 2024 Salient Predictions

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

salientsdk-0.1.5.tar.gz (20.4 kB view details)

Uploaded Source

Built Distribution

salientsdk-0.1.5-py3-none-any.whl (26.2 kB view details)

Uploaded Python 3

File details

Details for the file salientsdk-0.1.5.tar.gz.

File metadata

  • Download URL: salientsdk-0.1.5.tar.gz
  • Upload date:
  • Size: 20.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.11.9 Linux/6.5.0-1018-azure

File hashes

Hashes for salientsdk-0.1.5.tar.gz
Algorithm Hash digest
SHA256 166e1cf20f031511d84f7c3d14fc89bd426b30bc13c1c474fc500efe28c68cdd
MD5 fa85d928b6dbd0321c0511f8d7d9fb40
BLAKE2b-256 c5f89fcbf3e39c919144c525f0c4c6bfa71e5a92a2c2b6cf70b0138e93794b84

See more details on using hashes here.

File details

Details for the file salientsdk-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: salientsdk-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 26.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.11.9 Linux/6.5.0-1018-azure

File hashes

Hashes for salientsdk-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5ba3a3fef51f7e319c1edb0e34b382c4ad1e05ac40ecaef15feadec3d4b84da5
MD5 ccce526065f373033a7b529fa90a8361
BLAKE2b-256 105c58cd18d50d9306521d8f70876e0a8525d1a0fe450928612e8ebe5c02c3e7

See more details on using hashes here.

Supported by

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