Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
95fe83a
Merge pull request #12 from DataIntegrationGroup/pre-production
jacob-a-brown Feb 4, 2025
254d53e
Merge pull request #14 from DataIntegrationGroup/pre-production
jacob-a-brown Feb 4, 2025
cd1842a
Merge pull request #16 from DataIntegrationGroup/pre-production
jacob-a-brown Feb 4, 2025
481e463
Merge pull request #18 from DataIntegrationGroup/pre-production
jacob-a-brown Feb 4, 2025
eefb2cb
Merge pull request #20 from DataIntegrationGroup/pre-production
jacob-a-brown Feb 4, 2025
de311e1
Merge pull request #22 from DataIntegrationGroup/pre-production
jacob-a-brown Feb 5, 2025
7464f89
Merge pull request #24 from DataIntegrationGroup/pre-production
jacob-a-brown Feb 5, 2025
bd115d6
Merge pull request #26 from DataIntegrationGroup/pre-production
jirhiker Feb 12, 2025
6132c5d
Merge pull request #28 from DataIntegrationGroup/pre-production
jacob-a-brown Feb 14, 2025
4012bea
Merge pull request #31 from DataIntegrationGroup/pre-production
jacob-a-brown Feb 14, 2025
cf6960a
Merge pull request #33 from DataIntegrationGroup/pre-production
jirhiker Feb 14, 2025
4732442
Create dependabot.yml
jirhiker Mar 12, 2025
535ed50
Update README.md
jirhiker Mar 12, 2025
eb7d7af
Merge pull request #35 from DataIntegrationGroup/pre-production
jacob-a-brown Mar 17, 2025
0e3422f
Update for AMPAPI v 0.33.0 - pagination and removal of well from wate…
jacob-a-brown Mar 18, 2025
23936e4
Merge pull request #37 from DataIntegrationGroup/pre-production
jacob-a-brown Mar 20, 2025
3c5ffcd
added ci/cd caching
jirhiker Apr 15, 2025
2097795
workflow trigger updates
jirhiker Apr 15, 2025
6cc5a15
Implement GeoJSON for sites & summary
jacob-a-brown Apr 15, 2025
60ef303
geojson output for sites and summary
jacob-a-brown Apr 16, 2025
0f1d727
Formatting changes
jacob-a-brown Apr 16, 2025
34eeddc
Comment out cache because of errors
jacob-a-brown Apr 16, 2025
944fdcc
Merge branch 'dev/jab' of https://github.com/DataIntegrationGroup/Dat…
jacob-a-brown Apr 16, 2025
a047ba1
add well depth units to sites table output
jacob-a-brown Apr 16, 2025
0edebcd
mypy fixes
jacob-a-brown Apr 16, 2025
dd47369
Formatting changes
jacob-a-brown Apr 16, 2025
a4ace42
Merge branch 'main' into dev/jab
jacob-a-brown Apr 16, 2025
1a0511d
work on caching in workflow
jacob-a-brown Apr 16, 2025
6d9ea6f
Bulk well retrieval
jacob-a-brown Apr 16, 2025
7c20ce8
Merge branch 'pre-production' into dev/jab
jacob-a-brown Apr 23, 2025
d25716e
fixes and updates after merging pre-production
jacob-a-brown Apr 23, 2025
8ce5bb9
Formatting changes
jacob-a-brown Apr 23, 2025
cf2c0b3
integration and unification of dev branches
jacob-a-brown Apr 25, 2025
7fe0fa0
remove dirs made by tests
jacob-a-brown Apr 25, 2025
2c09d46
Formatting changes
jacob-a-brown Apr 25, 2025
3ba04ee
rearranged requirements to be alphabetical
jacob-a-brown Apr 25, 2025
0aee4e7
updated CHANGELOG
jacob-a-brown Apr 25, 2025
c73c7e1
Merge branch 'dev/jab' of https://github.com/DataIntegrationGroup/Dat…
jacob-a-brown Apr 25, 2025
8cb66d2
Merge branch 'ampapi-v-0-34-0' into dev/jab
jacob-a-brown Apr 25, 2025
acf680a
NMBGMR water level pagination
jacob-a-brown Apr 25, 2025
ad8b0f1
Formatting changes
jacob-a-brown Apr 25, 2025
de46920
mypy fixes
jacob-a-brown Apr 25, 2025
a8ef53a
Merge branch 'pre-production' into dev/jab
jacob-a-brown Apr 25, 2025
d7457a7
Merge branch 'dev/jab' of https://github.com/DataIntegrationGroup/Dat…
jacob-a-brown Apr 25, 2025
ec4689e
populate nmbgmr well fields
jacob-a-brown Apr 25, 2025
8322949
Formatting changes
jacob-a-brown Apr 25, 2025
f0c7973
mypy fix
jacob-a-brown Apr 25, 2025
e05ef53
variable name clarity
jacob-a-brown Apr 25, 2025
dab407b
Formatting changes
jacob-a-brown Apr 25, 2025
8bcd789
Merge branch 'dev/jab' of https://github.com/DataIntegrationGroup/Dat…
jacob-a-brown Apr 25, 2025
074f62e
Formatting changes
jacob-a-brown Apr 25, 2025
93a3878
skip well data retrieval for NMBGMR until it can be retrieved in batches
jacob-a-brown Apr 25, 2025
1ca1de4
Merge branch 'dev/jab' of https://github.com/DataIntegrationGroup/Dat…
jacob-a-brown Apr 25, 2025
373cc9d
Formatting changes
jacob-a-brown Apr 25, 2025
87e2225
mypy fix
jacob-a-brown Apr 25, 2025
a5d0b59
default 'yes' to False to enable prompt
jacob-a-brown Apr 28, 2025
a23d1d8
add agency to nwis site numbers
jacob-a-brown Apr 28, 2025
89042a9
ose pods are false agencies for all parameters
jacob-a-brown Apr 28, 2025
ada99cb
bump to 0.9.1
jacob-a-brown Apr 28, 2025
08a0aeb
update documentation
jacob-a-brown Apr 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
21 changes: 17 additions & 4 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: CI/CD

