semvec/pypi-packages huggingface dataset:
pyseaflux 2.2.1
Calculation of air-sea fluxes
License: MIT
Requires Python: >=3.6

pySeaFlux
==============================
[![Build Status](https://github.com/lukegre/pyseaflux/workflows/Tests/badge.svg)](https://github.com/lukegre/pyseaflux/actions)
[![Documentation Status](https://readthedocs.org/projects/seaflux/badge/?version=latest)](https://seaflux.readthedocs.io/en/latest/?badge=latest)
[![pypi](https://badgen.net/pypi/v/pyseaflux)](https://pypi.org/project/pyseaflux)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4659162.svg)](https://doi.org/10.5281/zenodo.4045403)
[![License:MIT](https://img.shields.io/badge/License-MIT-lightgray.svg?style=flt-square)](https://opensource.org/licenses/MIT)
<!-- [![conda-forge](https://img.shields.io/conda/dn/conda-forge/seaflux?label=conda-forge)](https://anaconda.org/conda-forge/seaflux) -->


Calculation of air-sea fluxes


Installing
----------

### GitHub
`pip install git+https://github.com/lukegre/pySeaFlux.git`

### PyPi
`pip install pyseaflux`


Overview of functionality
-------------------------

- Calculate sea-air fluxes using the bulk formulation
- Convert pCO2 to fCO2 and *vice versa*.
- Correct or adjust pCO2 for temperature changes
- Scale kw to 14C bomb values for wind products using Wanninkhof's (1992) second moment of the wind speed (requires standard deviation of the wind)
- Download NOAA Marine Boundary Layer xCO2 and related functions for pCO2 conversion
- Calculate the grid cell area (in m^2) for a grid of latitudes and longitudes - also works as an xarray method (`xda.area()`)


To Do
-----
- unit errors should only happen when more than 50% of non-nan values are not valid. Otherwise, raise warning and make output `nan`. Will double up with `pyCO2SYS`.
- tests! Currently there are not any meaningful tests.
- Add contributor file.
- Documentation


--------

<p><small>Project based on the <a target="_blank" href="https://github.com/jbusecke/cookiecutter-science-project">cookiecutter science project template</a>.</small></p>
psycopg2-utils 1.0.3
Utils to use with psycopg2 such as a connection pool and cursor
License: MIT
Requires Python: >=3.8
Keywords: postgres psycopg2

# psycopg2 utils

This package contains helper classes for psycopg2.

## Installation
```bash
pip install psycopg2-utils
```

## ConnectionPool
This connection pool is thread safe and does not raise an exception when the pool is
empty and a thread tried to get a connection from it. Instead the thread will wait
for a connection to become available in the pool.
Connections will also not be closed when returned to the pool until they have been
idle for some specified time.

```python
from psycopg2_utils import ConnectionPool

config = {
    "minconn": os.environ["DB_MINCONN"],
    "maxconn": os.environ["DB_MAXCONN"],
    "idle_time": os.environ["IDLE_TIME"],
    "dbname": os.environ["DB_NAME"],
    "host": os.environ["DB_HOST"],
    "port": os.environ["DB_PORT"],
    "user": os.environ["DB_USER"],
    "password": os.environ["DB_PASS"],
    "options": "-c search_path={}".format(os.environ["DB_SCHEMA"]),
}
pool = ConnectionPool(**config)

# Get connection from the pool
con = pool.getconn()

# Return connection to the pool
pool.putconn(con)
```

## Cursor
This cursor extends the dict curser and enables logging the sql queries when the log
level is set to DEBUG and also logs how long each query takes to execute if log level
is INFO and there is an environment variable named METRIC_LOGGING that has the value
"TRUE".

```python
from psycopg2 import connect
from psycopg2_utils import Cursor

con = connect("")
cur = con.cursor(cursor_factory=Cursor)
```

## pooled_cursor
This allows a method of a class to be decorated so that it will automatically supply
the method with a cursor to use.
It requires that the class has a property named pool containing a connection pool that
implements the `AbstractConnectionPool`.

```python
from psycopg2_utils import pooled_cursor

class MyClass:
    def __init__(self, config):
        self.pool = ConnectionPool(**config)

    @pooled_cursor
    def get_count(self, cursor):
        cursor.execute("SELECT count(*) FROM table;")
        return cursor.fetchone()[0]

my_class = MyClass(config)

#The method can then be used like this:
count = my_class.get_count()

# If you already hold a cursor and don't want to get a new one
# from the pool then it can be passed into the method.
cursor = some_method_that_gets_cursor()
count = my_class.get_count(cursor=cursor)
```

The wrapper will take care of getting a connection from the pool and returning it to
the pool at the end. It also does a commit when there is no exception.