Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: New configs #33

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6c92d28
Use a setup.cfg file for package description/config and add isort
kwilcox Mar 18, 2020
11a174a
Move config parsing to one utils function, add additional options
kwilcox Mar 18, 2020
fa735ce
Make add_flag_metadata accept generic kwargs, add the aggregate kwarg
kwilcox Mar 18, 2020
bee1786
Replace QcConfig with a wrapper class around StreamConfig
kwilcox Mar 19, 2020
7a2f340
Add in the first sources: Pandas and Numpy
kwilcox Mar 19, 2020
80d8c4a
Additional documentation, cleansing, and improvements
kwilcox May 29, 2020
9a3630a
Remove 3.6 from supported versions, add numba as a required dependency
kwilcox May 29, 2020
d18b57f
Source -> Stream. Create the Store concept and move netCDF writing there
kwilcox May 29, 2020
a6d2ad6
Fix XarrayStream getting passed an open Dataset, add a test
kwilcox May 29, 2020
c56e20b
Fix numba install/version. Must be a recent bug.
kwilcox May 29, 2020
6044825
Update docs
kwilcox Aug 6, 2020
ff274e4
Don't error if a defined stream config is not found on a Stream
kwilcox Aug 6, 2020
2ccf233
Don't error out if a region is defined as None/null
kwilcox Aug 6, 2020
21dc641
Adding additional notebook examples
kwilcox Aug 20, 2020
87089b7
Make sure quality results are uint8, save some memory in pandas results
kwilcox Aug 20, 2020
ffe0f2b
Don't error if a passed in column doesn't exist in the pandas frame
kwilcox Aug 20, 2020
fcb7868
Fix typo in docs
kwilcox Aug 20, 2020
ef46f05
Fix typo when testing for existing test results in XarrayStream
kwilcox Aug 20, 2020
73ab500
Add a test for a light config with no context defined
kwilcox Aug 20, 2020
dc31e85
For now, return the native results type for each test
kwilcox Aug 20, 2020
277663f
add intro/basic usage to docs
Oct 20, 2020
f2c7a8a
add docs todo
Oct 20, 2020
5750e67
Fix speed test(s) decorators
kwilcox Nov 17, 2020
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ docs/build
tests/data/*.csv
__pycache__
.vscode
build/
docs/source/_build
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ env:
jobs:
fast_finish: true
include:
- python: 3.6
env: TEST_TARGET=default
- python: 3.7
env: TEST_TARGET=default
- python: 3.7
Expand All @@ -24,7 +22,7 @@ jobs:
env: TEST_TARGET=coding_standards
- python: 3.8
env: TEST_TARGET=docs
- python: 3.6
- python: 3.8
env: TEST_TARGET=makerelease
allow_failures:
- python: 3.8
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ include *.rst
include *.txt
include *.ini
include VERSION
include setup.cfg
recursive-include ioos_qc *.py
2 changes: 2 additions & 0 deletions conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ requirements:
- python
- geojson
- netCDF4
- numba
- numpy >=1.14
- pygc
- ruamel.yaml
- shapely
- simplejson
- xarray

Expand Down
41 changes: 28 additions & 13 deletions docs/source/api/ioos_qc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ ioos\_qc package
================

.. automodule:: ioos_qc
:members:
:undoc-members:
:show-inheritance:
:members:
:undoc-members:
:show-inheritance:

Submodules
----------
Expand All @@ -13,9 +13,9 @@ ioos\_qc.config module
----------------------

.. automodule:: ioos_qc.config
:members:
:undoc-members:
:show-inheritance:
:members:
:undoc-members:
:show-inheritance:

ioos\_qc.argo module
-----------------------
Expand All @@ -29,16 +29,31 @@ ioos\_qc.qartod module
----------------------

.. automodule:: ioos_qc.qartod
:members:
:undoc-members:
:show-inheritance:
:members:
:undoc-members:
:show-inheritance:

ioos\_qc.stores module
----------------------

.. automodule:: ioos_qc.stores
:members:
:undoc-members:
:show-inheritance:

ioos\_qc.streams module
-----------------------

.. automodule:: ioos_qc.streams
:members:
:undoc-members:
:show-inheritance:

ioos\_qc.utils module
---------------------

.. automodule:: ioos_qc.utils
:members:
:undoc-members:
:show-inheritance:

:members:
:undoc-members:
:show-inheritance:

3 changes: 2 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#
import os
import sys

p = os.path.abspath(
os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
)
Expand All @@ -41,7 +42,7 @@
'sphinx.ext.mathjax',
'sphinx.ext.viewcode',
'sphinx_autodoc_typehints',
"nbsphinx",
#"nbsphinx",
]

napoleon_google_docstring = True
Expand Down
2 changes: 2 additions & 0 deletions docs/source/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ You can download the source for these notebooks `here <https://github.com/ioos/i
* :doc:`Run QARTOD on a netCDF file, and store the results </examples/Qartod_netCDF_example>`

* :doc:`Run Attenuated Signal test on Salinity data to detect biofouling in an instrument </examples/QartodTestExample_SalinityAttenuation>`

* **TODO: Add links to new notebooks under usage/**
114 changes: 114 additions & 0 deletions docs/source/examples/usage/Config.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
{
"metadata": {
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.2-final"
},
"orig_nbformat": 2,
"kernelspec": {
"name": "python_defaultSpec_1597865297299",
"display_name": "Python 3.8.2 64-bit ('ioosqc38': conda)"
}
},
"nbformat": 4,
"nbformat_minor": 2,
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"# Install QC library\n",
"#!pip uninstall -y ioos_qc\n",
"#!pip install git+git://github.com/ioos/ioos_qc.git\n",
"\n",
"# # Alternative installation (install specific branch):\n",
"# !pip uninstall -y ioos_qc\n",
"# !pip install git+git://github.com/ioos/ioos_qc.git@BRANCHNAME\n",
"\n",
"# Alternative installation (run with local updates):\n",
"#!pip uninstall -y ioos_qc\n",
"import sys\n",
"from pathlib import Path\n",
"basedir = Path().absolute()\n",
"libdir = basedir.parent.parent.parent.parent\n",
"sys.path.append(str(libdir))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Load a Config object from a YAML string"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"tags": []
},
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": "Ignoring region because it could not be parsed, is it valid GeoJSON?\nIgnoring region because it could not be parsed, is it valid GeoJSON?\n"
},
{
"output_type": "execute_result",
"data": {
"text/plain": "OrderedDict([('contexts',\n [{'region': None,\n 'window': {'starting': datetime.datetime(2020, 1, 1, 0, 0),\n 'ending': datetime.datetime(2020, 4, 1, 0, 0)},\n 'streams': {'variable1': {'qartod': {'location_test': {'bbox': [-80,\n 40,\n -70,\n 60]}}},\n 'variable2': {'qartod': {'gross_range_test': {'suspect_span': [1,\n 11],\n 'fail_span': [0, 12]}}}}},\n {'region': None,\n 'window': {'starting': datetime.datetime(2020, 1, 1, 0, 0),\n 'ending': datetime.datetime(2020, 4, 1, 0, 0)},\n 'streams': {'variable1': {'qartod': {'location_test': {'bbox': [-80,\n 40,\n -70,\n 60]}}},\n 'variable2': {'qartod': {'gross_range_test': {'suspect_span': [1,\n 11],\n 'fail_span': [0, 12]}}}}}])])"
},
"metadata": {},
"execution_count": 3
}
],
"source": [
"from ioos_qc.config import Config\n",
"\n",
"config = \"\"\"\n",
" contexts:\n",
" - region: null\n",
" window:\n",
" starting: 2020-01-01T00:00:00Z\n",
" ending: 2020-04-01T00:00:00Z\n",
" streams:\n",
" variable1:\n",
" qartod:\n",
" location_test:\n",
" bbox: [-80, 40, -70, 60]\n",
" variable2:\n",
" qartod:\n",
" gross_range_test:\n",
" suspect_span: [1, 11]\n",
" fail_span: [0, 12]\n",
" - region: null\n",
" window:\n",
" starting: 2020-01-01T00:00:00Z\n",
" ending: 2020-04-01T00:00:00Z\n",
" streams:\n",
" variable1:\n",
" qartod:\n",
" location_test:\n",
" bbox: [-80, 40, -70, 60]\n",
" variable2:\n",
" qartod:\n",
" gross_range_test:\n",
" suspect_span: [1, 11]\n",
" fail_span: [0, 12]\n",
"\"\"\"\n",
"c = Config(config)\n",
"c.config"
]
}
]
}
100 changes: 100 additions & 0 deletions docs/source/examples/usage/ContextConfig.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"metadata": {
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.2-final"
},
"orig_nbformat": 2,
"kernelspec": {
"name": "python_defaultSpec_1597865124286",
"display_name": "Python 3.8.2 64-bit ('ioosqc38': conda)"
}
},
"nbformat": 4,
"nbformat_minor": 2,
"cells": [
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"# Install QC library\n",
"#!pip uninstall -y ioos_qc\n",
"#!pip install git+git://github.com/ioos/ioos_qc.git\n",
"\n",
"# # Alternative installation (install specific branch):\n",
"# !pip uninstall -y ioos_qc\n",
"# !pip install git+git://github.com/ioos/ioos_qc.git@BRANCHNAME\n",
"\n",
"# Alternative installation (run with local updates):\n",
"#!pip uninstall -y ioos_qc\n",
"import sys\n",
"from pathlib import Path\n",
"basedir = Path().absolute()\n",
"libdir = basedir.parent.parent.parent.parent\n",
"sys.path.append(str(libdir))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Load a ContextConfig object from a YAML string"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"tags": []
},
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": "Ignoring region because it could not be parsed, is it valid GeoJSON?\n"
},
{
"output_type": "execute_result",
"data": {
"text/plain": "OrderedDict([('region', None),\n ('window',\n {'starting': datetime.datetime(2020, 1, 1, 0, 0),\n 'ending': datetime.datetime(2020, 4, 1, 0, 0)}),\n ('streams',\n {'variable1': {'qartod': {'location_test': {'bbox': [-80,\n 40,\n -70,\n 60]}}},\n 'variable2': {'qartod': {'aggregate': None,\n 'gross_range_test': {'suspect_span': [1, 11],\n 'fail_span': [0, 12]}}}})])"
},
"metadata": {},
"execution_count": 6
}
],
"source": [
"from ioos_qc.config import ContextConfig\n",
"\n",
"config = \"\"\"\n",
" region: null\n",
" window:\n",
" starting: 2020-01-01T00:00:00Z\n",
" ending: 2020-04-01T00:00:00Z\n",
" streams:\n",
" variable1:\n",
" qartod:\n",
" location_test:\n",
" bbox: [-80, 40, -70, 60]\n",
" variable2:\n",
" qartod:\n",
" aggregate:\n",
" gross_range_test:\n",
" suspect_span: [1, 11]\n",
" fail_span: [0, 12]\n",
"\"\"\"\n",
"c = ContextConfig(config)\n",
"c.config"
]
}
]
}
Loading