Skip to main content

SQL Database software for SnowEx data

Project description

Documentation Status Testing Status Code Coverage https://codecov.io/gh/SnowEx/snowexsql/graph/badge.svg?token=B27OKGBOTR DOI

About

NASA SnowEx was a multi-year airborne and field campaign aimed at understanding the seasonal snowpack across the western United States and Alaska. Each campaign combined airborne remote sensing (lidar, radar, hyperspectral imagery) with intensive ground truth measurements across a variety of different snow climates. The goal was to improve snow water equivalent (SWE) retrieval algorithms for future spaceborne missions.

The SnowEx database consolidates measurements from all campaigns into a single queryable PostgreSQL/PostGIS database. It holds point measurements (snow depths, Federal Sampler SWE) and snow pit information (density, temperature, stratigraphy from snow pits). This software is a client for accessing the database using Python.

Installing

Install using pip:

pip install snowexsql

Full Tutorial

For a complete walkthrough of accessing and querying the SnowEx database, including spatial queries, filtering by campaign or instrument, and working with the returned data, see the Project Pythia Snow Observations Cookbook:

Accessing the Database

There are two ways to access the SnowEx database:

Public access via Lambda client (no credentials required)

The recommended approach for most users. The SnowExLambdaClient connects to a public AWS Lambda Function URL that proxies queries to the database. No AWS account or database credentials are needed.

from snowexsql.lambda_client import SnowExLambdaClient

client = SnowExLambdaClient()
classes = client.get_measurement_classes()
PointMeasurements = classes['PointMeasurements']

df = PointMeasurements.from_filter(type='depth', limit=100)
Direct database access (credentials required)

For users with database credentials, the snowexsql.api classes can be used directly without going through Lambda. This path also supports raster queries.

from snowexsql.api import PointMeasurements, LayerMeasurements

df = LayerMeasurements.from_filter(type='density', limit=100)

Configuring the database connection

For users wishing to have direct access to the database, there are two options for setting up the credentials:

  • Set database connection URL via SNOWEX_DB_CONNECTION environment variable Example:

export SNOWEX_DB_CONNECTION="user:password@127.0.0.1/db_name"
  • Point to a credentials JSON file via SNOWEX_DB_CREDENTIALS environment variable Example

export SNOWEX_DB_CREDENTIALS="/path/to/credentials.json"

Sample JSON file:

{
  "address": "localhost",
  "db_name": "snowexdb",
  "username": "user",
  "password": "password"
}

Getting help

Jump over to our discussion forum and get help from our community.

Documentation

Our read the docs pages include documentation of the API structure and provides a detailed description of the database schema.

I want to contribute

Thank you for the interest!

Our community follows the Contributor Covenant

Have a look at our contribution guide and see the many ways to get involved!

Testing

To run the test suite locally requires having a running instance of PostgreSQL. The test suite is configured to run against these credentials:

builder:db_builder@localhost/test

This requires a running database on localhost where the user builder has access to the test database with the password db_builder.

It is possible to set a custom host and database via the SNOWEX_TEST_DB environment variable. Example that would connect to a server on my.host and the database snowex_test:

export SNOWEX_TEST_DB="my_host/snowex_test"

More on connection strings to PostgreSQL can be found with the official documentation.

DOI

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

snowexsql-1.1.1.tar.gz (3.7 MB view details)

Uploaded Source

Built Distribution

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

snowexsql-1.1.1-py3-none-any.whl (49.8 kB view details)

Uploaded Python 3

File details

Details for the file snowexsql-1.1.1.tar.gz.

File metadata

  • Download URL: snowexsql-1.1.1.tar.gz
  • Upload date:
  • Size: 3.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for snowexsql-1.1.1.tar.gz
Algorithm Hash digest
SHA256 12f7c2f4d73bf6b0487152bf04f0d308db9d4e369c01c6b778534dcf73fde511
MD5 e26b5ec104fe559e908d126f33c815fa
BLAKE2b-256 5b8461613402fe43537e67c828a800ecaf61ebc8004a1ad2c4d80ee270693517

See more details on using hashes here.

Provenance

The following attestation bundles were made for snowexsql-1.1.1.tar.gz:

Publisher: cd.yml on SnowEx/snowexsql

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file snowexsql-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: snowexsql-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 49.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for snowexsql-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3a1439fa3572934b9a71459a399c7c24760c051e971c5864e7d55f0710c2a563
MD5 2364455dacc65444a26091501cb7932e
BLAKE2b-256 00e6aae9f00890c482eec5f516b1ac8ea7d21cfcb6f84177e2192eaa64322312

See more details on using hashes here.

Provenance

The following attestation bundles were made for snowexsql-1.1.1-py3-none-any.whl:

Publisher: cd.yml on SnowEx/snowexsql

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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