on:
push:
branches: [ "main", "feature/jir", "dev/jab"]
branches: [ "pre-production", "feature/jir", "dev/jab"]
pull_request:
branches: [ "main"]
branches: [ "pre-production"]

permissions:
contents: read
Expand All @@ -18,26 +18,39 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"

- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest mypy
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

- name: Type check with mypy
run: |
mypy . --ignore-missing-imports

- name: Test with pytest
run: |
pytest -s -rx tests
8 changes: 5 additions & 3 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
# pushes only occur on successful pull request merges
# this makes it so that the main branch gets published to PyPi, not the
# target branch from the pull request (pre-production)

# pushing tags should be the only way to trigger this workflow
on:
push:
branches:
- main
tags:
- '*'

jobs:
build-and-publish-if-merged:
Expand All @@ -20,7 +22,7 @@ jobs:
uses: actions/setup-python@v1
with:
python-version: 3.9
cache: 'pip'

- name: Install pypa/build
run: >-
python -m
Expand Down
19 changes: 18 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,24 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased: 0.8.0
## 0.9.2

### Added
- `--sites-only` flag to only retrieve site data
- `--output-format` flag to write out sites/summary tables as csv or geojson.
- options are `csv` or `geojson`
- timeseries data is always written to a csv
- NM OSE POD data for sites.
- can be removed from output with `--no-nmose-pod`
- `--output-dir` to change the output directory to a location other than `.` (the current working directory)

### Changed
- `output` to `output-type` for CLI

### Fixed
- a bug with `--site-limit`. it now exports the number of sets requested by the

## 0.8.0

