Metadata-Version: 2.1
Name: loone_data_prep
Version: 0.1.7
Summary: Prepare data to run the LOONE model.
Author-email: Osama Tarabih <osamatarabih@usf.edu>
Maintainer-email: Michael Souffront <msouffront@aquaveo.com>, James Dolinar <jdolinar@aquaveo.com>
License: BSD-3-Clause License
        
        Copyright (c) 2024 University of South Florida
        
        Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
        
        - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
        - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
        - Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: rpy2
Requires-Dist: retry
Requires-Dist: pandas
Requires-Dist: scipy
Requires-Dist: geoglows==0.27.1

LOONE_DATA_PREP
# LOONE_DATA_PREP

Prepare data for the LOONE water quality model.

Line to the LOONE model: [https://pypi.org/project/loone](https://pypi.org/project/loone)
Link to LOONE model repository: [https://github.com/Aquaveo/LOONE](https://github.com/Aquaveo/LOONE)

## Prerequisites:

* R ([https://www.r-project.org/](https://www.r-project.org/))
* R packages: dbhydroR, rio, dplyr

## Installation:

```bash
pip install loone_data_prep
```

### Development Installation:

```bash
cd /path/to/loone_data_prep/repo
pip install -e .
```

### Examples

**From the command line:**

```bash
# Get flow data
python -m loone_data_prep.flow_data.get_inflows /path/to/workspace/
python -m loone_data_prep.flow_data.get_outflows /path/to/workspace/
python -m loone_data_prep.flow_data.S65E_total /path/to/workspace/

# Get water quality data
python -m loone_data_prep.water_quality_data.get_inflows /path/to/workspace/
python -m loone_data_prep.water_quality_data.get_lake_wq /path/to/workspace/

# Get weather data
python -m loone_data_prep.weather_data.get_all /path/to/workspace/

# Get water level
python -m loone_data_prep.water_level_data.get_all /path/to/workspace/

# Interpolate data
python -m loone_data_prep.utils interp_all /path/to/workspace/

# Prepare data for LOONE
python -m loone_data_prep.LOONE_DATA_PREP /path/to/workspace/ /path/to/output/directory/
```

**From Python:**

```python
from loone_data_prep.utils import get_dbkeys
from loone_data_prep.water_level_data import hydro
from loone_data_prep import LOONE_DATA_PREP

input_dir = '/path/to/workspace/'
output_dir = '/path/to/output/directory/'

# Get dbkeys for water level data
dbkeys = get_dbkeys(
    station_ids=["L001", "L005", "L006", "LZ40"],
    category="SW",
    param="STG",
    stat="MEAN",
    recorder="CR10",
    freq="DA",
    detail_level="dbkey"
)

# Get water level data
hydro.get(
    workspace=input_dir,
    name="lo_stage",
    dbkeys=dbkeys,
    date_min="1950-01-01",
    date_max="2023-03-31"
)

# Prepare data for LOONE
LOONE_DATA_PREP(input_dir, output_dir)
```
