Skip to main content

Common Python methods for OGIA

Project description

OGIA Python Libraries

Some commonly used python libraries.


Installation

Use the url of this repository for directly installing via pip

pip install git+https://github.com/Office-of-Groundwater-Impact-Assessment/ogialibs

Installing a specific version of OgiaLibs

Please make note of the commit hash or branch name you would like to install.

Replace the BRANCH_NAME below. Branch or commit string should come after the "@" sign.

pip install git+https://github.com/Office-of-Groundwater-Impact-Assessment/ogialibs@BRANCH_NAME

Usage

cached_parquet

Creates a Parquet cache in local data directory after the first generation of an output. Decorated function must have a single DataFrame (or GeoDataFrame. See below for example) return value. Below example will create a tmp_XXXXX.parquet file under the data folder of your project.

from ogialibs.data import cached_parquet

@cached_parquet
def get_df():
    ...
    return df

Custom prefixes can be set at the decorator or during the function call;

@cached_parquet(tmp_prefix='foo')
def get_foo_df():
    ...
    return df

# Creates a foo_XXXXX.parquet file instead

@cached_parquet
def get_bar_df():
    ...
    return df

bar = get_bar_df(tmp_prefix='bar')

# Creates a bar_XXXXX.parquet file instead

When using with GeoPandas, the library must be set via the dflib argument

import geopandas as gpd

@cached_parquet(dflib=gpd)
def get_gdf():
    ...
    return gdf

Building

Prerequisites;

  • build
  • twine
  • Api keys from PyPi
  • Local configuration file (.pypirc)
python -m build

And

twine upload --repository pypi dist/* --config-file .pypirc

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

ogialibs-0.3.1.tar.gz (4.1 kB view details)

Uploaded Source

File details

Details for the file ogialibs-0.3.1.tar.gz.

File metadata

  • Download URL: ogialibs-0.3.1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.18

File hashes

Hashes for ogialibs-0.3.1.tar.gz
Algorithm Hash digest
SHA256 261a50afde4d7e23b75b68d03f1d68439c8ece6b55fa552262e32c3878a4bfa7
MD5 83a6b4a1897a50016dc345f3371a1d5b
BLAKE2b-256 6e2adb566b80ee6dab0376996b1323f9d6ea2b072ab1bb2cb1c557db1f2b5f4f

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