### Added
- water level for WQP
Expand Down
27 changes: 16 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[![Format code](https://github.com/DataIntegrationGroup/PyWeaver/actions/workflows/format_code.yml/badge.svg?branch=main)](https://github.com/DataIntegrationGroup/PyWeaver/actions/workflows/format_code.yml)
[![Publish Python 🐍 distributions 📦 to PyPI and TestPyPI](https://github.com/DataIntegrationGroup/PyWeaver/actions/workflows/publish-to-pypi.yml/badge.svg)](https://github.com/DataIntegrationGroup/PyWeaver/actions/workflows/publish-to-pypi.yml)
[![CI/CD](https://github.com/DataIntegrationGroup/PyWeaver/actions/workflows/cicd.yml/badge.svg)](https://github.com/DataIntegrationGroup/PyWeaver/actions/workflows/cicd.yml)

[![Dependabot Updates](https://github.com/DataIntegrationGroup/DataIntegrationEngine/actions/workflows/dependabot/dependabot-updates/badge.svg)](https://github.com/DataIntegrationGroup/DataIntegrationEngine/actions/workflows/dependabot/dependabot-updates)

![NMWDI](https://newmexicowaterdata.org/wp-content/uploads/2023/11/newmexicowaterdatalogoNov2023.png)
![NMBGMR](https://waterdata.nmt.edu/static/nmbgmr_logo_resized.png)
Expand Down Expand Up @@ -71,22 +71,22 @@ where `{parameter}` is the name of the parameter whose data is to be retrieved,
| **pvacd** | X | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
| **wqp** | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X |

### Output
The `--output` option is required and used to set the output type:
### Output Type
The `--output-type` option is required and used to set the output type:

```
--output summary
--output-type summary
```
- A summary table consisting of location information as well as summary statistics for the parameter of interest for every location that has observations.

```
--output timeseries_unified
--output-type timeseries_unified
```
- A single table consisting of time series data for all locations for the parameter of interest.
- A single table of site data that contains information such as latitude, longitude, and elevation

```
--output timeseries_separated
--output-type timeseries_separated
```
- Separate time series tables for all locations for the parameter of interest.
- A single table of site data that contains information such as latitude, longitude, and elevation
Expand Down Expand Up @@ -146,6 +146,7 @@ A log of the inputs and processes, called `die.log`, is also saved to the output
| formation | geologic formation in which the well terminates | string | N |
| aquifer | aquifer from which the well draws water | string | N |
| well_depth | depth of well | float | N |
| well_depth_units | units of well depth. Defaults to ft | string | N |

<sup>**CABQ elevation is calculated as [elevation at top of casing] - [stickup height]; if stickup height < 0 the measuring point is assumed to be beneath the ground surface</sup>

Expand Down Expand Up @@ -180,7 +181,7 @@ The Data Integration Engine enables the user to obtain groundwater level and gro
- `--no-pvacd` to exclude Pecos Valley Artesian Convservancy District (PVACD) data
- `--no-wqp` to exclude Water Quality Portal (WQP) data

### Geographic Filters
### Geographic Filters [In Development]

The following flags can be used to geographically filter data:

Expand All @@ -192,7 +193,11 @@ The following flags can be used to geographically filter data:
-- bbox 'x1 y1, x2 y2'
```

### Date Filters
```
-- wkt {wkt polygon or multipolygon}
```

### Date Filters [In Development]

The following flags can be used to filter by dates:

Expand All @@ -214,12 +219,12 @@ die sources {parameter}

to print the sources that report that parameter to the terminal.

### Wells [In Development]
### Sites

Use

```
die wells
die sites
```

to print wells to the terminal.
to export site information only
11 changes: 10 additions & 1 deletion backend/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
from enum import Enum
from os import environ


class OutputFormat(str, Enum):
GEOJSON = "geojson"
CSV = "csv"
GEOSERVER = "geoserver"
GEOSERVER = "geoserver"


def get_bool_env_variable(var: str) -> bool:
env_var = environ.get(var, None)
if env_var is None or env_var.strip().lower() not in ["true", "1", "yes"]:
return False
else:
return True
52 changes: 26 additions & 26 deletions backend/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
from datetime import datetime, timedelta
from enum import Enum
import shapely.wkt
import yaml

from . import OutputFormat
from .bounding_polygons import get_county_polygon
from .connectors.nmbgmr.source import (
Expand Down Expand Up @@ -68,7 +70,8 @@
)
from .connectors.usgs.source import NWISSiteSource, NWISWaterLevelSource
from .connectors.wqp.source import WQPSiteSource, WQPAnalyteSource, WQPWaterLevelSource
from .logger import Loggable
from backend.logger import Loggable


SOURCE_DICT = {
"bernco": BernCoSiteSource,
Expand Down Expand Up @@ -98,9 +101,6 @@ def get_source(source):
return klass()





class Config(Loggable):
site_limit: int = 0
dry: bool = False
Expand Down Expand Up @@ -149,18 +149,14 @@ class Config(Loggable):
analyte_output_units: str = MILLIGRAMS_PER_LITER
waterlevel_output_units: str = FEET

# use_csv: bool = True
# use_geojson: bool = False

output_format: OutputFormat = OutputFormat.CSV
output_format: str = OutputFormat.CSV

yes: bool = True
yes: bool = False

def __init__(self, model=None, payload=None, path=None):
# need to initialize logger
super().__init__()

self.bbox = {}
if path:
payload = self._load_from_yaml(path)

Expand All @@ -186,24 +182,27 @@ def __init__(self, model=None, payload=None, path=None):
if value is not None:
setattr(self, f"use_source_{sk}", value)

for attr in ("wkt", "county", "bbox",
"output_summary",
"output_timeseries_unified",
"output_timeseries_separated",
"start_date",
"end_date",
"parameter",
"output_name",
"dry",
"latest_water_level_only",
"output_format",
"use_cloud_storage",
"yes"):
for attr in (
"wkt",
"county",
"bbox",
"output_summary",
"output_timeseries_unified",
"output_timeseries_separated",
"start_date",
"end_date",
"parameter",
"output_name",
"dry",
"latest_water_level_only",
"output_format",
"use_cloud_storage",
"yes",
):
if attr in payload:
setattr(self, attr, payload[attr])

def _load_from_yaml(self, path):
import yaml
path = os.path.abspath(path)
if os.path.exists(path):
self.log(f"Loading config from {path}")
Expand All @@ -221,7 +220,6 @@ def get_config_and_false_agencies(self):
"ebid",
"nmbgmr_amp",
"nmose_isc_seven_rivers",
"nmose_pod",
"nmose_roswell",
"nwis",
"pvacd",
Expand Down Expand Up @@ -450,7 +448,7 @@ def _report_attributes(title, attrs):
"output_horizontal_datum",
"output_elevation_units",
"use_cloud_storage",
"output_format"
"output_format",
),
)

Expand Down Expand Up @@ -573,4 +571,6 @@ def output_path(self):
def get(self, attr):
if self._payload:
return self._payload.get(attr)


# ============= EOF =============================================
Loading
Loading