├── .gitattributes ├── .github ├── ISSUE_TEMPLATE.md └── workflows │ └── build.yml ├── .gitignore ├── .readthedocs.yml ├── AUTHORS.rst ├── CHANGELOG.rst ├── CONTRIBUTING.rst ├── LICENSE ├── MANIFEST.in ├── Makefile ├── README.rst ├── build_all.bat ├── conda.recipe ├── bld.bat ├── build.sh ├── conda_build_config.yaml └── meta.yaml ├── docs ├── .nojekyll ├── doctrees │ ├── authors.doctree │ ├── contributing.doctree │ ├── environment.pickle │ ├── history.doctree │ ├── index.doctree │ ├── installation.doctree │ ├── modules.doctree │ ├── nbsphinx │ │ ├── notebooks_sample_dss_files_19_0.png │ │ ├── notebooks_sample_dss_files_19_1.png │ │ ├── notebooks_sample_dss_files_21_0.png │ │ ├── notebooks_sample_dss_files_21_1.png │ │ ├── notebooks_sample_dss_files_25_0.png │ │ ├── notebooks_sample_dss_files_25_1.png │ │ ├── notebooks_sample_dss_files_26_0.png │ │ ├── notebooks_sample_dss_files_26_1.png │ │ ├── notebooks_sample_dss_files_36_0.png │ │ └── notebooks_sample_dss_files_36_1.png │ ├── notebooks │ │ └── sample_dss_files.doctree │ ├── pyhecdss.doctree │ ├── readme.doctree │ └── usage.doctree ├── html │ ├── .buildinfo │ ├── _images │ │ ├── notebooks_sample_dss_files_19_0.png │ │ ├── notebooks_sample_dss_files_19_1.png │ │ ├── notebooks_sample_dss_files_21_0.png │ │ ├── notebooks_sample_dss_files_21_1.png │ │ ├── notebooks_sample_dss_files_25_0.png │ │ ├── notebooks_sample_dss_files_25_1.png │ │ ├── notebooks_sample_dss_files_26_0.png │ │ ├── notebooks_sample_dss_files_26_1.png │ │ ├── notebooks_sample_dss_files_36_0.png │ │ └── notebooks_sample_dss_files_36_1.png │ ├── _modules │ │ ├── index.html │ │ ├── numpy.html │ │ └── pyhecdss │ │ │ └── pyhecdss.html │ ├── _sources │ │ ├── authors.rst.txt │ │ ├── contributing.rst.txt │ │ ├── history.rst.txt │ │ ├── index.rst.txt │ │ ├── installation.rst.txt │ │ ├── modules.rst.txt │ │ ├── notebooks │ │ │ └── sample_dss_files.ipynb.txt │ │ ├── pyhecdss.rst.txt │ │ ├── readme.rst.txt │ │ └── usage.rst.txt │ ├── _static │ │ ├── alabaster.css │ │ ├── basic.css │ │ ├── custom.css │ │ ├── doctools.js │ │ ├── documentation_options.js │ │ ├── file.png │ │ ├── jquery-3.2.1.js │ │ ├── jquery-3.4.1.js │ │ ├── jquery-3.5.1.js │ │ ├── jquery.js │ │ ├── language_data.js │ │ ├── minus.png │ │ ├── plus.png │ │ ├── pygments.css │ │ ├── searchtools.js │ │ ├── underscore-1.13.1.js │ │ ├── underscore-1.3.1.js │ │ └── underscore.js │ ├── authors.html │ ├── contributing.html │ ├── genindex.html │ ├── history.html │ ├── index.html │ ├── installation.html │ ├── modules.html │ ├── notebooks │ │ └── sample_dss_files.html │ ├── objects.inv │ ├── py-modindex.html │ ├── pyhecdss.html │ ├── readme.html │ ├── search.html │ ├── searchindex.js │ └── usage.html └── index.html ├── docsrc ├── Makefile ├── authors.rst ├── conf.py ├── contributing.rst ├── doall.bat ├── history.rst ├── index.rst ├── installation.rst ├── make.bat ├── modules.rst ├── notebooks │ ├── sample.dss │ └── sample_dss_files.ipynb ├── pyhecdss.rst ├── readme.rst ├── requirements.txt └── usage.rst ├── environment-dev.yml ├── environment.yml ├── extensions ├── heclib6-VE.lib └── libheclib6-WE.a ├── jenkins_dwr.bat ├── jenkins_dwr.sh ├── perftest ├── hec_read_large_file.py ├── pydss_read_large_file.py ├── read_large_file.py └── vscript_read_large_file.py ├── pyhecdss ├── __init__.py ├── _version.py ├── heclib.h ├── hecwrapper.c ├── hecwrapper.h ├── numpy.i ├── pyhecdss.py └── pyheclib.i ├── requirements_dev.txt ├── run_test.bat ├── setup.cfg ├── setup.py ├── setup_dev_env.bat ├── tests ├── __init__.py ├── pytest.ini ├── test1.dss ├── test_catalog.dsc ├── test_catalog_dsc_read.py ├── test_failing_catalog.dsc ├── test_helper.py ├── test_peraver.py ├── test_pyhecdss.py ├── test_pyhecdss_intrinsic.py ├── test_pyheclib.py ├── test_rts_offset.py └── test_twstr.py └── versioneer.py /.gitattributes: -------------------------------------------------------------------------------- 1 | pyhecdss/_version.py export-subst 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | * pyhecdss version: 2 | * Python version: 3 | * Operating System: 4 | 5 | ### Description 6 | 7 | Describe what you were trying to get done. 8 | Tell us what happened, what went wrong, and what you expected to happen. 9 | 10 | ### What I Did 11 | 12 | ``` 13 | Paste the command(s) you ran and the output. 14 | If there was a crash, please include the traceback here. 15 | ``` 16 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build Conda packages 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build-conda: 7 | runs-on: ${{ matrix.os }} 8 | 9 | strategy: 10 | matrix: 11 | os: [ubuntu-latest, windows-latest] 12 | python-version: ["3.11"] 13 | toolchain: 14 | - {compiler: intel-classic, version: '2021.12'} 15 | 16 | steps: 17 | - name: Checkout repository 18 | uses: actions/checkout@v3 19 | with: 20 | fetch-depth: 0 # Shallow clones should be disabled for versioneer 21 | fetch-tags: true # Required for versioneer 22 | 23 | - name: Set up Python ${{ matrix.python-version }} 24 | uses: actions/setup-python@v4 25 | with: 26 | python-version: ${{ matrix.python-version }} 27 | 28 | - name: Set up Conda environment (Linux/Windows) 29 | uses: conda-incubator/setup-miniconda@v3 30 | with: 31 | activate-environment: build-env 32 | channels: conda-forge 33 | python-version: ${{ matrix.python-version }} 34 | auto-update-conda: true 35 | mamba-version: "*" 36 | 37 | - name: Install dependencies (Linux/Windows) 38 | run: | 39 | conda install -y conda-build numpy anaconda-client versioneer 40 | 41 | - name: Install ifort dependencies (Windows) 42 | if: matrix.os == 'windows-latest' 43 | uses: fortran-lang/setup-fortran@v1 44 | id: setup-fortran 45 | with: 46 | compiler: ${{ matrix.toolchain.compiler }} 47 | version: ${{ matrix.toolchain.version }} 48 | 49 | - name: Verify ifort environment (Windows) 50 | if: matrix.os == 'windows-latest' 51 | run: | 52 | echo "Setting up Fortran environment" 53 | ${{ steps.setup-fortran.outputs.fc }} /help 54 | 55 | - name: Build Conda package on Ubuntu 56 | if: matrix.os == 'ubuntu-latest' 57 | env: 58 | ANACONDA_CHANNEL_UPLOAD_TOKEN: ${{ secrets.ANACONDA_CHANNEL_UPLOAD_TOKEN }} 59 | run: | 60 | echo "Building Conda package" 61 | conda config --set anaconda_upload yes 62 | conda build -c conda-forge -c cadwr-dms --user cadwr-dms --token "$ANACONDA_CHANNEL_UPLOAD_TOKEN" . 63 | 64 | - name: Build Conda package on Windows 65 | if: matrix.os == 'windows-latest' 66 | env: 67 | ANACONDA_CHANNEL_UPLOAD_TOKEN: ${{ secrets.ANACONDA_CHANNEL_UPLOAD_TOKEN }} 68 | run: | 69 | echo "Building Conda package" 70 | conda config --set anaconda_upload yes 71 | conda build -c conda-forge -c cadwr-dms --user cadwr-dms --token "$env:ANACONDA_CHANNEL_UPLOAD_TOKEN" . -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # HEC DSS related extensions 2 | tests/test*.ds* 3 | *.dsc 4 | *.dsd 5 | *.dsk 6 | # SWIG wrappter generated 7 | *_wrap.c 8 | pyhecdss/pyheclib.py 9 | #--ignore notebooks and perftest 10 | notebooks/ 11 | perftest/ 12 | #- VS Code 13 | .vscode/ 14 | #----- Generic Ignores imported from cookiecutter 15 | # Byte-compiled / optimized / DLL files 16 | __pycache__/ 17 | *.py[cod] 18 | *$py.class 19 | 20 | # C extensions 21 | *.so 22 | 23 | # Distribution / packaging 24 | .Python 25 | env/ 26 | build/ 27 | develop-eggs/ 28 | dist/ 29 | downloads/ 30 | eggs/ 31 | .eggs/ 32 | lib/ 33 | lib64/ 34 | parts/ 35 | sdist/ 36 | var/ 37 | wheels/ 38 | *.egg-info/ 39 | .installed.cfg 40 | *.egg 41 | 42 | # PyInstaller 43 | # Usually these files are written by a python script from a template 44 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 45 | *.manifest 46 | *.spec 47 | 48 | # Installer logs 49 | pip-log.txt 50 | pip-delete-this-directory.txt 51 | 52 | # Unit test / coverage reports 53 | htmlcov/ 54 | .tox/ 55 | .coverage 56 | .coverage.* 57 | .cache 58 | nosetests.xml 59 | coverage.xml 60 | *.cover 61 | .hypothesis/ 62 | .pytest_cache/ 63 | 64 | # Translations 65 | *.mo 66 | *.pot 67 | 68 | # Django stuff: 69 | *.log 70 | local_settings.py 71 | 72 | # Flask stuff: 73 | instance/ 74 | .webassets-cache 75 | 76 | # Scrapy stuff: 77 | .scrapy 78 | 79 | # Sphinx documentation 80 | docsrc/_build/ 81 | 82 | # PyBuilder 83 | target/ 84 | 85 | # Jupyter Notebook 86 | .ipynb_checkpoints 87 | 88 | # pyenv 89 | .python-version 90 | 91 | # celery beat schedule file 92 | celerybeat-schedule 93 | 94 | # SageMath parsed files 95 | *.sage.py 96 | 97 | # dotenv 98 | .env 99 | 100 | # virtualenv 101 | .venv 102 | venv/ 103 | ENV/ 104 | 105 | # Spyder project settings 106 | .spyderproject 107 | .spyproject 108 | 109 | # Rope project settings 110 | .ropeproject 111 | 112 | # mkdocs documentation 113 | /site 114 | 115 | # mypy 116 | .mypy_cache/ 117 | -------------------------------------------------------------------------------- /.readthedocs.yml: -------------------------------------------------------------------------------- 1 | # .readthedocs.yml 2 | # Read the Docs configuration file 3 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details 4 | 5 | # Required 6 | version: 2 7 | 8 | # Build documentation in the docs/ directory with Sphinx 9 | sphinx: 10 | configuration: docsrc/conf.py 11 | 12 | # Build documentation with MkDocs 13 | #mkdocs: 14 | # configuration: mkdocs.yml 15 | 16 | # Optionally build your docs in additional formats such as PDF and ePub 17 | formats: all 18 | 19 | # Optionally set the version of Python and requirements required to build your docs 20 | python: 21 | version: 3.7 22 | install: 23 | - requirements: docsrc/requirements.txt 24 | 25 | #Conda configuratin 26 | conda: 27 | environment: environment.yml 28 | -------------------------------------------------------------------------------- /AUTHORS.rst: -------------------------------------------------------------------------------- 1 | ======= 2 | Credits 3 | ======= 4 | 5 | Development Lead 6 | ---------------- 7 | 8 | * Nicky Sandhu [github: dwr-psandhu] 9 | 10 | Contributors 11 | ------------ 12 | 13 | * Kijin Nam [github: kjnam] 14 | * Henry Oling [github:HenryDane] 15 | -------------------------------------------------------------------------------- /CHANGELOG.rst: -------------------------------------------------------------------------------- 1 | ========= 2 | CHANGELOG 3 | ========= 4 | 1.1.4 5 | ----- 6 | fix for issue #25, #26, #27 and warning cleanup 7 | 8 | 1.1.3 9 | ----- 10 | Fixed imports to avoid circular import issue #27 11 | 12 | 1.1.2 13 | ----- 14 | more fixes for create_new flag tests 15 | 16 | 1.1.1 17 | ------ 18 | fixing tests for create_new flag 19 | 20 | 1.1.0 21 | ----- 22 | DSS file only created when explicitly create_new=True(default: False) 23 | 24 | 1.0.2 25 | ----- 26 | bugfix for empty arrays 27 | 28 | 1.0.1 29 | ----- 30 | handle pandas Series on writes 31 | 32 | 1.0.0 33 | ------ 34 | using generators for get_ts and get_matching_ts functions for efficiency 35 | context manager for use "with" statement 36 | fixed for pandas >=1.1 37 | auto versioning turned on 38 | 39 | 0.6.1 40 | ----- 41 | fixed bug when switching to non-condensed catalog that caused shortening of time windows 42 | 43 | 0.6.0 44 | ----- 45 | * fix for breaking change by pandas >= 1.1 46 | * switching to using non-condensed catalog, flag available to switch back 47 | * changing exception on missing pathname to logging message 48 | * changing message level to 0 as default 49 | * adding get_rts_matching for pathname selection by regular expressions 50 | * replaced warnings with debug logging 51 | 52 | 0.5.1 53 | ----- 54 | Fixed for '\*' in catalog file in case of missing periods 55 | 56 | 0.5.0 57 | ----- 58 | Added helper function for simple timeseries retrieval 59 | 60 | 0.4.1 61 | ----- 62 | regular and irregular timeseries now share same time window parsing logic 63 | 64 | 0.4.0 65 | ----- 66 | fixes for issue #16: pandas timestamp limitations 67 | 68 | 0.3.1 69 | ----- 70 | another fix for pandas 1.0.0 upgrade - issue #15 71 | 72 | 0.3.0 73 | ----- 74 | fix for issue 15: units 'M' and 'Y' no longer supported 75 | 76 | 0.2.9 77 | ----- 78 | Fixed issue with end of timestamp writing to dss files for "PER-\*" data type 79 | 80 | 0.2.8 81 | ----- 82 | Recompiled heclib in linux with latest compilers to resolve issue 8 83 | 84 | 0.2.7 85 | ----- 86 | Partial fixes for offset: Fixed for "INST-\*" timeseries but not "PER-\*" timeseries (issue #12) 87 | 88 | 0.2.6 89 | ----- 90 | Performance tests added to showcase pyhecdss is the fastest 91 | Fixed issue #10: Period data stored shifted to end of time stamp (HEC-DSS convention) 92 | Fixing libgfortran dependency on linux by statically linking the library 93 | 94 | 0.2.5 95 | ----- 96 | Merged pull request from HenryDane: 97 | issues warnings or throws exception based on return value from functions 98 | fixed minor typo(s), added tests 99 | 100 | 0.2.4 101 | ----- 102 | 103 | Fixes issues #2, #4: get_version(), set_message_level(), set_program_name() now supported at module level 104 | Fixes issues #1: HECDSS marks periods by end of time stamp bug 105 | 106 | 0.2.3 107 | ----- 108 | Added linux 64bit support 109 | Corrected license to MIT for conda distribution 110 | 111 | 0.2.2 112 | ----- 113 | Update tests to use a smaller test.dss files 114 | Added sphinx documentation and demo notebook 115 | 116 | 0.2.1 117 | ----- 118 | Write irregular time series 119 | 120 | 0.2.0 121 | ------ 122 | Write regular time series 123 | Read irregular time series as data frame + units + type 124 | Performance improvement to using np.zeros instead of np.array(range...) 125 | 126 | 0.1.6 127 | ----- 128 | -------------------------------------------------------------------------------- /CONTRIBUTING.rst: -------------------------------------------------------------------------------- 1 | .. highlight:: shell 2 | 3 | ============ 4 | Contributing 5 | ============ 6 | 7 | Contributions are welcome, and they are greatly appreciated! Every little bit 8 | helps, and credit will always be given. 9 | 10 | You can contribute in many ways: 11 | 12 | Types of Contributions 13 | ---------------------- 14 | 15 | Report Bugs 16 | ~~~~~~~~~~~ 17 | 18 | Report bugs at https://github.com/CADWRDeltaModeling/pyhecdss/issues. 19 | 20 | If you are reporting a bug, please include: 21 | 22 | * Your operating system name and version. 23 | * Any details about your local setup that might be helpful in troubleshooting. 24 | * Detailed steps to reproduce the bug. 25 | 26 | Fix Bugs 27 | ~~~~~~~~ 28 | 29 | Look through the GitHub issues for bugs. Anything tagged with "bug" and "help 30 | wanted" is open to whoever wants to implement it. 31 | 32 | Implement Features 33 | ~~~~~~~~~~~~~~~~~~ 34 | 35 | Look through the GitHub issues for features. Anything tagged with "enhancement" 36 | and "help wanted" is open to whoever wants to implement it. 37 | 38 | Write Documentation 39 | ~~~~~~~~~~~~~~~~~~~ 40 | 41 | pyhecdss could always use more documentation, whether as part of the 42 | official pyhecdss docs, in docstrings, or even on the web in blog posts, 43 | articles, and such. 44 | 45 | Submit Feedback 46 | ~~~~~~~~~~~~~~~ 47 | 48 | The best way to send feedback is to file an issue at https://github.com/CADWRDeltaModeling/pyhecdss/issues. 49 | 50 | If you are proposing a feature: 51 | 52 | * Explain in detail how it would work. 53 | * Keep the scope as narrow as possible, to make it easier to implement. 54 | * Remember that this is a volunteer-driven project, and that contributions 55 | are welcome :) 56 | 57 | Get Started! 58 | ------------ 59 | 60 | Ready to contribute? Here's how to set up `pyhecdss` for local development. 61 | 62 | 1. Fork the `pyhecdss` repo on GitHub. 63 | 2. Clone your fork locally:: 64 | 65 | $ git clone git@github.com:your_name_here/pyhecdss.git 66 | 67 | 3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:: 68 | 69 | $ mkvirtualenv pyhecdss 70 | $ cd pyhecdss/ 71 | $ python setup.py develop 72 | 73 | 4. Create a branch for local development:: 74 | 75 | $ git checkout -b name-of-your-bugfix-or-feature 76 | 77 | Now you can make your changes locally. 78 | 79 | 5. When you're done making changes, check that your changes pass flake8 and the 80 | tests, including testing other Python versions with tox:: 81 | 82 | $ flake8 pyhecdss tests 83 | $ python setup.py test or py.test 84 | $ tox 85 | 86 | To get flake8 and tox, just pip install them into your virtualenv. 87 | 88 | 6. Commit your changes and push your branch to GitHub:: 89 | 90 | $ git add . 91 | $ git commit -m "Your detailed description of your changes." 92 | $ git push origin name-of-your-bugfix-or-feature 93 | 94 | 7. Submit a pull request through the GitHub website. 95 | 96 | Pull Request Guidelines 97 | ----------------------- 98 | 99 | Before you submit a pull request, check that it meets these guidelines: 100 | 101 | 1. The pull request should include tests. 102 | 2. If the pull request adds functionality, the docs should be updated. Put 103 | your new functionality into a function with a docstring, and add the 104 | feature to the list in README.rst. 105 | 3. The pull request should work for Python 2.7, 3.4, 3.5 and 3.6, and for PyPy. Check 106 | https://travis-ci.org/CADWRDeltaModeling/pyhecdss/pull_requests 107 | and make sure that the tests pass for all supported Python versions. 108 | 109 | Tips 110 | ---- 111 | 112 | To run a subset of tests:: 113 | 114 | $ py.test tests.test_pyhecdss 115 | 116 | 117 | Deploying 118 | --------- 119 | 120 | A reminder for the maintainers on how to deploy. 121 | Make sure all your changes are committed (including an entry in HISTORY.rst). 122 | Then run:: 123 | 124 | $ bumpversion patch # possible: major / minor / patch 125 | $ git push 126 | $ git push --tags 127 | 128 | Travis will then deploy to PyPI if tests pass. 129 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019, Nicky Sandhu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include AUTHORS.rst 2 | include CONTRIBUTING.rst 3 | include HISTORY.rst 4 | include LICENSE 5 | include README.rst 6 | 7 | recursive-include tests * 8 | recursive-exclude * __pycache__ 9 | recursive-exclude * *.py[co] 10 | 11 | recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif 12 | include versioneer.py 13 | include pyhecdss/_version.py 14 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: clean clean-test clean-pyc clean-build docs help 2 | .DEFAULT_GOAL := help 3 | 4 | define BROWSER_PYSCRIPT 5 | import os, webbrowser, sys 6 | 7 | try: 8 | from urllib import pathname2url 9 | except: 10 | from urllib.request import pathname2url 11 | 12 | webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1]))) 13 | endef 14 | export BROWSER_PYSCRIPT 15 | 16 | define PRINT_HELP_PYSCRIPT 17 | import re, sys 18 | 19 | for line in sys.stdin: 20 | match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line) 21 | if match: 22 | target, help = match.groups() 23 | print("%-20s %s" % (target, help)) 24 | endef 25 | export PRINT_HELP_PYSCRIPT 26 | 27 | BROWSER := python -c "$$BROWSER_PYSCRIPT" 28 | 29 | help: 30 | @python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST) 31 | 32 | clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts 33 | 34 | clean-build: ## remove build artifacts 35 | rm -fr build/ 36 | rm -fr dist/ 37 | rm -fr .eggs/ 38 | find . -name '*.egg-info' -exec rm -fr {} + 39 | find . -name '*.egg' -exec rm -f {} + 40 | 41 | clean-pyc: ## remove Python file artifacts 42 | find . -name '*.pyc' -exec rm -f {} + 43 | find . -name '*.pyo' -exec rm -f {} + 44 | find . -name '*~' -exec rm -f {} + 45 | find . -name '__pycache__' -exec rm -fr {} + 46 | 47 | clean-test: ## remove test and coverage artifacts 48 | rm -fr .tox/ 49 | rm -f .coverage 50 | rm -fr htmlcov/ 51 | rm -fr .pytest_cache 52 | 53 | lint: ## check style with flake8 54 | flake8 pyhecdss tests 55 | 56 | test: ## run tests quickly with the default Python 57 | py.test 58 | 59 | test-all: ## run tests on every Python version with tox 60 | tox 61 | 62 | coverage: ## check code coverage quickly with the default Python 63 | coverage run --source pyhecdss -m pytest 64 | coverage report -m 65 | coverage html 66 | $(BROWSER) htmlcov/index.html 67 | 68 | docs: ## generate Sphinx HTML documentation, including API docs 69 | rm -f docs/pyhecdss.rst 70 | rm -f docs/modules.rst 71 | sphinx-apidoc -o docs/ pyhecdss 72 | $(MAKE) -C docs clean 73 | $(MAKE) -C docs html 74 | $(BROWSER) docs/_build/html/index.html 75 | 76 | servedocs: docs ## compile the docs watching for changes 77 | watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D . 78 | 79 | release: dist ## package and upload a release 80 | twine upload dist/* 81 | 82 | dist: clean ## builds source and wheel package 83 | python setup.py sdist 84 | python setup.py bdist_wheel 85 | ls -l dist 86 | 87 | install: clean ## install the package to the active Python's site-packages 88 | python setup.py install 89 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | ======== 2 | pyhecdss 3 | ======== 4 | 5 | > **Note:** This project only supports **DSS version 6** and now recommends users to `HEC-DSS Python`_ version 7 and higher 6 | 7 | For reading/writing HEC-DSS files [https://www.hec.usace.army.mil/software/hec-dss/] 8 | HEC-DSS is an ancient database used by the Army Corps of Engineers and prevalent 9 | in water related models. This module is a bridge to read and write time series 10 | data from this data format and read it into pandas DataFrame 11 | 12 | * Free software: MIT license 13 | * Documentation: https://cadwrdeltamodeling.github.io/pyhecdss/ 14 | 15 | 16 | Installation 17 | ------------ 18 | > **Warning:** pip installs do not work. Please use conda installs from the cadwr-dms channel 19 | 20 | ``conda create -c conda-forge -c cadwr-dms -n test_pyhecdss python=3.12 pyhecdss`` 21 | 22 | Features 23 | -------- 24 | 25 | * Open and close DSS files 26 | * Read catalog of DSS files as pandas DataFrame 27 | * Read and write time series from DSS files 28 | 29 | Limitations 30 | ----------- 31 | 32 | * Only support for Python 3 - 64 bit for windows and linux 33 | * Relies on pre-compiled libraries the source distribution of which is not allowed 34 | 35 | Credits 36 | ------- 37 | 38 | This package wraps the `HEC-DSS Software`_ using the `Swig`_ library. 39 | 40 | This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template. 41 | 42 | .. _Cookiecutter: https://github.com/audreyr/cookiecutter 43 | .. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage 44 | .. _`HEC-DSS Software`: https://www.hec.usace.army.mil/software/hec-dss/ 45 | .. _`HEC-DSS Python`: https://github.com/HydrologicEngineeringCenter/hec-dss-python 46 | .. _Swig: http://www.swig.org/ 47 | -------------------------------------------------------------------------------- /build_all.bat: -------------------------------------------------------------------------------- 1 | 2 | set PATH=d:\Programs\swigwin-4.0.0;%PATH% 3 | python setup.py build_ext --inplace 4 | -------------------------------------------------------------------------------- /conda.recipe/bld.bat: -------------------------------------------------------------------------------- 1 | REM set PATH=d:\Programs\swigwin-4.0.0;%PATH% 2 | python setup.py build_ext --inplace 3 | python setup.py install --single-version-externally-managed --record=record.txt 4 | if errorlevel 1 exit 1 5 | -------------------------------------------------------------------------------- /conda.recipe/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | python setup.py build_ext --inplace 3 | python setup.py install --single-version-externally-managed --record=record.txt # [unix] 4 | -------------------------------------------------------------------------------- /conda.recipe/conda_build_config.yaml: -------------------------------------------------------------------------------- 1 | python: 2 | - '3.11' 3 | - '3.12' 4 | - '3.13' 5 | numpy: 6 | - '2' 7 | - '2' 8 | - '2' 9 | zip_keys: 10 | - python 11 | - numpy -------------------------------------------------------------------------------- /conda.recipe/meta.yaml: -------------------------------------------------------------------------------- 1 | {% set name = "pyhecdss" %} 2 | {% set data = load_setup_py_data() %} 3 | 4 | package: 5 | name: "{{ name|lower }}" 6 | version: "{{ data['version'] }}" 7 | 8 | source: 9 | path: .. 10 | 11 | build: 12 | number: 0 13 | #skip: true 14 | 15 | requirements: 16 | build: 17 | - python {{ python }} 18 | - setuptools 19 | - pytest 20 | - swig 21 | # dependencies are defined in setup.py 22 | {% for dep in data['install_requires'] %} 23 | - {{ dep.lower() }} 24 | {% endfor %} 25 | 26 | run: 27 | - {{ pin_compatible('python', lower_bound='3.5', upper_bound='4.0') }} 28 | # dependencies are defined in setup.py 29 | {% for dep in data['install_requires'] %} 30 | - {{ dep.lower() }} 31 | {% endfor %} 32 | 33 | test: 34 | imports: 35 | - pyhecdss 36 | source_files: 37 | - tests 38 | requires: 39 | - pytest 40 | - pytest-cov 41 | commands: 42 | - (setlocal && cd tests && pytest && endlocal) # [win] 43 | - (cd tests; pytest) # [unix] 44 | about: 45 | home: "https://github.com/CADWRDeltaModeling/pyhecdss" 46 | license: "MIT" 47 | license_family: "MIT" 48 | summary: "Read HECDSS timeseries as pandas DataFrame" 49 | -------------------------------------------------------------------------------- /docs/.nojekyll: -------------------------------------------------------------------------------- 1 | # Empty file 2 | -------------------------------------------------------------------------------- /docs/doctrees/authors.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/doctrees/authors.doctree -------------------------------------------------------------------------------- /docs/doctrees/contributing.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/doctrees/contributing.doctree -------------------------------------------------------------------------------- /docs/doctrees/environment.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/doctrees/environment.pickle -------------------------------------------------------------------------------- /docs/doctrees/history.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/doctrees/history.doctree -------------------------------------------------------------------------------- /docs/doctrees/index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/doctrees/index.doctree -------------------------------------------------------------------------------- /docs/doctrees/installation.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/doctrees/installation.doctree -------------------------------------------------------------------------------- /docs/doctrees/modules.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/doctrees/modules.doctree -------------------------------------------------------------------------------- /docs/doctrees/nbsphinx/notebooks_sample_dss_files_19_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/doctrees/nbsphinx/notebooks_sample_dss_files_19_0.png -------------------------------------------------------------------------------- /docs/doctrees/nbsphinx/notebooks_sample_dss_files_19_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/doctrees/nbsphinx/notebooks_sample_dss_files_19_1.png -------------------------------------------------------------------------------- /docs/doctrees/nbsphinx/notebooks_sample_dss_files_21_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/doctrees/nbsphinx/notebooks_sample_dss_files_21_0.png -------------------------------------------------------------------------------- /docs/doctrees/nbsphinx/notebooks_sample_dss_files_21_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/doctrees/nbsphinx/notebooks_sample_dss_files_21_1.png -------------------------------------------------------------------------------- /docs/doctrees/nbsphinx/notebooks_sample_dss_files_25_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/doctrees/nbsphinx/notebooks_sample_dss_files_25_0.png -------------------------------------------------------------------------------- /docs/doctrees/nbsphinx/notebooks_sample_dss_files_25_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/doctrees/nbsphinx/notebooks_sample_dss_files_25_1.png -------------------------------------------------------------------------------- /docs/doctrees/nbsphinx/notebooks_sample_dss_files_26_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/doctrees/nbsphinx/notebooks_sample_dss_files_26_0.png -------------------------------------------------------------------------------- /docs/doctrees/nbsphinx/notebooks_sample_dss_files_26_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/doctrees/nbsphinx/notebooks_sample_dss_files_26_1.png -------------------------------------------------------------------------------- /docs/doctrees/nbsphinx/notebooks_sample_dss_files_36_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/doctrees/nbsphinx/notebooks_sample_dss_files_36_0.png -------------------------------------------------------------------------------- /docs/doctrees/nbsphinx/notebooks_sample_dss_files_36_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/doctrees/nbsphinx/notebooks_sample_dss_files_36_1.png -------------------------------------------------------------------------------- /docs/doctrees/notebooks/sample_dss_files.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/doctrees/notebooks/sample_dss_files.doctree -------------------------------------------------------------------------------- /docs/doctrees/pyhecdss.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/doctrees/pyhecdss.doctree -------------------------------------------------------------------------------- /docs/doctrees/readme.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/doctrees/readme.doctree -------------------------------------------------------------------------------- /docs/doctrees/usage.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/doctrees/usage.doctree -------------------------------------------------------------------------------- /docs/html/.buildinfo: -------------------------------------------------------------------------------- 1 | # Sphinx build info version 1 2 | # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. 3 | config: 89cf9f1f2c3daa22731db6f00d34b34c 4 | tags: 645f666f9bcd5a90fca523b33c5a78b7 5 | -------------------------------------------------------------------------------- /docs/html/_images/notebooks_sample_dss_files_19_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/html/_images/notebooks_sample_dss_files_19_0.png -------------------------------------------------------------------------------- /docs/html/_images/notebooks_sample_dss_files_19_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/html/_images/notebooks_sample_dss_files_19_1.png -------------------------------------------------------------------------------- /docs/html/_images/notebooks_sample_dss_files_21_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/html/_images/notebooks_sample_dss_files_21_0.png -------------------------------------------------------------------------------- /docs/html/_images/notebooks_sample_dss_files_21_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/html/_images/notebooks_sample_dss_files_21_1.png -------------------------------------------------------------------------------- /docs/html/_images/notebooks_sample_dss_files_25_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/html/_images/notebooks_sample_dss_files_25_0.png -------------------------------------------------------------------------------- /docs/html/_images/notebooks_sample_dss_files_25_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/html/_images/notebooks_sample_dss_files_25_1.png -------------------------------------------------------------------------------- /docs/html/_images/notebooks_sample_dss_files_26_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/html/_images/notebooks_sample_dss_files_26_0.png -------------------------------------------------------------------------------- /docs/html/_images/notebooks_sample_dss_files_26_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/html/_images/notebooks_sample_dss_files_26_1.png -------------------------------------------------------------------------------- /docs/html/_images/notebooks_sample_dss_files_36_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/html/_images/notebooks_sample_dss_files_36_0.png -------------------------------------------------------------------------------- /docs/html/_images/notebooks_sample_dss_files_36_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/html/_images/notebooks_sample_dss_files_36_1.png -------------------------------------------------------------------------------- /docs/html/_modules/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Overview: module code — pyhecdss 1.1.2+5.ga82763a.dirty documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 |
29 |
30 | 31 | 32 |
33 | 34 |

All modules for which code is available

35 | 37 | 38 |
39 | 40 |
41 |
42 | 94 |
95 |
96 | 104 | 105 | 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /docs/html/_sources/authors.rst.txt: -------------------------------------------------------------------------------- 1 | .. include:: ../AUTHORS.rst 2 | -------------------------------------------------------------------------------- /docs/html/_sources/contributing.rst.txt: -------------------------------------------------------------------------------- 1 | .. include:: ../CONTRIBUTING.rst 2 | -------------------------------------------------------------------------------- /docs/html/_sources/history.rst.txt: -------------------------------------------------------------------------------- 1 | .. include:: ../CHANGELOG.rst 2 | -------------------------------------------------------------------------------- /docs/html/_sources/index.rst.txt: -------------------------------------------------------------------------------- 1 | Welcome to pyhecdss's documentation! 2 | ====================================== 3 | .. toctree:: 4 | :maxdepth: 2 5 | :caption: Contents: 6 | 7 | readme 8 | installation 9 | usage 10 | notebooks/sample_dss_files.ipynb 11 | notebooks/period_vs_instval.ipynb 12 | modules 13 | contributing 14 | authors 15 | history 16 | 17 | Indices and tables 18 | ================== 19 | * :ref:`genindex` 20 | * :ref:`modindex` 21 | * :ref:`search` 22 | -------------------------------------------------------------------------------- /docs/html/_sources/installation.rst.txt: -------------------------------------------------------------------------------- 1 | .. highlight:: shell 2 | 3 | ============ 4 | Installation 5 | ============ 6 | 7 | 8 | Stable release 9 | -------------- 10 | 11 | To install pyhecdss, run this command in your terminal: 12 | 13 | .. code-block:: console 14 | 15 | $ conda install -c cadwr-dms pyhecdss 16 | $ conda install -c anaconda libgfortran # May be needed on linux if libgfortran is not installed along with gcc 17 | 18 | This is the preferred method to install pyhecdss, as it will always install the most recent stable release. 19 | 20 | If you don't have `conda`_ installed, this `Python installation guide`_ can guide 21 | you through the process. 22 | 23 | .. _conda: https://docs.conda.io/projects/conda/en/latest/user-guide/install/ 24 | .. _Python installation guide: http://docs.python-guide.org/en/latest/starting/installation/ 25 | 26 | 27 | From sources 28 | ------------ 29 | 30 | The sources for pyhecdss can be downloaded from the `Github repo`_. 31 | 32 | You can either clone the public repository: 33 | 34 | .. code-block:: console 35 | 36 | $ git clone https://github.com/CADWRDeltaModeling/pyhecdss.git 37 | 38 | Or download the `tarball`_: 39 | 40 | .. code-block:: console 41 | 42 | $ curl -OL https://github.com/CADWRDeltaModeling/pyhecdss/tarball/master 43 | 44 | Once you have a copy of the source, you can install it with: 45 | 46 | .. code-block:: console 47 | 48 | $ python setup.py install 49 | 50 | This library has dependencies on Intel Fortran AND Intel Compiler for Windows and Intel Parallel Composer libraries. You will need the following 51 | libraries 52 | 53 | .. code-block:: 54 | 55 | setup.py changes -- 56 | libs = ['extensions/heclib6-VE', 'extensions/ifconsol','extensions/libifcoremt', 57 | 'extensions/libifport','extensions/libmmt','extensions/libirc', 58 | 'extensions/svml_disp','extensions/IFWIN','legacy_stdio_definitions', 59 | 'User32', 'gdi32', ] 60 | 61 | .. _Github repo: https://github.com/CADWRDeltaModeling/pyhecdss 62 | .. _tarball: https://github.com/CADWRDeltaModeling/pyhecdss/tarball/master 63 | -------------------------------------------------------------------------------- /docs/html/_sources/modules.rst.txt: -------------------------------------------------------------------------------- 1 | pyhecdss 2 | ======== 3 | 4 | .. toctree:: 5 | :maxdepth: 4 6 | 7 | pyhecdss 8 | -------------------------------------------------------------------------------- /docs/html/_sources/pyhecdss.rst.txt: -------------------------------------------------------------------------------- 1 | pyhecdss package 2 | ================ 3 | 4 | Submodules 5 | ---------- 6 | 7 | pyhecdss.pyhecdss module 8 | ------------------------ 9 | 10 | .. automodule:: pyhecdss.pyhecdss 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | Module contents 16 | --------------- 17 | 18 | .. automodule:: pyhecdss 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | -------------------------------------------------------------------------------- /docs/html/_sources/readme.rst.txt: -------------------------------------------------------------------------------- 1 | .. include:: ../README.rst 2 | -------------------------------------------------------------------------------- /docs/html/_sources/usage.rst.txt: -------------------------------------------------------------------------------- 1 | ===== 2 | Usage 3 | ===== 4 | 5 | To use pyhecdss in a project:: 6 | 7 | import pyhecdss 8 | 9 | See the sample notebook for detailed demonstration 10 | -------------------------------------------------------------------------------- /docs/html/_static/custom.css: -------------------------------------------------------------------------------- 1 | /* This file intentionally left blank. */ 2 | -------------------------------------------------------------------------------- /docs/html/_static/doctools.js: -------------------------------------------------------------------------------- 1 | /* 2 | * doctools.js 3 | * ~~~~~~~~~~~ 4 | * 5 | * Sphinx JavaScript utilities for all documentation. 6 | * 7 | * :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS. 8 | * :license: BSD, see LICENSE for details. 9 | * 10 | */ 11 | 12 | /** 13 | * select a different prefix for underscore 14 | */ 15 | $u = _.noConflict(); 16 | 17 | /** 18 | * make the code below compatible with browsers without 19 | * an installed firebug like debugger 20 | if (!window.console || !console.firebug) { 21 | var names = ["log", "debug", "info", "warn", "error", "assert", "dir", 22 | "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", 23 | "profile", "profileEnd"]; 24 | window.console = {}; 25 | for (var i = 0; i < names.length; ++i) 26 | window.console[names[i]] = function() {}; 27 | } 28 | */ 29 | 30 | /** 31 | * small helper function to urldecode strings 32 | * 33 | * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent#Decoding_query_parameters_from_a_URL 34 | */ 35 | jQuery.urldecode = function(x) { 36 | if (!x) { 37 | return x 38 | } 39 | return decodeURIComponent(x.replace(/\+/g, ' ')); 40 | }; 41 | 42 | /** 43 | * small helper function to urlencode strings 44 | */ 45 | jQuery.urlencode = encodeURIComponent; 46 | 47 | /** 48 | * This function returns the parsed url parameters of the 49 | * current request. Multiple values per key are supported, 50 | * it will always return arrays of strings for the value parts. 51 | */ 52 | jQuery.getQueryParameters = function(s) { 53 | if (typeof s === 'undefined') 54 | s = document.location.search; 55 | var parts = s.substr(s.indexOf('?') + 1).split('&'); 56 | var result = {}; 57 | for (var i = 0; i < parts.length; i++) { 58 | var tmp = parts[i].split('=', 2); 59 | var key = jQuery.urldecode(tmp[0]); 60 | var value = jQuery.urldecode(tmp[1]); 61 | if (key in result) 62 | result[key].push(value); 63 | else 64 | result[key] = [value]; 65 | } 66 | return result; 67 | }; 68 | 69 | /** 70 | * highlight a given string on a jquery object by wrapping it in 71 | * span elements with the given class name. 72 | */ 73 | jQuery.fn.highlightText = function(text, className) { 74 | function highlight(node, addItems) { 75 | if (node.nodeType === 3) { 76 | var val = node.nodeValue; 77 | var pos = val.toLowerCase().indexOf(text); 78 | if (pos >= 0 && 79 | !jQuery(node.parentNode).hasClass(className) && 80 | !jQuery(node.parentNode).hasClass("nohighlight")) { 81 | var span; 82 | var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg"); 83 | if (isInSVG) { 84 | span = document.createElementNS("http://www.w3.org/2000/svg", "tspan"); 85 | } else { 86 | span = document.createElement("span"); 87 | span.className = className; 88 | } 89 | span.appendChild(document.createTextNode(val.substr(pos, text.length))); 90 | node.parentNode.insertBefore(span, node.parentNode.insertBefore( 91 | document.createTextNode(val.substr(pos + text.length)), 92 | node.nextSibling)); 93 | node.nodeValue = val.substr(0, pos); 94 | if (isInSVG) { 95 | var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"); 96 | var bbox = node.parentElement.getBBox(); 97 | rect.x.baseVal.value = bbox.x; 98 | rect.y.baseVal.value = bbox.y; 99 | rect.width.baseVal.value = bbox.width; 100 | rect.height.baseVal.value = bbox.height; 101 | rect.setAttribute('class', className); 102 | addItems.push({ 103 | "parent": node.parentNode, 104 | "target": rect}); 105 | } 106 | } 107 | } 108 | else if (!jQuery(node).is("button, select, textarea")) { 109 | jQuery.each(node.childNodes, function() { 110 | highlight(this, addItems); 111 | }); 112 | } 113 | } 114 | var addItems = []; 115 | var result = this.each(function() { 116 | highlight(this, addItems); 117 | }); 118 | for (var i = 0; i < addItems.length; ++i) { 119 | jQuery(addItems[i].parent).before(addItems[i].target); 120 | } 121 | return result; 122 | }; 123 | 124 | /* 125 | * backward compatibility for jQuery.browser 126 | * This will be supported until firefox bug is fixed. 127 | */ 128 | if (!jQuery.browser) { 129 | jQuery.uaMatch = function(ua) { 130 | ua = ua.toLowerCase(); 131 | 132 | var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || 133 | /(webkit)[ \/]([\w.]+)/.exec(ua) || 134 | /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || 135 | /(msie) ([\w.]+)/.exec(ua) || 136 | ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || 137 | []; 138 | 139 | return { 140 | browser: match[ 1 ] || "", 141 | version: match[ 2 ] || "0" 142 | }; 143 | }; 144 | jQuery.browser = {}; 145 | jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true; 146 | } 147 | 148 | /** 149 | * Small JavaScript module for the documentation. 150 | */ 151 | var Documentation = { 152 | 153 | init : function() { 154 | this.fixFirefoxAnchorBug(); 155 | this.highlightSearchWords(); 156 | this.initIndexTable(); 157 | if (DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) { 158 | this.initOnKeyListeners(); 159 | } 160 | }, 161 | 162 | /** 163 | * i18n support 164 | */ 165 | TRANSLATIONS : {}, 166 | PLURAL_EXPR : function(n) { return n === 1 ? 0 : 1; }, 167 | LOCALE : 'unknown', 168 | 169 | // gettext and ngettext don't access this so that the functions 170 | // can safely bound to a different name (_ = Documentation.gettext) 171 | gettext : function(string) { 172 | var translated = Documentation.TRANSLATIONS[string]; 173 | if (typeof translated === 'undefined') 174 | return string; 175 | return (typeof translated === 'string') ? translated : translated[0]; 176 | }, 177 | 178 | ngettext : function(singular, plural, n) { 179 | var translated = Documentation.TRANSLATIONS[singular]; 180 | if (typeof translated === 'undefined') 181 | return (n == 1) ? singular : plural; 182 | return translated[Documentation.PLURALEXPR(n)]; 183 | }, 184 | 185 | addTranslations : function(catalog) { 186 | for (var key in catalog.messages) 187 | this.TRANSLATIONS[key] = catalog.messages[key]; 188 | this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')'); 189 | this.LOCALE = catalog.locale; 190 | }, 191 | 192 | /** 193 | * add context elements like header anchor links 194 | */ 195 | addContextElements : function() { 196 | $('div[id] > :header:first').each(function() { 197 | $('\u00B6'). 198 | attr('href', '#' + this.id). 199 | attr('title', _('Permalink to this headline')). 200 | appendTo(this); 201 | }); 202 | $('dt[id]').each(function() { 203 | $('\u00B6'). 204 | attr('href', '#' + this.id). 205 | attr('title', _('Permalink to this definition')). 206 | appendTo(this); 207 | }); 208 | }, 209 | 210 | /** 211 | * workaround a firefox stupidity 212 | * see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075 213 | */ 214 | fixFirefoxAnchorBug : function() { 215 | if (document.location.hash && $.browser.mozilla) 216 | window.setTimeout(function() { 217 | document.location.href += ''; 218 | }, 10); 219 | }, 220 | 221 | /** 222 | * highlight the search words provided in the url in the text 223 | */ 224 | highlightSearchWords : function() { 225 | var params = $.getQueryParameters(); 226 | var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; 227 | if (terms.length) { 228 | var body = $('div.body'); 229 | if (!body.length) { 230 | body = $('body'); 231 | } 232 | window.setTimeout(function() { 233 | $.each(terms, function() { 234 | body.highlightText(this.toLowerCase(), 'highlighted'); 235 | }); 236 | }, 10); 237 | $('') 239 | .appendTo($('#searchbox')); 240 | } 241 | }, 242 | 243 | /** 244 | * init the domain index toggle buttons 245 | */ 246 | initIndexTable : function() { 247 | var togglers = $('img.toggler').click(function() { 248 | var src = $(this).attr('src'); 249 | var idnum = $(this).attr('id').substr(7); 250 | $('tr.cg-' + idnum).toggle(); 251 | if (src.substr(-9) === 'minus.png') 252 | $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); 253 | else 254 | $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); 255 | }).css('display', ''); 256 | if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { 257 | togglers.click(); 258 | } 259 | }, 260 | 261 | /** 262 | * helper function to hide the search marks again 263 | */ 264 | hideSearchWords : function() { 265 | $('#searchbox .highlight-link').fadeOut(300); 266 | $('span.highlighted').removeClass('highlighted'); 267 | }, 268 | 269 | /** 270 | * make the url absolute 271 | */ 272 | makeURL : function(relativeURL) { 273 | return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; 274 | }, 275 | 276 | /** 277 | * get the current relative url 278 | */ 279 | getCurrentURL : function() { 280 | var path = document.location.pathname; 281 | var parts = path.split(/\//); 282 | $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { 283 | if (this === '..') 284 | parts.pop(); 285 | }); 286 | var url = parts.join('/'); 287 | return path.substring(url.lastIndexOf('/') + 1, path.length - 1); 288 | }, 289 | 290 | initOnKeyListeners: function() { 291 | $(document).keydown(function(event) { 292 | var activeElementType = document.activeElement.tagName; 293 | // don't navigate when in search box, textarea, dropdown or button 294 | if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT' 295 | && activeElementType !== 'BUTTON' && !event.altKey && !event.ctrlKey && !event.metaKey 296 | && !event.shiftKey) { 297 | switch (event.keyCode) { 298 | case 37: // left 299 | var prevHref = $('link[rel="prev"]').prop('href'); 300 | if (prevHref) { 301 | window.location.href = prevHref; 302 | return false; 303 | } 304 | case 39: // right 305 | var nextHref = $('link[rel="next"]').prop('href'); 306 | if (nextHref) { 307 | window.location.href = nextHref; 308 | return false; 309 | } 310 | } 311 | } 312 | }); 313 | } 314 | }; 315 | 316 | // quick alias for translations 317 | _ = Documentation.gettext; 318 | 319 | $(document).ready(function() { 320 | Documentation.init(); 321 | }); 322 | -------------------------------------------------------------------------------- /docs/html/_static/documentation_options.js: -------------------------------------------------------------------------------- 1 | var DOCUMENTATION_OPTIONS = { 2 | URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), 3 | VERSION: '1.1.2+5.ga82763a.dirty', 4 | LANGUAGE: 'None', 5 | COLLAPSE_INDEX: false, 6 | BUILDER: 'html', 7 | FILE_SUFFIX: '.html', 8 | LINK_SUFFIX: '.html', 9 | HAS_SOURCE: true, 10 | SOURCELINK_SUFFIX: '.txt', 11 | NAVIGATION_WITH_KEYS: false 12 | }; -------------------------------------------------------------------------------- /docs/html/_static/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/html/_static/file.png -------------------------------------------------------------------------------- /docs/html/_static/language_data.js: -------------------------------------------------------------------------------- 1 | /* 2 | * language_data.js 3 | * ~~~~~~~~~~~~~~~~ 4 | * 5 | * This script contains the language-specific data used by searchtools.js, 6 | * namely the list of stopwords, stemmer, scorer and splitter. 7 | * 8 | * :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS. 9 | * :license: BSD, see LICENSE for details. 10 | * 11 | */ 12 | 13 | var stopwords = ["a","and","are","as","at","be","but","by","for","if","in","into","is","it","near","no","not","of","on","or","such","that","the","their","then","there","these","they","this","to","was","will","with"]; 14 | 15 | 16 | /* Non-minified version is copied as a separate JS file, is available */ 17 | 18 | /** 19 | * Porter Stemmer 20 | */ 21 | var Stemmer = function() { 22 | 23 | var step2list = { 24 | ational: 'ate', 25 | tional: 'tion', 26 | enci: 'ence', 27 | anci: 'ance', 28 | izer: 'ize', 29 | bli: 'ble', 30 | alli: 'al', 31 | entli: 'ent', 32 | eli: 'e', 33 | ousli: 'ous', 34 | ization: 'ize', 35 | ation: 'ate', 36 | ator: 'ate', 37 | alism: 'al', 38 | iveness: 'ive', 39 | fulness: 'ful', 40 | ousness: 'ous', 41 | aliti: 'al', 42 | iviti: 'ive', 43 | biliti: 'ble', 44 | logi: 'log' 45 | }; 46 | 47 | var step3list = { 48 | icate: 'ic', 49 | ative: '', 50 | alize: 'al', 51 | iciti: 'ic', 52 | ical: 'ic', 53 | ful: '', 54 | ness: '' 55 | }; 56 | 57 | var c = "[^aeiou]"; // consonant 58 | var v = "[aeiouy]"; // vowel 59 | var C = c + "[^aeiouy]*"; // consonant sequence 60 | var V = v + "[aeiou]*"; // vowel sequence 61 | 62 | var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 63 | var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 64 | var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 65 | var s_v = "^(" + C + ")?" + v; // vowel in stem 66 | 67 | this.stemWord = function (w) { 68 | var stem; 69 | var suffix; 70 | var firstch; 71 | var origword = w; 72 | 73 | if (w.length < 3) 74 | return w; 75 | 76 | var re; 77 | var re2; 78 | var re3; 79 | var re4; 80 | 81 | firstch = w.substr(0,1); 82 | if (firstch == "y") 83 | w = firstch.toUpperCase() + w.substr(1); 84 | 85 | // Step 1a 86 | re = /^(.+?)(ss|i)es$/; 87 | re2 = /^(.+?)([^s])s$/; 88 | 89 | if (re.test(w)) 90 | w = w.replace(re,"$1$2"); 91 | else if (re2.test(w)) 92 | w = w.replace(re2,"$1$2"); 93 | 94 | // Step 1b 95 | re = /^(.+?)eed$/; 96 | re2 = /^(.+?)(ed|ing)$/; 97 | if (re.test(w)) { 98 | var fp = re.exec(w); 99 | re = new RegExp(mgr0); 100 | if (re.test(fp[1])) { 101 | re = /.$/; 102 | w = w.replace(re,""); 103 | } 104 | } 105 | else if (re2.test(w)) { 106 | var fp = re2.exec(w); 107 | stem = fp[1]; 108 | re2 = new RegExp(s_v); 109 | if (re2.test(stem)) { 110 | w = stem; 111 | re2 = /(at|bl|iz)$/; 112 | re3 = new RegExp("([^aeiouylsz])\\1$"); 113 | re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); 114 | if (re2.test(w)) 115 | w = w + "e"; 116 | else if (re3.test(w)) { 117 | re = /.$/; 118 | w = w.replace(re,""); 119 | } 120 | else if (re4.test(w)) 121 | w = w + "e"; 122 | } 123 | } 124 | 125 | // Step 1c 126 | re = /^(.+?)y$/; 127 | if (re.test(w)) { 128 | var fp = re.exec(w); 129 | stem = fp[1]; 130 | re = new RegExp(s_v); 131 | if (re.test(stem)) 132 | w = stem + "i"; 133 | } 134 | 135 | // Step 2 136 | re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; 137 | if (re.test(w)) { 138 | var fp = re.exec(w); 139 | stem = fp[1]; 140 | suffix = fp[2]; 141 | re = new RegExp(mgr0); 142 | if (re.test(stem)) 143 | w = stem + step2list[suffix]; 144 | } 145 | 146 | // Step 3 147 | re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; 148 | if (re.test(w)) { 149 | var fp = re.exec(w); 150 | stem = fp[1]; 151 | suffix = fp[2]; 152 | re = new RegExp(mgr0); 153 | if (re.test(stem)) 154 | w = stem + step3list[suffix]; 155 | } 156 | 157 | // Step 4 158 | re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; 159 | re2 = /^(.+?)(s|t)(ion)$/; 160 | if (re.test(w)) { 161 | var fp = re.exec(w); 162 | stem = fp[1]; 163 | re = new RegExp(mgr1); 164 | if (re.test(stem)) 165 | w = stem; 166 | } 167 | else if (re2.test(w)) { 168 | var fp = re2.exec(w); 169 | stem = fp[1] + fp[2]; 170 | re2 = new RegExp(mgr1); 171 | if (re2.test(stem)) 172 | w = stem; 173 | } 174 | 175 | // Step 5 176 | re = /^(.+?)e$/; 177 | if (re.test(w)) { 178 | var fp = re.exec(w); 179 | stem = fp[1]; 180 | re = new RegExp(mgr1); 181 | re2 = new RegExp(meq1); 182 | re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); 183 | if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) 184 | w = stem; 185 | } 186 | re = /ll$/; 187 | re2 = new RegExp(mgr1); 188 | if (re.test(w) && re2.test(w)) { 189 | re = /.$/; 190 | w = w.replace(re,""); 191 | } 192 | 193 | // and turn initial Y back to y 194 | if (firstch == "y") 195 | w = firstch.toLowerCase() + w.substr(1); 196 | return w; 197 | } 198 | } 199 | 200 | 201 | 202 | 203 | var splitChars = (function() { 204 | var result = {}; 205 | var singles = [96, 180, 187, 191, 215, 247, 749, 885, 903, 907, 909, 930, 1014, 1648, 206 | 1748, 1809, 2416, 2473, 2481, 2526, 2601, 2609, 2612, 2615, 2653, 2702, 207 | 2706, 2729, 2737, 2740, 2857, 2865, 2868, 2910, 2928, 2948, 2961, 2971, 208 | 2973, 3085, 3089, 3113, 3124, 3213, 3217, 3241, 3252, 3295, 3341, 3345, 209 | 3369, 3506, 3516, 3633, 3715, 3721, 3736, 3744, 3748, 3750, 3756, 3761, 210 | 3781, 3912, 4239, 4347, 4681, 4695, 4697, 4745, 4785, 4799, 4801, 4823, 211 | 4881, 5760, 5901, 5997, 6313, 7405, 8024, 8026, 8028, 8030, 8117, 8125, 212 | 8133, 8181, 8468, 8485, 8487, 8489, 8494, 8527, 11311, 11359, 11687, 11695, 213 | 11703, 11711, 11719, 11727, 11735, 12448, 12539, 43010, 43014, 43019, 43587, 214 | 43696, 43713, 64286, 64297, 64311, 64317, 64319, 64322, 64325, 65141]; 215 | var i, j, start, end; 216 | for (i = 0; i < singles.length; i++) { 217 | result[singles[i]] = true; 218 | } 219 | var ranges = [[0, 47], [58, 64], [91, 94], [123, 169], [171, 177], [182, 184], [706, 709], 220 | [722, 735], [741, 747], [751, 879], [888, 889], [894, 901], [1154, 1161], 221 | [1318, 1328], [1367, 1368], [1370, 1376], [1416, 1487], [1515, 1519], [1523, 1568], 222 | [1611, 1631], [1642, 1645], [1750, 1764], [1767, 1773], [1789, 1790], [1792, 1807], 223 | [1840, 1868], [1958, 1968], [1970, 1983], [2027, 2035], [2038, 2041], [2043, 2047], 224 | [2070, 2073], [2075, 2083], [2085, 2087], [2089, 2307], [2362, 2364], [2366, 2383], 225 | [2385, 2391], [2402, 2405], [2419, 2424], [2432, 2436], [2445, 2446], [2449, 2450], 226 | [2483, 2485], [2490, 2492], [2494, 2509], [2511, 2523], [2530, 2533], [2546, 2547], 227 | [2554, 2564], [2571, 2574], [2577, 2578], [2618, 2648], [2655, 2661], [2672, 2673], 228 | [2677, 2692], [2746, 2748], [2750, 2767], [2769, 2783], [2786, 2789], [2800, 2820], 229 | [2829, 2830], [2833, 2834], [2874, 2876], [2878, 2907], [2914, 2917], [2930, 2946], 230 | [2955, 2957], [2966, 2968], [2976, 2978], [2981, 2983], [2987, 2989], [3002, 3023], 231 | [3025, 3045], [3059, 3076], [3130, 3132], [3134, 3159], [3162, 3167], [3170, 3173], 232 | [3184, 3191], [3199, 3204], [3258, 3260], [3262, 3293], [3298, 3301], [3312, 3332], 233 | [3386, 3388], [3390, 3423], [3426, 3429], [3446, 3449], [3456, 3460], [3479, 3481], 234 | [3518, 3519], [3527, 3584], [3636, 3647], [3655, 3663], [3674, 3712], [3717, 3718], 235 | [3723, 3724], [3726, 3731], [3752, 3753], [3764, 3772], [3774, 3775], [3783, 3791], 236 | [3802, 3803], [3806, 3839], [3841, 3871], [3892, 3903], [3949, 3975], [3980, 4095], 237 | [4139, 4158], [4170, 4175], [4182, 4185], [4190, 4192], [4194, 4196], [4199, 4205], 238 | [4209, 4212], [4226, 4237], [4250, 4255], [4294, 4303], [4349, 4351], [4686, 4687], 239 | [4702, 4703], [4750, 4751], [4790, 4791], [4806, 4807], [4886, 4887], [4955, 4968], 240 | [4989, 4991], [5008, 5023], [5109, 5120], [5741, 5742], [5787, 5791], [5867, 5869], 241 | [5873, 5887], [5906, 5919], [5938, 5951], [5970, 5983], [6001, 6015], [6068, 6102], 242 | [6104, 6107], [6109, 6111], [6122, 6127], [6138, 6159], [6170, 6175], [6264, 6271], 243 | [6315, 6319], [6390, 6399], [6429, 6469], [6510, 6511], [6517, 6527], [6572, 6592], 244 | [6600, 6607], [6619, 6655], [6679, 6687], [6741, 6783], [6794, 6799], [6810, 6822], 245 | [6824, 6916], [6964, 6980], [6988, 6991], [7002, 7042], [7073, 7085], [7098, 7167], 246 | [7204, 7231], [7242, 7244], [7294, 7400], [7410, 7423], [7616, 7679], [7958, 7959], 247 | [7966, 7967], [8006, 8007], [8014, 8015], [8062, 8063], [8127, 8129], [8141, 8143], 248 | [8148, 8149], [8156, 8159], [8173, 8177], [8189, 8303], [8306, 8307], [8314, 8318], 249 | [8330, 8335], [8341, 8449], [8451, 8454], [8456, 8457], [8470, 8472], [8478, 8483], 250 | [8506, 8507], [8512, 8516], [8522, 8525], [8586, 9311], [9372, 9449], [9472, 10101], 251 | [10132, 11263], [11493, 11498], [11503, 11516], [11518, 11519], [11558, 11567], 252 | [11622, 11630], [11632, 11647], [11671, 11679], [11743, 11822], [11824, 12292], 253 | [12296, 12320], [12330, 12336], [12342, 12343], [12349, 12352], [12439, 12444], 254 | [12544, 12548], [12590, 12592], [12687, 12689], [12694, 12703], [12728, 12783], 255 | [12800, 12831], [12842, 12880], [12896, 12927], [12938, 12976], [12992, 13311], 256 | [19894, 19967], [40908, 40959], [42125, 42191], [42238, 42239], [42509, 42511], 257 | [42540, 42559], [42592, 42593], [42607, 42622], [42648, 42655], [42736, 42774], 258 | [42784, 42785], [42889, 42890], [42893, 43002], [43043, 43055], [43062, 43071], 259 | [43124, 43137], [43188, 43215], [43226, 43249], [43256, 43258], [43260, 43263], 260 | [43302, 43311], [43335, 43359], [43389, 43395], [43443, 43470], [43482, 43519], 261 | [43561, 43583], [43596, 43599], [43610, 43615], [43639, 43641], [43643, 43647], 262 | [43698, 43700], [43703, 43704], [43710, 43711], [43715, 43738], [43742, 43967], 263 | [44003, 44015], [44026, 44031], [55204, 55215], [55239, 55242], [55292, 55295], 264 | [57344, 63743], [64046, 64047], [64110, 64111], [64218, 64255], [64263, 64274], 265 | [64280, 64284], [64434, 64466], [64830, 64847], [64912, 64913], [64968, 65007], 266 | [65020, 65135], [65277, 65295], [65306, 65312], [65339, 65344], [65371, 65381], 267 | [65471, 65473], [65480, 65481], [65488, 65489], [65496, 65497]]; 268 | for (i = 0; i < ranges.length; i++) { 269 | start = ranges[i][0]; 270 | end = ranges[i][1]; 271 | for (j = start; j <= end; j++) { 272 | result[j] = true; 273 | } 274 | } 275 | return result; 276 | })(); 277 | 278 | function splitQuery(query) { 279 | var result = []; 280 | var start = -1; 281 | for (var i = 0; i < query.length; i++) { 282 | if (splitChars[query.charCodeAt(i)]) { 283 | if (start !== -1) { 284 | result.push(query.slice(start, i)); 285 | start = -1; 286 | } 287 | } else if (start === -1) { 288 | start = i; 289 | } 290 | } 291 | if (start !== -1) { 292 | result.push(query.slice(start)); 293 | } 294 | return result; 295 | } 296 | 297 | 298 | -------------------------------------------------------------------------------- /docs/html/_static/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/html/_static/minus.png -------------------------------------------------------------------------------- /docs/html/_static/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/html/_static/plus.png -------------------------------------------------------------------------------- /docs/html/_static/pygments.css: -------------------------------------------------------------------------------- 1 | pre { line-height: 125%; } 2 | td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } 3 | span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } 4 | td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } 5 | span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } 6 | .highlight .hll { background-color: #ffffcc } 7 | .highlight { background: #eeffcc; } 8 | .highlight .c { color: #408090; font-style: italic } /* Comment */ 9 | .highlight .err { border: 1px solid #FF0000 } /* Error */ 10 | .highlight .k { color: #007020; font-weight: bold } /* Keyword */ 11 | .highlight .o { color: #666666 } /* Operator */ 12 | .highlight .ch { color: #408090; font-style: italic } /* Comment.Hashbang */ 13 | .highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */ 14 | .highlight .cp { color: #007020 } /* Comment.Preproc */ 15 | .highlight .cpf { color: #408090; font-style: italic } /* Comment.PreprocFile */ 16 | .highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */ 17 | .highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */ 18 | .highlight .gd { color: #A00000 } /* Generic.Deleted */ 19 | .highlight .ge { font-style: italic } /* Generic.Emph */ 20 | .highlight .gr { color: #FF0000 } /* Generic.Error */ 21 | .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ 22 | .highlight .gi { color: #00A000 } /* Generic.Inserted */ 23 | .highlight .go { color: #333333 } /* Generic.Output */ 24 | .highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ 25 | .highlight .gs { font-weight: bold } /* Generic.Strong */ 26 | .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ 27 | .highlight .gt { color: #0044DD } /* Generic.Traceback */ 28 | .highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ 29 | .highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ 30 | .highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */ 31 | .highlight .kp { color: #007020 } /* Keyword.Pseudo */ 32 | .highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */ 33 | .highlight .kt { color: #902000 } /* Keyword.Type */ 34 | .highlight .m { color: #208050 } /* Literal.Number */ 35 | .highlight .s { color: #4070a0 } /* Literal.String */ 36 | .highlight .na { color: #4070a0 } /* Name.Attribute */ 37 | .highlight .nb { color: #007020 } /* Name.Builtin */ 38 | .highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */ 39 | .highlight .no { color: #60add5 } /* Name.Constant */ 40 | .highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */ 41 | .highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */ 42 | .highlight .ne { color: #007020 } /* Name.Exception */ 43 | .highlight .nf { color: #06287e } /* Name.Function */ 44 | .highlight .nl { color: #002070; font-weight: bold } /* Name.Label */ 45 | .highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ 46 | .highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */ 47 | .highlight .nv { color: #bb60d5 } /* Name.Variable */ 48 | .highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */ 49 | .highlight .w { color: #bbbbbb } /* Text.Whitespace */ 50 | .highlight .mb { color: #208050 } /* Literal.Number.Bin */ 51 | .highlight .mf { color: #208050 } /* Literal.Number.Float */ 52 | .highlight .mh { color: #208050 } /* Literal.Number.Hex */ 53 | .highlight .mi { color: #208050 } /* Literal.Number.Integer */ 54 | .highlight .mo { color: #208050 } /* Literal.Number.Oct */ 55 | .highlight .sa { color: #4070a0 } /* Literal.String.Affix */ 56 | .highlight .sb { color: #4070a0 } /* Literal.String.Backtick */ 57 | .highlight .sc { color: #4070a0 } /* Literal.String.Char */ 58 | .highlight .dl { color: #4070a0 } /* Literal.String.Delimiter */ 59 | .highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */ 60 | .highlight .s2 { color: #4070a0 } /* Literal.String.Double */ 61 | .highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */ 62 | .highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */ 63 | .highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */ 64 | .highlight .sx { color: #c65d09 } /* Literal.String.Other */ 65 | .highlight .sr { color: #235388 } /* Literal.String.Regex */ 66 | .highlight .s1 { color: #4070a0 } /* Literal.String.Single */ 67 | .highlight .ss { color: #517918 } /* Literal.String.Symbol */ 68 | .highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */ 69 | .highlight .fm { color: #06287e } /* Name.Function.Magic */ 70 | .highlight .vc { color: #bb60d5 } /* Name.Variable.Class */ 71 | .highlight .vg { color: #bb60d5 } /* Name.Variable.Global */ 72 | .highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */ 73 | .highlight .vm { color: #bb60d5 } /* Name.Variable.Magic */ 74 | .highlight .il { color: #208050 } /* Literal.Number.Integer.Long */ -------------------------------------------------------------------------------- /docs/html/authors.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Credits — pyhecdss 1.1.2+5.ga82763a.dirty documentation 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
32 |
33 | 34 | 35 |
36 | 37 |
38 |

Credits

39 |
40 |

Development Lead

41 |
    42 |
  • Nicky Sandhu [github: dwr-psandhu]

  • 43 |
44 |
45 |
46 |

Contributors

47 |
    48 |
  • Kijin Nam [github: kjnam]

  • 49 |
  • Henry Oling [github:HenryDane]

  • 50 |
51 |
52 |
53 | 54 | 55 |
56 | 57 |
58 |
59 | 117 |
118 |
119 | 130 | 131 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /docs/html/contributing.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Contributing — pyhecdss 1.1.2+5.ga82763a.dirty documentation 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
32 |
33 | 34 | 35 |
36 | 37 |
38 |

Contributing

39 |

Contributions are welcome, and they are greatly appreciated! Every little bit 40 | helps, and credit will always be given.

41 |

You can contribute in many ways:

42 |
43 |

Types of Contributions

44 |
45 |

Report Bugs

46 |

Report bugs at https://github.com/CADWRDeltaModeling/pyhecdss/issues.

47 |

If you are reporting a bug, please include:

48 |
    49 |
  • Your operating system name and version.

  • 50 |
  • Any details about your local setup that might be helpful in troubleshooting.

  • 51 |
  • Detailed steps to reproduce the bug.

  • 52 |
53 |
54 |
55 |

Fix Bugs

56 |

Look through the GitHub issues for bugs. Anything tagged with “bug” and “help 57 | wanted” is open to whoever wants to implement it.

58 |
59 |
60 |

Implement Features

61 |

Look through the GitHub issues for features. Anything tagged with “enhancement” 62 | and “help wanted” is open to whoever wants to implement it.

63 |
64 |
65 |

Write Documentation

66 |

pyhecdss could always use more documentation, whether as part of the 67 | official pyhecdss docs, in docstrings, or even on the web in blog posts, 68 | articles, and such.

69 |
70 |
71 |

Submit Feedback

72 |

The best way to send feedback is to file an issue at https://github.com/CADWRDeltaModeling/pyhecdss/issues.

73 |

If you are proposing a feature:

74 |
    75 |
  • Explain in detail how it would work.

  • 76 |
  • Keep the scope as narrow as possible, to make it easier to implement.

  • 77 |
  • Remember that this is a volunteer-driven project, and that contributions 78 | are welcome :)

  • 79 |
80 |
81 |
82 |
83 |

Get Started!

84 |

Ready to contribute? Here’s how to set up pyhecdss for local development.

85 |
    86 |
  1. Fork the pyhecdss repo on GitHub.

  2. 87 |
  3. Clone your fork locally:

    88 |
    $ git clone git@github.com:your_name_here/pyhecdss.git
     89 | 
    90 |
    91 |
  4. 92 |
  5. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:

    93 |
    $ mkvirtualenv pyhecdss
     94 | $ cd pyhecdss/
     95 | $ python setup.py develop
     96 | 
    97 |
    98 |
  6. 99 |
  7. Create a branch for local development:

    100 |
    $ git checkout -b name-of-your-bugfix-or-feature
    101 | 
    102 |
    103 |

    Now you can make your changes locally.

    104 |
  8. 105 |
  9. When you’re done making changes, check that your changes pass flake8 and the 106 | tests, including testing other Python versions with tox:

    107 |
    $ flake8 pyhecdss tests
    108 | $ python setup.py test or py.test
    109 | $ tox
    110 | 
    111 |
    112 |

    To get flake8 and tox, just pip install them into your virtualenv.

    113 |
  10. 114 |
  11. Commit your changes and push your branch to GitHub:

    115 |
    $ git add .
    116 | $ git commit -m "Your detailed description of your changes."
    117 | $ git push origin name-of-your-bugfix-or-feature
    118 | 
    119 |
    120 |
  12. 121 |
  13. Submit a pull request through the GitHub website.

  14. 122 |
123 |
124 |
125 |

Pull Request Guidelines

126 |

Before you submit a pull request, check that it meets these guidelines:

127 |
    128 |
  1. The pull request should include tests.

  2. 129 |
  3. If the pull request adds functionality, the docs should be updated. Put 130 | your new functionality into a function with a docstring, and add the 131 | feature to the list in README.rst.

  4. 132 |
  5. The pull request should work for Python 2.7, 3.4, 3.5 and 3.6, and for PyPy. Check 133 | https://travis-ci.org/CADWRDeltaModeling/pyhecdss/pull_requests 134 | and make sure that the tests pass for all supported Python versions.

  6. 135 |
136 |
137 |
138 |

Tips

139 |

To run a subset of tests:

140 |
$ py.test tests.test_pyhecdss
141 | 
142 |
143 |
144 |
145 |

Deploying

146 |

A reminder for the maintainers on how to deploy. 147 | Make sure all your changes are committed (including an entry in HISTORY.rst). 148 | Then run:

149 |
$ bumpversion patch # possible: major / minor / patch
150 | $ git push
151 | $ git push --tags
152 | 
153 |
154 |

Travis will then deploy to PyPI if tests pass.

155 |
156 |
157 | 158 | 159 |
160 | 161 |
162 |
163 | 224 |
225 |
226 | 237 | 238 | 239 | 240 | 241 | 242 | -------------------------------------------------------------------------------- /docs/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Welcome to pyhecdss’s documentation! — pyhecdss 1.1.2+5.ga82763a.dirty documentation 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 |
31 |
32 | 33 | 34 |
35 | 36 |
37 |

Welcome to pyhecdss’s documentation!

38 | 120 |
121 |
122 |

Indices and tables

123 | 128 |
129 | 130 | 131 |
132 | 133 |
134 |
135 | 188 |
189 |
190 | 201 | 202 | 203 | 204 | 205 | 206 | -------------------------------------------------------------------------------- /docs/html/installation.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Installation — pyhecdss 1.1.2+5.ga82763a.dirty documentation 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
32 |
33 | 34 | 35 |
36 | 37 |
38 |

Installation

39 |
40 |

Stable release

41 |

To install pyhecdss, run this command in your terminal:

42 |
$ conda install -c cadwr-dms pyhecdss
 43 | $ conda install -c anaconda libgfortran # May be needed on linux if libgfortran is not installed along with gcc
 44 | 
45 |
46 |

This is the preferred method to install pyhecdss, as it will always install the most recent stable release.

47 |

If you don’t have conda installed, this Python installation guide can guide 48 | you through the process.

49 |
50 |
51 |

From sources

52 |

The sources for pyhecdss can be downloaded from the Github repo.

53 |

You can either clone the public repository:

54 |
$ git clone https://github.com/CADWRDeltaModeling/pyhecdss.git
 55 | 
56 |
57 |

Or download the tarball:

58 |
$ curl  -OL https://github.com/CADWRDeltaModeling/pyhecdss/tarball/master
 59 | 
60 |
61 |

Once you have a copy of the source, you can install it with:

62 |
$ python setup.py install
 63 | 
64 |
65 |

This library has dependencies on Intel Fortran AND Intel Compiler for Windows and Intel Parallel Composer libraries. You will need the following 66 | libraries

67 |
setup.py changes --
 68 | libs = ['extensions/heclib6-VE', 'extensions/ifconsol','extensions/libifcoremt',
 69 |         'extensions/libifport','extensions/libmmt','extensions/libirc',
 70 |         'extensions/svml_disp','extensions/IFWIN','legacy_stdio_definitions',
 71 |         'User32', 'gdi32', ]
 72 | 
73 |
74 |
75 |
76 | 77 | 78 |
79 | 80 |
81 |
82 | 140 |
141 |
142 | 153 | 154 | 155 | 156 | 157 | 158 | -------------------------------------------------------------------------------- /docs/html/modules.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | pyhecdss — pyhecdss 1.1.2+5.ga82763a.dirty documentation 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
32 |
33 | 34 | 35 |
36 | 37 |
38 |

pyhecdss

39 |
40 | 48 |
49 |
50 | 51 | 52 |
53 | 54 |
55 |
56 | 113 |
114 |
115 | 126 | 127 | 128 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /docs/html/objects.inv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docs/html/objects.inv -------------------------------------------------------------------------------- /docs/html/py-modindex.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Python Module Index — pyhecdss 1.1.2+5.ga82763a.dirty documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
32 |
33 | 34 | 35 |
36 | 37 | 38 |

Python Module Index

39 | 40 |
41 | p 42 |
43 | 44 | 45 | 46 | 48 | 49 | 51 | 54 | 55 | 56 | 59 |
 
47 | p
52 | pyhecdss 53 |
    57 | pyhecdss.pyhecdss 58 |
60 | 61 | 62 |
63 | 64 |
65 |
66 | 118 |
119 |
120 | 128 | 129 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /docs/html/readme.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | pyhecdss — pyhecdss 1.1.2+5.ga82763a.dirty documentation 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
32 |
33 | 34 | 35 |
36 | 37 |
38 |

pyhecdss

39 |

For reading/writing HEC-DSS files [https://www.hec.usace.army.mil/software/hec-dss/] 40 | HEC-DSS is an ancient database used by the Army Corps of Engineers and prevalent 41 | in water related models. This module is a bridge to read and write time series 42 | data from this data format and read it into pandas DataFrame

43 | 47 |
48 |

Features

49 |
    50 |
  • Open and close DSS files

  • 51 |
  • Read catalog of DSS files as pandas DataFrame

  • 52 |
  • Read and write time series from DSS files

  • 53 |
54 |
55 |
56 |

Limitations

57 |
    58 |
  • Only support for Python 3 - 64 bit for windows and linux

  • 59 |
  • Relies on pre-compiled libraries the source distribution of which is not allowed

  • 60 |
61 |
62 |
63 |

Credits

64 |

This package wraps the HEC-DSS Software using the Swig library.

65 |

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

66 |
67 |
68 | 69 | 70 |
71 | 72 |
73 |
74 | 133 |
134 |
135 | 146 | 147 | 148 | 149 | 150 | 151 | -------------------------------------------------------------------------------- /docs/html/search.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Search — pyhecdss 1.1.2+5.ga82763a.dirty documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 |
34 |
35 |
36 | 37 | 38 |
39 | 40 |

Search

41 | 42 |
43 | 44 |

45 | Please activate JavaScript to enable the search 46 | functionality. 47 |

48 |
49 | 50 | 51 |

52 | Searching for multiple words only shows matches that contain 53 | all words. 54 |

55 | 56 | 57 |
58 | 59 | 60 | 61 |
62 | 63 | 64 | 65 |
66 | 67 |
68 | 69 | 70 |
71 | 72 |
73 |
74 | 116 |
117 |
118 | 126 | 127 | 128 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /docs/html/searchindex.js: -------------------------------------------------------------------------------- 1 | Search.setIndex({docnames:["authors","contributing","history","index","installation","modules","notebooks/period_vs_instval","notebooks/sample_dss_files","pyhecdss","readme","usage"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":3,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":3,"sphinx.domains.rst":2,"sphinx.domains.std":2,"sphinx.ext.viewcode":1,nbsphinx:3,sphinx:56},filenames:["authors.rst","contributing.rst","history.rst","index.rst","installation.rst","modules.rst","notebooks\\period_vs_instval.ipynb","notebooks\\sample_dss_files.ipynb","pyhecdss.rst","readme.rst","usage.rst"],objects:{"":{pyhecdss:[8,0,0,"-"]},"pyhecdss.pyhecdss":{DSSData:[8,1,1,""],DSSFile:[8,1,1,""],get_matching_ts:[8,5,1,""],get_start_end_dates:[8,5,1,""],get_ts:[8,5,1,""],get_version:[8,5,1,""],set_message_level:[8,5,1,""],set_program_name:[8,5,1,""]},"pyhecdss.pyhecdss.DSSData":{data:[8,2,1,""],period_type:[8,2,1,""],units:[8,2,1,""]},"pyhecdss.pyhecdss.DSSFile":{EPART_PATTERN:[8,3,1,""],FREQ_NAME_MAP:[8,3,1,""],MISSING_RECORD:[8,3,1,""],MISSING_VALUE:[8,3,1,""],NAME_FREQ_MAP:[8,3,1,""],catalog:[8,4,1,""],close:[8,4,1,""],get_epart_from_freq:[8,4,1,""],get_freq_from_epart:[8,4,1,""],get_number_and_frequency_from_epart:[8,4,1,""],get_pathnames:[8,4,1,""],get_version:[8,4,1,""],julian_day:[8,4,1,""],m2ihm:[8,4,1,""],num_values_in_interval:[8,4,1,""],open:[8,4,1,""],parse_pathname_epart:[8,4,1,""],read_catalog:[8,4,1,""],read_its:[8,4,1,""],read_rts:[8,4,1,""],timedelta_minutes:[8,3,1,""],write_its:[8,4,1,""],write_rts:[8,4,1,""]},pyhecdss:{pyhecdss:[8,0,0,"-"]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","property","Python property"],"3":["py","attribute","Python attribute"],"4":["py","method","Python method"],"5":["py","function","Python function"]},objtypes:{"0":"py:module","1":"py:class","2":"py:property","3":"py:attribute","4":"py:method","5":"py:function"},terms:{"0":[3,6,7,8],"00":[6,7],"0000":6,"01":[6,7],"0100":7,"01feb1990":6,"01jan1990":[6,7],"01jan1991":8,"01jan1992":7,"02":[6,7],"03":7,"0317":7,"04":7,"05":7,"0520":7,"05sep1992":7,"09":7,"09apr1991":7,"1":[3,6,7,8],"10":[2,7,8],"10000":8,"11":7,"12":[2,6,7],"1234":6,"1235":6,"1236":6,"13":7,"1366":6,"1367":6,"1368":6,"1369":6,"1370":6,"14":7,"141076e":7,"15":[2,6,7],"15min":7,"15t":7,"16":[2,6,7],"17":7,"18":6,"1990":[6,7],"1991":7,"1992":7,"2":[1,3,6,7,8],"20":7,"201":7,"2180":6,"2181":6,"2182":6,"2183":6,"2184":6,"2191":6,"2192":6,"2193":6,"2194":6,"2195":6,"224647e":7,"23":[6,7],"2349":7,"2359":6,"24":8,"2400":6,"253332e":7,"279052e":7,"3":[1,3,7,9],"30":7,"31":6,"3106564415":6,"31jan1990":6,"34":[6,7],"37354105":6,"39":[6,7],"4":[1,3,7,8],"406":6,"407":6,"408":6,"409":6,"410":6,"410831e":7,"45":7,"49":7,"5":[1,3,6,7],"59":6,"6":[1,3,7,8],"64":9,"648":6,"649":6,"64bit":2,"650":6,"651":6,"652":6,"653":6,"7":[1,3,7],"8":[3,7,8],"9":[3,7],"901":8,"902":8,"912":6,"913":6,"914":6,"915":6,"916":6,"9999":6,"999999999":6,"break":2,"case":2,"char":8,"class":8,"default":[2,6,8],"final":7,"function":[1,2,7,8],"import":[6,7,10],"int":7,"long":[6,8],"new":1,"public":4,"return":[2,6,7,8],"static":2,"switch":2,"throw":2,"true":[2,6],"try":[6,7],A:[1,3,8],AND:4,For:[6,7,9],If:[1,4,6,7,8],In:7,It:7,One:[6,8],Or:4,That:7,The:[1,4,6,7,8],Then:1,There:7,These:6,To:[1,4,7,10],Will:8,__:7,_array_to_datetime_object:6,_build_naiv:6,_convert_listlike_datetim:6,_lib:6,_parser:6,abort:7,about:[1,7],abov:[6,7],access:[7,8],across:7,actual:6,ad:2,add:[1,6],addit:7,after:7,again:7,alia:8,all:[1,6,7,8],allow:[7,9],allow_mix:6,allow_object:6,along:4,also:[6,7,8],alwai:[1,4],amp:7,an:[1,3,8,9],anaconda:4,analysi:7,ancient:9,ani:[1,8],anoth:[2,6],answer:3,anyth:1,api:8,appdata:6,appreci:1,ar:[1,6,7,8],arg:[6,8],armi:9,arrai:[2,6,7,8],array_to_datetim:6,articl:1,associ:8,assum:[1,8],audreyr:9,auto:2,avail:[2,7],averag:7,avg:[6,7],axes1:7,axes2:7,b:[1,7,8],back:2,base:[2,8],becaus:6,befor:[1,8],begin:8,belong:6,below:[7,8],best:[1,3,6],better:7,between:7,bit:[1,9],blank:8,block:[7,8],blog:1,bort:8,both:7,branch:1,bridg:9,bug:2,bugfix:[1,2],bumpvers:1,c:[4,6,7,8],cach:6,cadwr:4,cadwrdeltamodel:[1,4,9],call:[6,7,8],can:[1,4,6,7,8],cannot:6,care:7,catalog:[2,3,8,9],catalog_datafram:8,catdf:7,caus:[2,6],cd:1,cell:7,cf:7,chang:[1,2,4],changelog:3,charact:8,check:1,checkout:1,ci:1,cleanup:7,clone:[1,4],close:[3,8,9],coercion:6,column:7,com:[1,4,6],command:4,commit:1,compil:[2,4,8,9],compos:4,concept:7,conda:[2,4],condens:[2,8],consid:6,consist:7,consol:7,contain:8,content:5,context:[2,7],contribut:3,contributor:3,conveni:3,convent:[2,6],convert:[6,8],convert_listlik:6,cookiecutt:9,copi:[1,4],core:6,corp:9,correct:[2,8],could:1,count:8,creat:[1,2,8,9],create_new:[2,8],credit:[1,3],ctype:8,cunit:8,curl:4,d:[7,8],dai:8,data:[2,3,6,8,9],databas:9,datafram:[6,8,9],date:[6,8],date_rang:7,datetim:[6,7],datetimeindex:6,dateutil:6,dayfirst:6,ddmmmyyyi:8,deal:6,dealt:6,debug:[2,7],dec:8,defaultpars:6,defin:[7,8],demo:2,demonstr:10,depend:[2,4,6],deploi:3,deriv:8,descript:1,detail:[1,7,10],determin:8,dev_pyhecdss:6,develop:[1,3],df:8,dfcat:[7,8],dfi1:7,dfi:7,dfr1:7,dfr:7,dh:8,differ:[6,7],difficult:6,dilemma:3,dimension:7,direct:[6,7],discuss:3,displai:[6,7],distribut:[2,9],dm:4,doc:[1,8],docstr:1,document:[2,7,9],doesn:8,don:[4,7],done:[1,6],down:8,download:4,dpart:8,driven:1,dsd:8,dss:[2,3,6,8,9],dssdata:[7,8],dssfile:[7,8],dtype:6,dure:6,dwr:0,e:[6,7,8],each:7,easier:1,easili:6,ed:6,edstr:8,effici:[2,8],either:[4,7,8],els:6,empti:[2,8],end:[2,6,8],enddatestr:8,engin:9,enhanc:1,entir:8,entri:1,env:6,epart_pattern:8,err:6,error:6,establish:8,even:1,everi:1,exact:6,exampl:[3,6],except:[2,6,8],exist:8,expect:7,explain:1,explicitli:[2,7],express:[2,3,8],extens:4,f:[7,8],fals:[2,8],fastest:2,fdf1:7,fdf2:7,featur:3,februari:6,field:8,file:[1,2,3,6,8,9],filenam:8,filenotfounderror:8,filter:3,find:6,first:[6,7],fix:2,flag:2,flake8:1,flow:7,fname:[7,8],follow:[4,6,7],forc:6,fork:1,form:8,format:[6,7,8,9],fortran:4,found:8,frame:[2,7,8],free:9,freq:[6,7],freq_name_map:8,frequenc:7,from:[2,3,6,7,8,9],from_valu:6,g:[6,7,8],gcc:4,gdi32:4,gener:[2,7,8],get:[3,6,7,8],get_epart_from_freq:8,get_freq_from_epart:8,get_matching_t:[2,7,8],get_number_and_frequency_from_epart:8,get_pathnam:[7,8],get_rt:8,get_rts_match:2,get_start_end_d:8,get_t:[2,7,8],get_vers:[2,7,8],git:[1,4],github:[0,1,4,9],give:6,given:[1,8],got:6,greater:8,greatli:1,gt:6,guess_vals_per_block:8,guid:4,guidelin:3,h:8,ha:4,handl:[2,6,7,8],hang:7,have:[1,4,7],head:7,hec:[2,6,7,8,9],hecdss:[2,7],heclib6:4,heclib:[2,7],help:1,helper:2,henri:0,henrydan:[0,2],here:[1,6,7],hhmm:8,highest:7,histori:1,hold:7,hour:[6,8],how:[1,6,7],howev:6,html:[7,8],http:[1,4,6,8,9],i8:6,i:[7,8],ideal:6,ifconsol:4,ifwin:4,ignoretz:6,imho:6,impli:8,improv:2,includ:1,incompat:6,index:[3,6,7,8],ineffici:8,infer_datetime_format:6,inform:7,inlin:7,insert:7,inst:[2,3,7,8],instal:[1,3],instantan:7,instead:[2,8],integ:[7,8],intel:4,interact:7,interfac:7,intern:8,interv:[6,7,8],invalid:6,io:9,ipykernel_9596:6,ir:[7,8],irregular:[2,3,8],issu:[1,2,6],istr:8,its1:7,januari:6,julian:8,julian_dai:8,just:[1,7],keep:1,kijin:0,kjnam:0,know:7,kwarg:6,label:6,larg:7,last:6,last_dai:6,latest:2,lead:3,left:6,legacy_stdio_definit:4,len:7,length:8,let:6,level:[2,3,8],lib:[4,6],libgfortran:[2,4],libifcoremt:4,libifport:4,libirc:4,libmmt:4,librari:[2,4,6,7,8,9],licens:[2,9],like:[7,8],limit:[2,3,7],link:[2,7,8],linspac:7,linux:[2,4,9],list:[1,7,8],littl:1,local:[1,6],log:[2,7],logic:2,longer:2,look:[1,6],lt:6,m2ihm:8,m:[1,2,6,8],machin:7,mai:4,maintain:1,major:1,make:[1,8],manag:[2,7],mani:1,mark:[2,6],master:4,match:[3,8],math:6,matplotlib:7,meet:1,memori:7,merg:2,messag:[2,3],meta:7,method:[3,4],midnight:6,might:[1,7],mil:9,min:8,miniconda3:6,minor:[1,2],minut:8,miss:[2,8],missing_record:8,missing_valu:8,mit:[2,9],mkvirtualenv:1,model:9,modul:[2,3,5,6,9],mon:8,month:[6,8],monthbegin:6,monthend:6,monthli:6,more:[1,2,3],most:[4,6],much:7,multi:7,must:[6,8],myfil:8,n:8,naiv:6,nam:0,name:[1,3,6,8],name_freq_map:8,nano:6,narrow:1,nativ:7,nattyp:6,need:[4,7],nicki:0,non:2,none:[6,8],note:7,notebook:[2,7,10],now:[1,2],np:[2,6,7],num_values_in_interv:8,number:[7,8],numpi:[7,8],o:8,object:8,objects_to_datetime64n:6,occur:6,off:6,offici:1,offset:[2,6],ol:[0,4],onc:[4,7],one:[6,7,8],onli:[2,7,8,9],open:[1,3,8,9],oper:[1,6,8],oppos:8,option:6,order:6,org:[1,8],origin:[1,6],other:[1,3],out:[7,8],output:7,overhead:7,p:8,packag:[3,5,6,9],page:3,panda:[2,6,7,8,9],parallel:4,param:8,paramet:8,pars:[2,6,8],parse_datetime_str:6,parse_pathname_epart:8,parser:6,parsererror:6,parserinfo:6,part:[1,7,8],partial:2,particular:7,partnam:3,pass:[1,8],patch:1,path:[7,8],path_part:8,pathnam:[2,7,8],pathpart:8,pattern:7,pd:[6,7,8],per:[2,3,7,8],perform:2,period:[2,3,7,8],period_rang:6,period_typ:[6,7,8],periodindex:6,pi:7,pip:1,plan:7,pleas:[1,7],plist1:7,plist2:7,plot:3,popul:8,possibl:[1,7],post:1,power:3,pr:6,pre:9,precis:6,prefer:4,preval:9,previou:7,print:7,process:4,program:[3,8],program_nam:8,project:[1,9,10],properti:8,propos:1,provid:8,psandhu:[0,6],ptype1:7,ptype2:7,pull:[2,3],pull_request:1,push:1,put:1,py:[1,4,6],pydata:8,pyhecdss:[1,2,4,7,10],pypackag:9,pypi:1,python:[1,4,6,7,9],pyx:6,question:6,quiet:7,quit:7,r:7,rais:[6,8],raise_from:6,random:7,rang:[2,6,8],re:[1,6,8],read:[2,3,6,8,9],read_catalog:[7,8],read_it:[7,8],read_rt:[7,8],read_t:7,readi:1,readm:1,reason:6,recent:[4,6],recompil:2,record:8,refer:[7,8],regular:[2,3,8],rel:8,relat:9,releas:3,reli:9,rememb:1,remind:1,repl:6,replac:[2,6],repo:[1,4],repositori:4,repres:7,reproduc:1,request:[2,3],requir:7,require_iso8601:6,resampl:6,reserv:7,reshap:6,resolv:2,resourc:7,respect:8,result:6,ret:6,retriev:[2,7,8],round:8,rst:1,rt:8,run:[1,4,8],s:[1,2,6,7],same:2,sampl:[7,10],sample1:7,sample2:7,sandhu:0,scope:1,search:3,second:6,section:7,see:[6,7,8,10],select:2,self:6,send:1,sep:8,separ:8,seri:[2,3,6,8,9],set:[1,3,8],set_message_level:[2,7,8],set_program_nam:[2,7,8],setup:[1,4],shape:6,share:2,shift:[2,6],shorten:2,should:[1,6,8],showcas:2,signifi:6,silent:8,similar:7,simpl:2,simpli:7,sin:[7,8],sina:7,sinc:8,singl:7,site:6,six:6,size:8,slightli:8,smaller:2,so:[3,7,8],softwar:9,sourc:[3,8,9],space:6,specifi:[7,8],sphinx:2,stabl:[3,8],stackoverflow:6,stamp:[2,6],start:[3,6,8],startdatestr:8,statement:[2,7,8],step:1,storag:[7,8],store:[2,6,7,8],str:[6,7,8],string:[6,7,8],stroke:6,structur:7,style:8,submodul:5,subset:1,support:[1,2,7,9],sure:[1,8],surround:7,svml_disp:4,swig:9,system:1,t4:7,t:[4,7,8],tag:1,take:[6,7],tarbal:4,temp:6,templat:9,termin:4,terminolog:8,test1:8,test:[1,2],test_pyhecdss:1,than:[6,8],thei:1,them:1,thi:[1,3,4,7,8,9],thing:7,those:[6,7],thread:7,through:[1,4,7],time:[2,3,6,8,9],timedelta:8,timedelta_minut:8,timeseri:[2,3,8],timestamp:[2,6],timestr:6,timewindow:[7,8],tip:3,to_datetim:[6,7,8],tool:6,tox:1,traceback:6,travi:1,troubleshoot:1,tseri:6,tslib:6,tupl:[7,8],turn:[2,7],twstr:8,type:[2,3,7,8],typeerror:6,typo:2,tz:6,tz_pars:6,tzinfo:6,union:6,unit:[2,6,7,8],units1:7,units2:7,up:[1,8],updat:[1,2],upgrad:2,upon:6,upto:8,us:[1,2,3,6,8,9,10],usac:9,usag:3,usecas:6,user32:4,user:[6,7],usual:8,utc:6,val:[7,8],valu:[2,6,7,8],valueerror:6,ve:[4,7],vector:8,verbos:8,veri:7,version:[1,2,7,8],view:6,virtualenv:1,virtualenvwrapp:1,volunt:1,vs:6,w:8,wa:[6,9],wai:[1,3,8],want:[1,6],warn:[2,7],water:9,wave:7,web:1,websit:1,week:8,welcom:1,what:[3,7],when:[1,2,6,7],where:[7,8],whether:1,which:[6,7,8,9],whoever:1,window:[2,4,8,9],without:7,work:[1,3,8],worri:7,would:[1,6,7],wrap:9,write:[2,3,8,9],write_it:[7,8],write_rt:[7,8],www:9,x:7,y:2,year:[7,8],yearfirst:6,you:[1,4,6,7],your:[1,4],your_name_her:1,yyi:7,zero:2},titles:["Credits","Contributing","CHANGELOG","Welcome to pyhecdss\u2019s documentation!","Installation","pyhecdss","Discussion on PER-* and INST-* period types","Usage with examples","pyhecdss package","pyhecdss","Usage"],titleterms:{"0":2,"1":2,"2":2,"3":2,"4":2,"5":2,"6":2,"7":2,"8":2,"9":2,"new":7,A:7,an:7,answer:6,best:7,bug:1,catalog:7,changelog:2,close:7,content:[3,8],contribut:1,contributor:0,conveni:7,creat:7,credit:[0,9],data:7,datafram:7,deploi:1,develop:0,dilemma:6,discuss:6,document:[1,3],dss:7,exampl:7,express:7,featur:[1,7,9],feedback:1,file:7,filter:7,fix:1,from:4,get:1,guidelin:1,implement:1,indic:3,inst:6,instal:4,irregular:7,lead:0,level:7,limit:9,match:7,messag:7,method:7,modul:8,more:7,name:7,open:7,other:7,packag:8,partnam:7,per:6,period:6,plot:7,power:7,program:7,pull:1,pyhecdss:[3,5,8,9],read:7,regular:7,releas:4,report:1,request:1,s:3,seri:7,set:7,so:6,sourc:4,stabl:4,start:1,submit:1,submodul:8,tabl:3,thi:6,time:7,timeseri:7,tip:1,type:[1,6],us:7,usag:[7,10],wai:7,welcom:3,what:6,work:7,write:[1,7]}}) -------------------------------------------------------------------------------- /docs/html/usage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Usage — pyhecdss 1.1.2+5.ga82763a.dirty documentation 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
32 |
33 | 34 | 35 |
36 | 37 |
38 |

Usage

39 |

To use pyhecdss in a project:

40 |
import pyhecdss
 41 | 
42 |
43 |

See the sample notebook for detailed demonstration

44 |
45 | 46 | 47 |
48 | 49 |
50 |
51 | 105 |
106 |
107 | 118 | 119 | 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /docsrc/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = python -msphinx 7 | SPHINXPROJ = pyhecdss 8 | SOURCEDIR = . 9 | BUILDDIR = _build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 | -------------------------------------------------------------------------------- /docsrc/authors.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../AUTHORS.rst 2 | -------------------------------------------------------------------------------- /docsrc/conf.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # pyhecdss documentation build configuration file, created by 5 | # sphinx-quickstart on Fri Jun 9 13:47:02 2017. 6 | # 7 | # This file is execfile()d with the current directory set to its 8 | # containing dir. 9 | # 10 | # Note that not all possible configuration values are present in this 11 | # autogenerated file. 12 | # 13 | # All configuration values have a default; values that are commented out 14 | # serve to show the default. 15 | 16 | # If extensions (or modules to document with autodoc) are in another 17 | # directory, add these directories to sys.path here. If the directory is 18 | # relative to the documentation root, use os.path.abspath to make it 19 | # absolute, like shown here. 20 | # 21 | import os 22 | import sys 23 | sys.path.insert(0, os.path.abspath('..')) 24 | 25 | import pyhecdss 26 | 27 | # -- General configuration --------------------------------------------- 28 | 29 | # If your documentation needs a minimal Sphinx version, state it here. 30 | # 31 | # needs_sphinx = '1.0' 32 | 33 | # Add any Sphinx extension module names here, as strings. They can be 34 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. 35 | extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 36 | 'nbsphinx', 37 | 'sphinx.ext.mathjax',] 38 | 39 | # Add any paths that contain templates here, relative to this directory. 40 | templates_path = ['_templates'] 41 | 42 | # The suffix(es) of source filenames. 43 | # You can specify multiple suffix as a list of string: 44 | # 45 | # source_suffix = ['.rst', '.md'] 46 | source_suffix = '.rst' 47 | 48 | # The master toctree document. 49 | master_doc = 'index' 50 | 51 | # General information about the project. 52 | project = u'pyhecdss' 53 | copyright = u"2019, Nicky Sandhu" 54 | author = u"Nicky Sandhu" 55 | 56 | # The version info for the project you're documenting, acts as replacement 57 | # for |version| and |release|, also used in various other places throughout 58 | # the built documents. 59 | # 60 | # The short X.Y version. 61 | version = pyhecdss.__version__ 62 | # The full version, including alpha/beta/rc tags. 63 | release = pyhecdss.__version__ 64 | 65 | # The language for content autogenerated by Sphinx. Refer to documentation 66 | # for a list of supported languages. 67 | # 68 | # This is also used if you do content translation via gettext catalogs. 69 | # Usually you set "language" from the command line for these cases. 70 | language = None 71 | 72 | # List of patterns, relative to source directory, that match files and 73 | # directories to ignore when looking for source files. 74 | # This patterns also effect to html_static_path and html_extra_path 75 | exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '**.ipynb_checkpoints'] 76 | 77 | # The name of the Pygments (syntax highlighting) style to use. 78 | pygments_style = 'sphinx' 79 | 80 | # If true, `todo` and `todoList` produce output, else they produce nothing. 81 | todo_include_todos = False 82 | 83 | 84 | # -- Options for HTML output ------------------------------------------- 85 | 86 | # The theme to use for HTML and HTML Help pages. See the documentation for 87 | # a list of builtin themes. 88 | # 89 | html_theme = 'alabaster' 90 | 91 | # Theme options are theme-specific and customize the look and feel of a 92 | # theme further. For a list of options available for each theme, see the 93 | # documentation. 94 | # 95 | # html_theme_options = {} 96 | 97 | # Add any paths that contain custom static files (such as style sheets) here, 98 | # relative to this directory. They are copied after the builtin static files, 99 | # so a file named "default.css" will overwrite the builtin "default.css". 100 | html_static_path = ['_static'] 101 | 102 | 103 | # -- Options for HTMLHelp output --------------------------------------- 104 | 105 | # Output file base name for HTML help builder. 106 | htmlhelp_basename = 'pyhecdssdoc' 107 | 108 | 109 | # -- Options for LaTeX output ------------------------------------------ 110 | 111 | latex_elements = { 112 | # The paper size ('letterpaper' or 'a4paper'). 113 | # 114 | # 'papersize': 'letterpaper', 115 | 116 | # The font size ('10pt', '11pt' or '12pt'). 117 | # 118 | # 'pointsize': '10pt', 119 | 120 | # Additional stuff for the LaTeX preamble. 121 | # 122 | # 'preamble': '', 123 | 124 | # Latex figure (float) alignment 125 | # 126 | # 'figure_align': 'htbp', 127 | } 128 | 129 | # Grouping the document tree into LaTeX files. List of tuples 130 | # (source start file, target name, title, author, documentclass 131 | # [howto, manual, or own class]). 132 | latex_documents = [ 133 | (master_doc, 'pyhecdss.tex', 134 | u'pyhecdss Documentation', 135 | u'Nicky Sandhu', 'manual'), 136 | ] 137 | 138 | 139 | # -- Options for manual page output ------------------------------------ 140 | 141 | # One entry per manual page. List of tuples 142 | # (source start file, name, description, authors, manual section). 143 | man_pages = [ 144 | (master_doc, 'pyhecdss', 145 | u'pyhecdss Documentation', 146 | [author], 1) 147 | ] 148 | 149 | 150 | # -- Options for Texinfo output ---------------------------------------- 151 | 152 | # Grouping the document tree into Texinfo files. List of tuples 153 | # (source start file, target name, title, author, 154 | # dir menu entry, description, category) 155 | texinfo_documents = [ 156 | (master_doc, 'pyhecdss', 157 | u'pyhecdss Documentation', 158 | author, 159 | 'pyhecdss', 160 | 'One line description of project.', 161 | 'Miscellaneous'), 162 | ] 163 | -------------------------------------------------------------------------------- /docsrc/contributing.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../CONTRIBUTING.rst 2 | -------------------------------------------------------------------------------- /docsrc/doall.bat: -------------------------------------------------------------------------------- 1 | rem only needed if you add submodules etc.. 2 | sphinx-apidoc -o . ../pyhecdss 3 | call make clean 4 | call make html 5 | call xcopy /y /s /e _build\* ..\docs 6 | -------------------------------------------------------------------------------- /docsrc/history.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../CHANGELOG.rst 2 | -------------------------------------------------------------------------------- /docsrc/index.rst: -------------------------------------------------------------------------------- 1 | Welcome to pyhecdss's documentation! 2 | ====================================== 3 | .. toctree:: 4 | :maxdepth: 2 5 | :caption: Contents: 6 | 7 | readme 8 | installation 9 | usage 10 | notebooks/sample_dss_files.ipynb 11 | notebooks/period_vs_instval.ipynb 12 | modules 13 | contributing 14 | authors 15 | history 16 | 17 | Indices and tables 18 | ================== 19 | * :ref:`genindex` 20 | * :ref:`modindex` 21 | * :ref:`search` 22 | -------------------------------------------------------------------------------- /docsrc/installation.rst: -------------------------------------------------------------------------------- 1 | .. highlight:: shell 2 | 3 | ============ 4 | Installation 5 | ============ 6 | 7 | 8 | Stable release 9 | -------------- 10 | 11 | To install pyhecdss, run this command in your terminal: 12 | 13 | .. code-block:: console 14 | 15 | $ conda install -c cadwr-dms pyhecdss 16 | $ conda install -c anaconda libgfortran # May be needed on linux if libgfortran is not installed along with gcc 17 | 18 | This is the preferred method to install pyhecdss, as it will always install the most recent stable release. 19 | 20 | If you don't have `conda`_ installed, this `Python installation guide`_ can guide 21 | you through the process. 22 | 23 | .. _conda: https://docs.conda.io/projects/conda/en/latest/user-guide/install/ 24 | .. _Python installation guide: http://docs.python-guide.org/en/latest/starting/installation/ 25 | 26 | 27 | From sources 28 | ------------ 29 | 30 | The sources for pyhecdss can be downloaded from the `Github repo`_. 31 | 32 | You can either clone the public repository: 33 | 34 | .. code-block:: console 35 | 36 | $ git clone https://github.com/CADWRDeltaModeling/pyhecdss.git 37 | 38 | Or download the `tarball`_: 39 | 40 | .. code-block:: console 41 | 42 | $ curl -OL https://github.com/CADWRDeltaModeling/pyhecdss/tarball/master 43 | 44 | Once you have a copy of the source, you can install it with: 45 | 46 | .. code-block:: console 47 | 48 | $ python setup.py install 49 | 50 | This library has dependencies on Intel Fortran AND Intel Compiler for Windows and Intel Parallel Composer libraries. You will need the following 51 | libraries 52 | 53 | .. code-block:: 54 | 55 | setup.py changes -- 56 | libs = ['extensions/heclib6-VE', 'extensions/ifconsol','extensions/libifcoremt', 57 | 'extensions/libifport','extensions/libmmt','extensions/libirc', 58 | 'extensions/svml_disp','extensions/IFWIN','legacy_stdio_definitions', 59 | 'User32', 'gdi32', ] 60 | 61 | .. _Github repo: https://github.com/CADWRDeltaModeling/pyhecdss 62 | .. _tarball: https://github.com/CADWRDeltaModeling/pyhecdss/tarball/master 63 | -------------------------------------------------------------------------------- /docsrc/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=python -msphinx 9 | ) 10 | set SOURCEDIR=. 11 | set BUILDDIR=_build 12 | set SPHINXPROJ=pyhecdss 13 | 14 | if "%1" == "" goto help 15 | 16 | %SPHINXBUILD% >NUL 2>NUL 17 | if errorlevel 9009 ( 18 | echo. 19 | echo.The Sphinx module was not found. Make sure you have Sphinx installed, 20 | echo.then set the SPHINXBUILD environment variable to point to the full 21 | echo.path of the 'sphinx-build' executable. Alternatively you may add the 22 | echo.Sphinx directory to PATH. 23 | echo. 24 | echo.If you don't have Sphinx installed, grab it from 25 | echo.http://sphinx-doc.org/ 26 | exit /b 1 27 | ) 28 | 29 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 30 | goto end 31 | 32 | :help 33 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 34 | 35 | :end 36 | popd 37 | -------------------------------------------------------------------------------- /docsrc/modules.rst: -------------------------------------------------------------------------------- 1 | pyhecdss 2 | ======== 3 | 4 | .. toctree:: 5 | :maxdepth: 4 6 | 7 | pyhecdss 8 | -------------------------------------------------------------------------------- /docsrc/notebooks/sample.dss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/docsrc/notebooks/sample.dss -------------------------------------------------------------------------------- /docsrc/pyhecdss.rst: -------------------------------------------------------------------------------- 1 | pyhecdss package 2 | ================ 3 | 4 | Submodules 5 | ---------- 6 | 7 | pyhecdss.pyhecdss module 8 | ------------------------ 9 | 10 | .. automodule:: pyhecdss.pyhecdss 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | Module contents 16 | --------------- 17 | 18 | .. automodule:: pyhecdss 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | -------------------------------------------------------------------------------- /docsrc/readme.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../README.rst 2 | -------------------------------------------------------------------------------- /docsrc/requirements.txt: -------------------------------------------------------------------------------- 1 | # This file may be used to create an environment using: 2 | # $ conda create --name --file 3 | # platform: win-64 4 | conda=4.7.11=py37_0 5 | conda-build=3.18.9=py37_3 6 | jupyter=1.0.0=py37_7 7 | nbsphinx=0.4.2=py_0 8 | numpy=1.16.3=py37h19fb1c0_0 9 | pandas=0.25.0=pypi_0 10 | pytest=5.0.1=py37_0 11 | python=3.7.3=h8c8aaf0_1 12 | sphinx=2.1.2=py_0 13 | pandoc 14 | -------------------------------------------------------------------------------- /docsrc/usage.rst: -------------------------------------------------------------------------------- 1 | ===== 2 | Usage 3 | ===== 4 | 5 | To use pyhecdss in a project:: 6 | 7 | import pyhecdss 8 | 9 | See the sample notebook for detailed demonstration 10 | -------------------------------------------------------------------------------- /environment-dev.yml: -------------------------------------------------------------------------------- 1 | name: dev_pyhecdss 2 | channels: 3 | - cadwr-dms 4 | - conda-forge 5 | dependencies: 6 | - python=3.11 7 | - pip 8 | - ipykernel # for jupyter notebook support 9 | - black # for formatting esp. in jupyter notebook 10 | - numpy 11 | - pandas 12 | - pytest 13 | - conda-build 14 | - nbsphinx # docs stuff below 15 | - sphinx 16 | - pandoc 17 | -------------------------------------------------------------------------------- /environment.yml: -------------------------------------------------------------------------------- 1 | name: dss 2 | channels: 3 | - cadwr-dms 4 | - conda-forge 5 | dependencies: 6 | - conda 7 | - conda-build 8 | - nbsphinx 9 | - numpy 10 | - pandas 11 | - python=3.11 12 | - sphinx 13 | - pyhecdss 14 | -------------------------------------------------------------------------------- /extensions/heclib6-VE.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/extensions/heclib6-VE.lib -------------------------------------------------------------------------------- /extensions/libheclib6-WE.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/extensions/libheclib6-WE.a -------------------------------------------------------------------------------- /jenkins_dwr.bat: -------------------------------------------------------------------------------- 1 | call C:\ProgramData\Anaconda3\Scripts\activate.bat C:\ProgramData\Anaconda3 2 | call conda create -n test_pyhecdss -y conda-build conda-verify numpy 3 | call conda activate test_pyhecdss 4 | call conda build conda.recipe 5 | if errorlevel 1 exit 1 6 | -------------------------------------------------------------------------------- /jenkins_dwr.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | source /etc/profile.d/modules.sh 3 | module load python/miniconda3 4 | conda create -n test_pyhecdss -y conda-build conda-verify numpy 5 | source activate test_pyhecdss 6 | conda build conda.recipe 7 | -------------------------------------------------------------------------------- /perftest/hec_read_large_file.py: -------------------------------------------------------------------------------- 1 | from hec.heclib.dss import HecDSSUtilities 2 | from hec.heclib.dss import HecDss 3 | import datetime 4 | if __name__=='__main__': 5 | print('Run with vscript. Uses HEC-DSSVue functions to do the same as read_large_file.py') 6 | HecDSSUtilities.setMessageLevel(0) 7 | d=HecDss.open('ITP_PP_out_ec.dss',1) 8 | s=datetime.datetime.now() 9 | plist=d.getCondensedCatalog() 10 | print('Catalog read in %s'%str(datetime.datetime.now()-s)) 11 | print('Reading data from %s pathnames'%len(plist)) 12 | s=datetime.datetime.now() 13 | for path in plist: 14 | s1=datetime.datetime.now() 15 | data=d.get(str(path),1) 16 | print('Read %s in %s '%(str(path), str(datetime.datetime.now()-s1))) 17 | print('Read %s in %s'%(len(plist),str(datetime.datetime.now()-s))) -------------------------------------------------------------------------------- /perftest/pydss_read_large_file.py: -------------------------------------------------------------------------------- 1 | from vtools.datastore.dss.api import * 2 | import datetime 3 | 4 | if __name__ == '__main__': 5 | fname="ITP_PP_out_ec.dss" 6 | s=datetime.datetime.now() 7 | c=dss_catalog(fname) 8 | print('catalog read in : %s'%str(datetime.datetime.now()-s) ) 9 | print('Reading %d ...'%len(c)) 10 | s=datetime.datetime.now() 11 | for e in c: 12 | #e[0].item_names() --> ['A', 'C', 'B', 'E', 'D', 'F', 'interval'] 13 | path = '/'+e.item('A')+'/'+e.item('B')+'/'+e.item('C')+'//'+e.item('E')+'/'+e.item('F')+'/' 14 | si=datetime.datetime.now() 15 | dss_retrieve_ts(fname,path) 16 | print('read %s in %s'%(path, str(datetime.datetime.now()-si))) 17 | print('read all in %s'%str(datetime.datetime.now()-s)) 18 | -------------------------------------------------------------------------------- /perftest/read_large_file.py: -------------------------------------------------------------------------------- 1 | import pyhecdss 2 | import datetime 3 | if __name__=='__main__': 4 | pyhecdss.set_message_level(0) 5 | d=pyhecdss.DSSFile('./ITP_PP_out_ec.dss') 6 | s=datetime.datetime.now() 7 | catdf=d.read_catalog() 8 | print('catalog read in :', datetime.datetime.now()-s ) 9 | plist=d.get_pathnames() 10 | print('Reading ',len(plist),'...') 11 | s=datetime.datetime.now() 12 | for path in plist: 13 | si=datetime.datetime.now() 14 | df,u,p=d.read_rts(path) 15 | print('read ',path,' in ',datetime.datetime.now()-si) 16 | print('read all in ',datetime.datetime.now()-s) 17 | -------------------------------------------------------------------------------- /perftest/vscript_read_large_file.py: -------------------------------------------------------------------------------- 1 | import vutils 2 | import datetime 3 | if __name__=='__main__': 4 | print('Uses Vista which wraps lowlevel HEC DSSVue functions') 5 | d=vutils.opendss('ITP_PP_out_ec.dss') 6 | s=datetime.datetime.now() 7 | npaths=len(d) # Used to load the catalog into memory 8 | print('Catalog read in %s'%str(datetime.datetime.now()-s)) 9 | print('Reading data from %s pathnames'%str(npaths)) 10 | s=datetime.datetime.now() 11 | for ref in d: 12 | s1=datetime.datetime.now() 13 | data=ref.getData() 14 | path=ref.getPathname() 15 | print('Read %s in %s '%(str(path), str(datetime.datetime.now()-s1))) 16 | print('Read %s in %s'%(npaths,str(datetime.datetime.now()-s))) -------------------------------------------------------------------------------- /pyhecdss/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = """Nicky Sandhu""" 2 | __email__ = "psandhu@water.ca.gov" 3 | 4 | from . import _version 5 | 6 | __version__ = _version.get_versions()["version"] 7 | 8 | from .pyhecdss import ( 9 | DATE_FMT_STR, 10 | DSSData, 11 | DSSFile, 12 | get_matching_ts, 13 | get_start_end_dates, 14 | get_ts, 15 | get_version, 16 | monthrange, 17 | set_message_level, 18 | set_program_name, 19 | ) 20 | 21 | set_message_level(0) 22 | -------------------------------------------------------------------------------- /pyhecdss/hecwrapper.c: -------------------------------------------------------------------------------- 1 | #include "hecwrapper.h" 2 | // julian days since 31DEC1899 2400 3 | void hec_datjul(char *cdate, slen_t _cdate_len, int *jul, int *ierr){ 4 | datjul_(cdate, jul, ierr, _cdate_len); 5 | } 6 | // 7 | void hec_zopen(int *ifltab, char *cfname, int cflen, int *istat){ 8 | zopen_(ifltab, cfname, istat, cflen); 9 | } 10 | // inquire about parameters 11 | void hec_zinqir(int *ifltab, char *cflg, slen_t _cflg_len, char *calpha, slen_t _calpha_len, int *inumb){ 12 | zinqir_(ifltab, cflg, calpha, inumb, _cflg_len, _calpha_len); 13 | } 14 | // versioning info for filename 15 | void hec_zfver(char *cfname, slen_t _cfname_len, char *cver, int *iver){ 16 | slen_t _cver_len=4; // refer to pyheclib.i for length match 17 | zfver_(cfname, cver, iver, _cfname_len, _cver_len); 18 | } 19 | // set params 20 | void hec_zset(char *cflg, slen_t _cflg_len, char *cstr, slen_t _cstr_len, int *numb){ 21 | zset_(cflg, cstr, numb, _cflg_len, _cstr_len); 22 | } 23 | // E part <--> interval conversions 24 | void hec_zgintl(int *intl, char *chintl,slen_t _chintl_len, int *nodata, int *istat){ 25 | zgintl_(intl, chintl, nodata, istat, _chintl_len); 26 | } 27 | //Store reqular time series 28 | void hec_zsrtsxd(int *ifltab, 29 | char *cpath, slen_t _cpath_len, 30 | char *cdate, slen_t _cdate_len, 31 | char *ctime, slen_t _ctime_len, 32 | double *numpyvalues, int nvals, 33 | char *cunits, slen_t _cunits_len, 34 | char *ctype, slen_t _ctype_len, 35 | int *istat){ 36 | int jqual=0, lqual=0; 37 | int iuhead=0,nuhead=0; 38 | int iplan=0; // always overwrite (using merging functions) 39 | int jcomp=0; // default compression, next few are for compression 40 | float basev=0; 41 | int lbasev=0,ldhigh=0, nprec=0; 42 | zsrtsxd_(ifltab, 43 | cpath, cdate, ctime, 44 | &nvals, numpyvalues, 45 | &jqual, &lqual, 46 | cunits, ctype, 47 | &iuhead, &nuhead, 48 | &iplan, &jcomp, 49 | &basev, &lbasev, &ldhigh, &nprec, 50 | istat, 51 | _cpath_len, _cdate_len, _ctime_len, _cunits_len, _ctype_len); 52 | } 53 | //Store irregular time series 54 | void hec_zsitsxd(int *ifltab, 55 | char *cpath, slen_t _cpath_len, 56 | int *itimes, int ntvalue, 57 | double *dvalues, int ndvalue, 58 | int *ibdate, 59 | char *cunits, slen_t _cunits_len, 60 | char *ctype, slen_t _ctype_len, 61 | int *inflag, 62 | int *istat){ 63 | int jqual=0, lsqual=0; 64 | int iuhead=0,nuhead=0; 65 | //check that ntvalue == ndvalue 66 | zsitsxd_(ifltab, 67 | cpath, itimes, dvalues, &ndvalue, ibdate, &jqual, &lsqual, cunits, ctype, &iuhead, &nuhead, inflag, istat, _cpath_len, _cunits_len, _ctype_len); 68 | } 69 | 70 | // return the number of values read 71 | int hec_zrrtsxd(int *ifltab, 72 | char *cpath, slen_t _cpath_len, 73 | char *cdate, slen_t _cdate_len, 74 | char *ctime, slen_t _ctime_len, 75 | double *numpyvalues, int nvals, 76 | char *cunits, char *ctype, 77 | int *iofset, int *istat) { 78 | slen_t _cunits_len=8;//FIXME: This should match the pyheclib.i definitions 79 | slen_t _ctype_len=8; 80 | int jqual = 0; 81 | int lqual = 0; 82 | int lqread = 0; 83 | int iuhead = 0; 84 | int kuhead = 0; 85 | int nuhead = 0; 86 | int jcomp=0; 87 | zrrtsxd_(ifltab, cpath, cdate, ctime, &nvals, numpyvalues, 88 | &jqual, &lqual, &lqread, cunits, ctype, &iuhead, &kuhead, &nuhead, iofset, &jcomp, istat, 89 | _cpath_len, _cdate_len, _ctime_len, _cunits_len, _ctype_len); 90 | return nvals; 91 | } 92 | 93 | void hec_zritsxd(int *ifltab, 94 | char *cpath, slen_t _cpath_len, 95 | int *juls, int *istime, 96 | int *jule, int *ietime, 97 | int *itimes, int ktvals, 98 | double *dvalues, int kdvals, 99 | int *nvals, 100 | int *ibdate, 101 | char *cunits, 102 | char *ctype, 103 | int *inflag, 104 | int *istat){ 105 | slen_t _cunits_len=8;//FIXME: This should match the pyheclib.i definitions 106 | slen_t _ctype_len=8; 107 | int iqual = 0; 108 | int lqual = 0; 109 | int lqread = 0; 110 | int iuhead = 0; 111 | int kuhead = 0; 112 | int nuhead = 0; 113 | //check that ntvalue == ndvalue 114 | zritsxd_(ifltab, cpath, juls, istime, jule, ietime, 115 | itimes, dvalues, &ktvals, 116 | nvals, ibdate, 117 | &iqual, &lqual, &lqread, cunits, ctype, &iuhead, &kuhead, &nuhead, 118 | inflag, istat, _cpath_len, _cunits_len, _ctype_len); 119 | 120 | } 121 | -------------------------------------------------------------------------------- /pyhecdss/hecwrapper.h: -------------------------------------------------------------------------------- 1 | #ifndef __HEC_WRAPPER_H__ 2 | #define __HEC_WRAPPER_H__ 3 | /* 4 | * The header file for wrapping C functions to order and types friendlier to 5 | * SWIG typemaps. 6 | * 7 | */ 8 | #include "heclib.h" 9 | // julian days since 31DEC1899 2400 10 | void hec_datjul(char *cdate, slen_t _cdate_len, int *jul, int *ierr); 11 | // open dss file 12 | void hec_zopen(int *ifltab, char *cfname, int cflen, int *istat); 13 | // inquire about parameters 14 | void hec_zinqir(int *ifltab, char *cflg, slen_t _cflg_len, char *calpha, slen_t _calpha_len, int *inumb); 15 | // set params 16 | void hec_zset(char *cflg, slen_t _cflg_len, char *cstr, slen_t _cstr_len, int *numb); 17 | // versioning info for filename 18 | void hec_zfver(char *cfname, slen_t _cfname_len, char *cver, int *iver); 19 | // E part <--> interval conversions 20 | void hec_zgintl(int *intl, char *chintl,slen_t _chintl_len, int *nodata, int *istat); 21 | // Store regular time series 22 | void hec_zsrtsxd(int *ifltab, 23 | char *cpath, slen_t _cpath_len, 24 | char *cdate, slen_t _cdate_len, 25 | char *ctime, slen_t _ctime_len, 26 | double *numpyvalues, int nvals, 27 | char *cunits, slen_t _cunits_len, 28 | char *ctype, slen_t _ctype_len, 29 | int *istat); 30 | //Store irregular time series 31 | void hec_zsitsxd(int *ifltab, 32 | char *cpath, slen_t _cpath_len, 33 | int *itimes, int ntvalue, 34 | double *dvalues, int ndvalue, 35 | int *ibdate, 36 | char *cunits, slen_t _cunits_len, 37 | char *ctype, slen_t _ctype_len, 38 | int *inflag, 39 | int *istat); 40 | // Retrieve regular time series 41 | // returns nvals (number of values read as contrasted to requested) 42 | int hec_zrrtsxd(int *ifltab, 43 | char *cpath, slen_t _cpath_len, 44 | char *cdate, slen_t _cdate_len, 45 | char *ctime, slen_t _ctime_len, 46 | double *numpyvalues, int nvals, 47 | char *cunits, char *ctype, 48 | int *iofset, int *istat); 49 | // Retrieve irregular time series 50 | void hec_zritsxd(int *ifltab, 51 | char *cpath, slen_t _cpath_len, 52 | int *juls, int *istime, 53 | int *jule, int *ietime, 54 | int *itimes, int ktvals, 55 | double *dvalues, int kdvals, 56 | int *nvals, 57 | int *ibdate, 58 | char *cunits, 59 | char *ctype, 60 | int *inflag, 61 | int *istat); 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /pyhecdss/pyheclib.i: -------------------------------------------------------------------------------- 1 | %module pyheclib 2 | 3 | /* First we'll use the pointer library*/ 4 | %include 5 | %pointer_functions(int,intp); 6 | %pointer_functions(double,doublep); 7 | 8 | /* C arrays -- prefer numpy mapping if possible. */ 9 | %include "carrays.i" 10 | %array_class(int, intArray); 11 | %array_class(double, doubleArray); 12 | 13 | /* strings */ 14 | %include "cstring.i" 15 | 16 | %{ 17 | #define SWIG_FILE_WITH_INIT 18 | #include "heclib.h" 19 | #include "hecwrapper.h" 20 | %} 21 | 22 | %include 23 | 24 | // numpy mappings -- copied from numpy 1.15 -- upgrade only if needed 25 | %include "numpy.i" 26 | 27 | %init%{ 28 | import_array(); 29 | %} 30 | 31 | typedef int slen_t; 32 | // -- straight up heclib functions 33 | void zcat_(int *ifltab, int *icunit, int *icdunt, int *inunit, char *cinstr, int *labrev, int *ldosrt, int *lcdcat, int *norecs, slen_t _cinstr_len); 34 | int fortranclose_(int *INPUT); 35 | void fortranflush_(int *INPUT); 36 | int fortranopen_(int *INPUT, char *filename, slen_t _filename_len); 37 | void zclose_(int *ifltab); 38 | 39 | /* 40 | * wrapper functions mappings. This is done to usually rearrange arguments so 41 | * that they fit one of the defined typemaps from swig or numpy.i 42 | */ 43 | 44 | %apply (int *OUTPUT) { int *jul }; 45 | %apply (int *OUTPUT) { int *ierr }; 46 | %apply (char *STRING, int LENGTH) { (char *cdate, slen_t _cdate_len) }; 47 | void hec_datjul(char *cdate, slen_t _cdate_len, int *jul, int *ierr); 48 | %apply (char *STRING, int LENGTH) { (char *cflg, slen_t _cflg_len) }; 49 | %apply (char *STRING, int LENGTH) { (char *cstr, slen_t _cstr_len) }; 50 | 51 | // versioning info for filename 52 | %apply (char *STRING, int LENGTH) { (char *cfname, slen_t _cfname_len) }; 53 | %cstring_bounded_output(char *cver, 4); 54 | %apply (int *OUTPUT) { int *iver }; 55 | void hec_zfver(char *cfname, slen_t _cfname_len, char *cver, int *iver); 56 | %apply (int *OUTPUT) { int *numb }; 57 | %cstring_bounded_output(char *calpha, 80); 58 | %apply (char *STRING, int LENGTH) { (char *calpha, slen_t _calpha_len) }; 59 | void hec_zinqir(int *ifltab, char *cflg, slen_t _cflg_len, char *calpha, slen_t _calpha_len, int *inumb); 60 | %clear (int *numb); 61 | %apply (int *INPUT) { int *numb }; 62 | void hec_zset(char *cflg, slen_t _cflg_len, char *cstr, slen_t _cstr_len, int *numb); 63 | %apply (int *INOUT) { int *intl}; 64 | %cstring_bounded_mutable(chintl, 32); 65 | %apply (char *STRING, int LENGTH) { (char *chintl, slent_t _chintl_len) }; 66 | %apply (int *INOUT) { int *istat }; 67 | %apply (int *OUTPUT) { int *nodata }; 68 | void hec_zgintl(int *intl, char *chintl, slen_t _chintl_len, int *nodata, int *istat); 69 | %clear (int *nodata); 70 | // 4 to allow extension of ".dss" to be added to cfname if needed 71 | %cstring_bounded_mutable(cfname, 4); 72 | %apply ( int *OUTPUT ) { int *iofset }; 73 | %apply ( int *OUTPUT ) { int *istat }; 74 | %apply (double* INPLACE_ARRAY1, int DIM1) {(double *numpyvalues, int nvals)}; 75 | %apply (char *STRING, int LENGTH) { (char *cfname, int cflen) }; 76 | %apply (char *STRING, int LENGTH) { (char *cpath, slen_t _cpath_len) }; 77 | %apply (char *STRING, int LENGTH) { (char *cdate, slen_t _cdate_len) }; 78 | %apply (char *STRING, int LENGTH) { (char *ctime, slen_t _ctime_len) }; 79 | void hec_zopen(int *ifltab, char *cfname, int cflen, int *istat); 80 | %apply (char *STRING, int LENGTH) { (char *cunits, slen_t _cunits_len) }; 81 | %apply (char *STRING, int LENGTH) { (char *ctype, slen_t _ctype_len) }; 82 | // Store regular time series 83 | void hec_zsrtsxd(int *ifltab, 84 | char *cpath, slen_t _cpath_len, 85 | char *cdate, slen_t _cdate_len, 86 | char *ctime, slen_t _ctime_len, 87 | double *numpyvalues, int nvals, 88 | char *cunits, slen_t _cunits_len, 89 | char *ctype, slen_t _ctype_len, 90 | int *istat); 91 | //Store irregular time series 92 | %apply (double* INPLACE_ARRAY1, int DIM1) {(double *dvalues, int ndvalue)}; 93 | %apply (int* INPLACE_ARRAY1, int DIM1) {(int *itimes, int ntvalue)}; 94 | %apply (int *INPUT) { int *ibdate}; 95 | %apply ( int *INPUT ) { int *inflag }; 96 | void hec_zsitsxd(int *ifltab, 97 | char *cpath, slen_t _cpath_len, 98 | int *itimes, int ntvalue, 99 | double *dvalues, int ndvalue, 100 | int *ibdate, 101 | char *cunits, slen_t _cunits_len, 102 | char *ctype, slen_t _ctype_len, 103 | int *inflag, 104 | int *istat); 105 | // Retrieve regular time series 106 | // returns nvals (number of values read as contrasted to requested) 107 | %clear (char *cunits, slen_t _cunits_len); 108 | %clear (char *ctype, slen_t _ctype_len); 109 | %cstring_bounded_output(char *cunits, 8); 110 | %cstring_bounded_output(char *ctype, 8); 111 | int hec_zrrtsxd(int *ifltab, 112 | char *cpath, slen_t _cpath_len, 113 | char *cdate, slen_t _cdate_len, 114 | char *ctime, slen_t _ctime_len, 115 | double *numpyvalues, int nvals, 116 | char *cunits, char *ctype, 117 | int *iofset, int *istat); 118 | %apply ( int *INPUT ) { int *juls }; 119 | %apply ( int *INPUT ) { int *istime }; 120 | %apply ( int *INPUT ) { int *jule }; 121 | %apply ( int *INPUT ) { int *ietime }; 122 | // Retrieve irregular time series 123 | %apply (int* INPLACE_ARRAY1, int DIM1) {(int *itimes, int ktvals)}; 124 | %apply (double* INPLACE_ARRAY1, int DIM1) {(double *dvalues, int kdvals)}; 125 | %apply (int *OUTPUT) { int *nvals}; 126 | %apply (int *OUTPUT) { int *ibdate}; 127 | %apply ( int *INPUT ) { int *inflag }; 128 | void hec_zritsxd(int *ifltab, 129 | char *cpath, slen_t _cpath_len, 130 | int *juls, int *istime, 131 | int *jule, int *ietime, 132 | int *itimes, int ktvals, 133 | double *dvalues, int kdvals, 134 | int *nvals, 135 | int *ibdate, 136 | char *cunits, 137 | char *ctype, 138 | int *inflag, 139 | int *istat); 140 | //%clear (double* numpyvalues, int nvals); 141 | -------------------------------------------------------------------------------- /requirements_dev.txt: -------------------------------------------------------------------------------- 1 | pip==18.1 2 | wheel==0.32.1 3 | coverage==4.5.1 4 | Sphinx==1.8.1 5 | twine==1.12.1 6 | 7 | pytest==3.8.2 8 | pytest-runner==4.2 9 | -------------------------------------------------------------------------------- /run_test.bat: -------------------------------------------------------------------------------- 1 | setlocal 2 | cd tests 3 | pytest 4 | endlocal 5 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [aliases] 2 | # Define setup.py command aliases here 3 | test = pytest 4 | 5 | [tool:pytest] 6 | collect_ignore = ['setup.py'] 7 | rootdir = tests 8 | 9 | # See the docstring in versioneer.py for instructions. Note that you must 10 | # re-run 'versioneer.py setup' after changing this section, and commit the 11 | # resulting files. 12 | 13 | [versioneer] 14 | VCS = git 15 | style = pep440 16 | versionfile_source = pyhecdss/_version.py 17 | versionfile_build = pyhecdss/_version.py 18 | tag_prefix = 19 | parentdir_prefix = pyhecdss- 20 | 21 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | """ 2 | setup.py file for SWIG example 3 | """ 4 | 5 | #from distutils.core import setup, Extension 6 | import codecs 7 | import os 8 | import platform 9 | import versioneer 10 | from setuptools import setup, Extension, find_packages 11 | 12 | # Third-party modules - we depend on numpy for everything 13 | import re 14 | import numpy 15 | 16 | 17 | def get_numpy_include(): 18 | # Obtain the numpy include directory. This logic works across numpy versions. 19 | try: 20 | numpy_include = numpy.get_include() 21 | except AttributeError: 22 | numpy_include = numpy.get_numpy_include() 23 | return numpy_include 24 | 25 | 26 | ##------------------ VERSIONING BEST PRACTICES --------------------------## 27 | 28 | here = os.path.abspath(os.path.dirname(__file__)) 29 | 30 | 31 | def read(*parts): 32 | with codecs.open(os.path.join(here, *parts), 'r') as fp: 33 | return fp.read() 34 | 35 | 36 | with open('README.rst') as readme_file: 37 | readme = readme_file.read() 38 | 39 | with open('CHANGELOG.rst') as history_file: 40 | history = history_file.read() 41 | 42 | requirements = ["numpy", "pandas"] 43 | 44 | setup_requirements = [] 45 | 46 | test_requirements = ['pytest'] 47 | 48 | 49 | ##------------ COMPILE LINK OPTIONS for Linux and Windows ----------------# 50 | 51 | if platform.system() == 'Linux': 52 | # https://stackoverflow.com/questions/329059/what-is-gxx-personality-v0-for 53 | extra_links = ['-fno-exceptions', '-fno-rtti', '-shared', 54 | '-lgfortran', '-lstdc++'] 55 | libs = ['heclib6-WE'] # linux 56 | libdirs = ['./extensions'] # linux 57 | compile_args = ['-D_GNU_SOURCE', '-fno-exceptions'] # linux 58 | elif platform.system() == 'Windows': 59 | extra_links = ["/NODEFAULTLIB:LIBCMT"] 60 | libs = ['extensions/heclib6-VE', ] 61 | libdirs = [] 62 | compile_args = [] 63 | else: 64 | raise Exception("Unknown platform: "+platform.system()+"! You are on your own") 65 | 66 | 67 | # check_numpy_i() #--This is failing due SSL certificate issue 68 | # 69 | pyheclib_module = Extension('pyhecdss._pyheclib', 70 | sources=['pyhecdss/pyheclib.i', 71 | 'pyhecdss/hecwrapper.c'], 72 | swig_opts=['-py3', ], 73 | libraries=libs, 74 | library_dirs=libdirs, 75 | extra_compile_args=compile_args, 76 | extra_link_args=extra_links, 77 | include_dirs=[get_numpy_include()], 78 | ) 79 | 80 | setup(name='pyhecdss', 81 | author="Nicky Sandhu", 82 | author_email='psandhu@water.ca.gov', 83 | version=versioneer.get_version(), 84 | cmdclass=versioneer.get_cmdclass(), 85 | classifiers=[ 86 | 'Development Status :: 2 - Pre-Alpha', 87 | 'Intended Audience :: Developers', 88 | 'License :: OSI Approved :: MIT License', 89 | 'Natural Language :: English', 90 | 'Programming Language :: Python :: 3', 91 | 'Programming Language :: Python :: 3.4', 92 | 'Programming Language :: Python :: 3.5', 93 | 'Programming Language :: Python :: 3.6', 94 | 'Programming Language :: Python :: 3.7', 95 | ], 96 | description="For reading/writing HEC-DSS files", 97 | install_requires=requirements, 98 | license="MIT license", 99 | long_description=readme + '\n\n' + history, 100 | include_package_data=True, 101 | keywords='pyhecdss', 102 | packages=find_packages(include=['pyhecdss']), 103 | setup_requires=setup_requirements, 104 | python_requires='~=3.5', 105 | test_suite='tests', 106 | tests_require=test_requirements, 107 | url='https://github.com/dwr-psandhu/pyhecdss', 108 | zip_safe=False, 109 | ext_modules=[pyheclib_module], 110 | ) 111 | -------------------------------------------------------------------------------- /setup_dev_env.bat: -------------------------------------------------------------------------------- 1 | rem setup development environment 2 | conda create -n dev_pyhecdss 3 | conda activate dev_pyhecdss 4 | conda install -c defaults -c conda-forge conda conda-build nbsphinx numpy pandas sphinx 5 | rem conda install pytest-runner 6 | rem conda install -c defaults -c conda-forge swig>=4 -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- 1 | #added to allow relative package imports 2 | -------------------------------------------------------------------------------- /tests/pytest.ini: -------------------------------------------------------------------------------- 1 | # File determines the root directory for tests 2 | -------------------------------------------------------------------------------- /tests/test1.dss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CADWRDeltaModeling/pyhecdss/bc7af6f6a102c0f56edb18b1a4d2bc30d8b71692/tests/test1.dss -------------------------------------------------------------------------------- /tests/test_catalog.dsc: -------------------------------------------------------------------------------- 1 | 2 | HECDSS Complete Catalog of Record Pathnames in File observed_cdec/cdec_ec_cleaned.dss 3 | 4 | Catalog Created on Sep 15, 2020 at 17:33 File Created on Aug 17, 2020 5 | Number of Records: 26413 DSS Version 6-VE, File 6-VE 6 | Sort Order: ABCFED 7 | 8 | Ref. 9 | Number Tag Record Pathname 10 | 11 | 23817 T14927 /CDEC/TMS/EC/01NOV2002/15MIN/100-E/ 12 | 23818 T14928 /CDEC/TMS/EC/01DEC2002/15MIN/100-E/ 13 | 23819 T14929 /CDEC/TMS/EC/01JAN2003/15MIN/100-E/ 14 | 23820 T14930 /CDEC/TMS/EC/01FEB2003/15MIN/100-E/ 15 | 23821 T14931 /CDEC/TMS/EC/01MAR2003/15MIN/100-E/ 16 | 23822 T14932 /CDEC/TMS/EC/01APR2003/15MIN/100-E/ 17 | 23823 T14933 /CDEC/TMS/EC/01MAY2003/15MIN/100-E/ 18 | 23824 T14934 /CDEC/TMS/EC/01JUN2003/15MIN/100-E/ 19 | 23825 T14935 /CDEC/TMS/EC/01JUL2003/15MIN/100-E/ 20 | 23826 T14936 /CDEC/TMS/EC/01AUG2003/15MIN/100-E/ 21 | 23827 T14937 /CDEC/TMS/EC/01SEP2003/15MIN/100-E/ 22 | 23828 T14938 /CDEC/TMS/EC/01OCT2003/15MIN/100-E/ 23 | 23829 T14939 /CDEC/TMS/EC/01NOV2003/15MIN/100-E/ 24 | 23830 T14940 /CDEC/TMS/EC/01DEC2003/15MIN/100-E/ 25 | 23831 T14941 /CDEC/TMS/EC/01JAN2004/15MIN/100-E/ 26 | 23832 T14942 /CDEC/TMS/EC/01FEB2004/15MIN/100-E/ 27 | 23833 T14943 /CDEC/TMS/EC/01MAR2004/15MIN/100-E/ 28 | 23834 T14944 /CDEC/TMS/EC/01APR2004/15MIN/100-E/ 29 | 23835 T14945 /CDEC/TMS/EC/01MAY2004/15MIN/100-E/ 30 | 23836 T14946 /CDEC/TMS/EC/01JUN2004/15MIN/100-E/ 31 | 23837 T14947 /CDEC/TMS/EC/01JUL2004/15MIN/100-E/ 32 | 23838 T14948 /CDEC/TMS/EC/01AUG2004/15MIN/100-E/ 33 | 23839 T14949 /CDEC/TMS/EC/01SEP2004/15MIN/100-E/ 34 | 23840 T14950 /CDEC/TMS/EC/01OCT2004/15MIN/100-E/ 35 | 23841 T14951 /CDEC/TMS/EC/01NOV2004/15MIN/100-E/ 36 | 23842 T14952 /CDEC/TMS/EC/01DEC2004/15MIN/100-E/ 37 | 23843 T14953 /CDEC/TMS/EC/01JAN2005/15MIN/100-E/ 38 | 23844 T14954 /CDEC/TMS/EC/01FEB2005/15MIN/100-E/ 39 | 23845 T14955 /CDEC/TMS/EC/01MAR2005/15MIN/100-E/ 40 | 23846 T14956 /CDEC/TMS/EC/01APR2005/15MIN/100-E/ 41 | 23847 T14957 /CDEC/TMS/EC/01MAY2005/15MIN/100-E/ 42 | 23848 T14958 /CDEC/TMS/EC/01JUN2005/15MIN/100-E/ 43 | 23849 T14959 /CDEC/TMS/EC/01JUL2005/15MIN/100-E/ 44 | 23850 T14960 /CDEC/TMS/EC/01AUG2005/15MIN/100-E/ 45 | 23851 T14961 /CDEC/TMS/EC/01SEP2005/15MIN/100-E/ 46 | 23852 T14962 /CDEC/TMS/EC/01OCT2005/15MIN/100-E/ 47 | 23853 T14963 /CDEC/TMS/EC/01NOV2005/15MIN/100-E/ 48 | 23854 T14964 /CDEC/TMS/EC/01DEC2005/15MIN/100-E/ 49 | 23855 T14965 /CDEC/TMS/EC/01JAN2006/15MIN/100-E/ 50 | 23856 T14966 /CDEC/TMS/EC/01FEB2006/15MIN/100-E/ 51 | 23857 T14967 /CDEC/TMS/EC/01MAR2006/15MIN/100-E/ 52 | 23858 T14968 /CDEC/TMS/EC/01APR2006/15MIN/100-E/ 53 | 23859 T14969 /CDEC/TMS/EC/01MAY2006/15MIN/100-E/ 54 | 23860 T14970 /CDEC/TMS/EC/01JUN2006/15MIN/100-E/ 55 | 23861 T14971 /CDEC/TMS/EC/01JUL2006/15MIN/100-E/ 56 | 23862 T14972 /CDEC/TMS/EC/01AUG2006/15MIN/100-E/ 57 | 23863 T14973 /CDEC/TMS/EC/01SEP2006/15MIN/100-E/ 58 | 23864 T14974 /CDEC/TMS/EC/01OCT2006/15MIN/100-E/ 59 | 23865 T14975 /CDEC/TMS/EC/01NOV2006/15MIN/100-E/ 60 | 23866 T14976 /CDEC/TMS/EC/01DEC2006/15MIN/100-E/ 61 | 23867 T14977 /CDEC/TMS/EC/01JAN2007/15MIN/100-E/ 62 | 23868 T14978 /CDEC/TMS/EC/01FEB2007/15MIN/100-E/ 63 | 23869 T14979 /CDEC/TMS/EC/01MAR2007/15MIN/100-E/ 64 | 23870 T14980 /CDEC/TMS/EC/01APR2007/15MIN/100-E/ 65 | 23871 T14981 /CDEC/TMS/EC/01MAY2007/15MIN/100-E/ 66 | 23872 T14982 /CDEC/TMS/EC/01JUN2007/15MIN/100-E/ 67 | 23873 T14983 /CDEC/TMS/EC/01JUL2007/15MIN/100-E/ 68 | 23874 T14984 /CDEC/TMS/EC/01AUG2007/15MIN/100-E/ 69 | 23875 T14985 /CDEC/TMS/EC/01SEP2007/15MIN/100-E/ 70 | 23876 T14986 /CDEC/TMS/EC/01OCT2007/15MIN/100-E/ 71 | 23877 T14987 /CDEC/TMS/EC/01NOV2007/15MIN/100-E/ 72 | 23878 T14988 /CDEC/TMS/EC/01DEC2007/15MIN/100-E/ 73 | 23879 T14989 /CDEC/TMS/EC/01JAN2008/15MIN/100-E/ 74 | 23880 T14990 /CDEC/TMS/EC/01FEB2008/15MIN/100-E/ 75 | 23881 T14991 /CDEC/TMS/EC/01MAR2008/15MIN/100-E/ 76 | 23882 T14992 /CDEC/TMS/EC/01APR2008/15MIN/100-E/ 77 | 23883 T14993 /CDEC/TMS/EC/01MAY2008/15MIN/100-E/ 78 | 23884 T14994 /CDEC/TMS/EC/01JUN2008/15MIN/100-E/ 79 | 23885 T14995 /CDEC/TMS/EC/01JUL2008/15MIN/100-E/ 80 | 23886 T14996 /CDEC/TMS/EC/01AUG2008/15MIN/100-E/ 81 | 23887 T14997 /CDEC/TMS/EC/01SEP2008/15MIN/100-E/ 82 | 23888 T14998 /CDEC/TMS/EC/01OCT2008/15MIN/100-E/ 83 | 23889 T14999 /CDEC/TMS/EC/01NOV2008/15MIN/100-E/ 84 | 23890 T15000 /CDEC/TMS/EC/01DEC2008/15MIN/100-E/ 85 | 23891 T15001 /CDEC/TMS/EC/01JAN2009/15MIN/100-E/ 86 | 23892 T15002 /CDEC/TMS/EC/01FEB2009/15MIN/100-E/ 87 | 23893 T15003 /CDEC/TMS/EC/01MAR2009/15MIN/100-E/ 88 | 23894 T15004 /CDEC/TMS/EC/01APR2009/15MIN/100-E/ 89 | 23895 T15005 /CDEC/TMS/EC/01MAY2009/15MIN/100-E/ 90 | 23896 T15006 /CDEC/TMS/EC/01JUN2009/15MIN/100-E/ 91 | 23897 T15007 /CDEC/TMS/EC/01JUL2009/15MIN/100-E/ 92 | 23898 T15008 /CDEC/TMS/EC/01AUG2009/15MIN/100-E/ 93 | 23899 T15009 /CDEC/TMS/EC/01SEP2009/15MIN/100-E/ 94 | 23900 T15010 /CDEC/TMS/EC/01OCT2009/15MIN/100-E/ 95 | 23901 T15011 /CDEC/TMS/EC/01NOV2009/15MIN/100-E/ 96 | 23902 T15012 /CDEC/TMS/EC/01DEC2009/15MIN/100-E/ 97 | 23903 T15013 /CDEC/TMS/EC/01JAN2010/15MIN/100-E/ 98 | 23904 T15014 /CDEC/TMS/EC/01FEB2010/15MIN/100-E/ 99 | 23905 T15015 /CDEC/TMS/EC/01MAR2010/15MIN/100-E/ 100 | 23906 T15016 /CDEC/TMS/EC/01APR2010/15MIN/100-E/ 101 | 23907 T15017 /CDEC/TMS/EC/01MAY2010/15MIN/100-E/ 102 | 23908 T15018 /CDEC/TMS/EC/01JUN2010/15MIN/100-E/ 103 | 23909 T15019 /CDEC/TMS/EC/01JUL2010/15MIN/100-E/ 104 | 23910 T15020 /CDEC/TMS/EC/01AUG2010/15MIN/100-E/ 105 | 23911 T15021 /CDEC/TMS/EC/01SEP2010/15MIN/100-E/ 106 | 23912 T15022 /CDEC/TMS/EC/01OCT2010/15MIN/100-E/ 107 | 23913 T15023 /CDEC/TMS/EC/01NOV2010/15MIN/100-E/ 108 | 23914 T15024 /CDEC/TMS/EC/01DEC2010/15MIN/100-E/ 109 | 23915 T15025 /CDEC/TMS/EC/01JAN2011/15MIN/100-E/ 110 | 23916 T15026 /CDEC/TMS/EC/01FEB2011/15MIN/100-E/ 111 | 23917 T15027 /CDEC/TMS/EC/01MAR2011/15MIN/100-E/ 112 | 23918 T15028 /CDEC/TMS/EC/01APR2011/15MIN/100-E/ 113 | 23919 T15029 /CDEC/TMS/EC/01MAY2011/15MIN/100-E/ 114 | 23920 T15030 /CDEC/TMS/EC/01JUN2011/15MIN/100-E/ 115 | 23921 T15031 /CDEC/TMS/EC/01JUL2011/15MIN/100-E/ 116 | 23922 T15032 /CDEC/TMS/EC/01AUG2011/15MIN/100-E/ 117 | 23923 T15033 /CDEC/TMS/EC/01SEP2011/15MIN/100-E/ 118 | 23924 T15034 /CDEC/TMS/EC/01OCT2011/15MIN/100-E/ 119 | 23925 T15035 /CDEC/TMS/EC/01NOV2011/15MIN/100-E/ 120 | 23926 T15036 /CDEC/TMS/EC/01DEC2011/15MIN/100-E/ 121 | 23927 T15037 /CDEC/TMS/EC/01JAN2012/15MIN/100-E/ 122 | 23928 T15038 /CDEC/TMS/EC/01FEB2012/15MIN/100-E/ 123 | 23929 T15039 /CDEC/TMS/EC/01MAR2012/15MIN/100-E/ 124 | 23930 T15040 /CDEC/TMS/EC/01APR2012/15MIN/100-E/ 125 | 23931 T15041 /CDEC/TMS/EC/01MAY2012/15MIN/100-E/ 126 | 23932 T15042 /CDEC/TMS/EC/01JUN2012/15MIN/100-E/ 127 | 23933 T15043 /CDEC/TMS/EC/01JUL2012/15MIN/100-E/ 128 | 23934 T15044 /CDEC/TMS/EC/01AUG2012/15MIN/100-E/ 129 | 23935 T15045 /CDEC/TMS/EC/01SEP2012/15MIN/100-E/ 130 | 23936 T15046 /CDEC/TMS/EC/01OCT2012/15MIN/100-E/ 131 | 23937 T15047 /CDEC/TMS/EC/01NOV2012/15MIN/100-E/ 132 | 23938 T15048 /CDEC/TMS/EC/01DEC2012/15MIN/100-E/ 133 | 23939 T15049 /CDEC/TMS/EC/01JAN2013/15MIN/100-E/ 134 | 23940 T15050 /CDEC/TMS/EC/01FEB2013/15MIN/100-E/ 135 | 23941 T15051 /CDEC/TMS/EC/01MAR2013/15MIN/100-E/ 136 | 23942 T15052 /CDEC/TMS/EC/01APR2013/15MIN/100-E/ 137 | 23943 T15053 /CDEC/TMS/EC/01MAY2013/15MIN/100-E/ 138 | 23944 T15054 /CDEC/TMS/EC/01JUN2013/15MIN/100-E/ 139 | 23945 T15055 /CDEC/TMS/EC/01JUL2013/15MIN/100-E/ 140 | 23946 T15056 /CDEC/TMS/EC/01AUG2013/15MIN/100-E/ 141 | 23947 T15057 /CDEC/TMS/EC/01SEP2013/15MIN/100-E/ 142 | 23948 T15058 /CDEC/TMS/EC/01OCT2013/15MIN/100-E/ 143 | 23949 T15059 /CDEC/TMS/EC/01NOV2013/15MIN/100-E/ 144 | 23950 T15060 /CDEC/TMS/EC/01DEC2013/15MIN/100-E/ 145 | 23951 T15061 /CDEC/TMS/EC/01JAN2014/15MIN/100-E/ 146 | 23952 T15062 /CDEC/TMS/EC/01FEB2014/15MIN/100-E/ 147 | 23953 T15063 /CDEC/TMS/EC/01MAR2014/15MIN/100-E/ 148 | 23954 T15064 /CDEC/TMS/EC/01APR2014/15MIN/100-E/ 149 | 23955 T15065 /CDEC/TMS/EC/01MAY2014/15MIN/100-E/ 150 | 23956 T15066 /CDEC/TMS/EC/01JUN2014/15MIN/100-E/ 151 | 23957 T15067 /CDEC/TMS/EC/01JUL2014/15MIN/100-E/ 152 | 23958 T15068 /CDEC/TMS/EC/01AUG2014/15MIN/100-E/ 153 | 23959 T15069 /CDEC/TMS/EC/01SEP2014/15MIN/100-E/ 154 | 23960 T15070 /CDEC/TMS/EC/01OCT2014/15MIN/100-E/ 155 | 23961 T15071 /CDEC/TMS/EC/01NOV2014/15MIN/100-E/ 156 | 23962 T15072 /CDEC/TMS/EC/01DEC2014/15MIN/100-E/ 157 | 23963 T15073 /CDEC/TMS/EC/01JAN2015/15MIN/100-E/ 158 | 23964 T15074 /CDEC/TMS/EC/01FEB2015/15MIN/100-E/ 159 | 23965 T15075 /CDEC/TMS/EC/01MAR2015/15MIN/100-E/ 160 | 23966 T15076 /CDEC/TMS/EC/01APR2015/15MIN/100-E/ 161 | 23967 T15077 /CDEC/TMS/EC/01MAY2015/15MIN/100-E/ 162 | 23968 T15078 /CDEC/TMS/EC/01JUN2015/15MIN/100-E/ 163 | 23969 T15079 /CDEC/TMS/EC/01JUL2015/15MIN/100-E/ 164 | 23970 T15080 /CDEC/TMS/EC/01AUG2015/15MIN/100-E/ 165 | 23971 T15081 /CDEC/TMS/EC/01SEP2015/15MIN/100-E/ 166 | 23972 T15082 /CDEC/TMS/EC/01OCT2015/15MIN/100-E/ 167 | 23973 T15083 /CDEC/TMS/EC/01NOV2015/15MIN/100-E/ 168 | 23974 T15084 /CDEC/TMS/EC/01DEC2015/15MIN/100-E/ 169 | 23975 T15085 /CDEC/TMS/EC/01JAN2016/15MIN/100-E/ 170 | 23976 T15086 /CDEC/TMS/EC/01FEB2016/15MIN/100-E/ 171 | 23977 T15087 /CDEC/TMS/EC/01MAR2016/15MIN/100-E/ 172 | 23978 T15088 /CDEC/TMS/EC/01APR2016/15MIN/100-E/ 173 | 23979 T15089 /CDEC/TMS/EC/01MAY2016/15MIN/100-E/ 174 | 23980 T15090 /CDEC/TMS/EC/01JUN2016/15MIN/100-E/ 175 | 23981 T15091 /CDEC/TMS/EC/01JUL2016/15MIN/100-E/ 176 | 23982 T15092 /CDEC/TMS/EC/01AUG2016/15MIN/100-E/ 177 | 23983 T15093 /CDEC/TMS/EC/01SEP2016/15MIN/100-E/ 178 | 23984 T15094 /CDEC/TMS/EC/01OCT2016/15MIN/100-E/ 179 | 23985 T15095 /CDEC/TMS/EC/01NOV2016/15MIN/100-E/ 180 | 23986 T15096 /CDEC/TMS/EC/01DEC2016/15MIN/100-E/ 181 | 23987 T15097 /CDEC/TMS/EC/01JAN2017/15MIN/100-E/ 182 | 23988 T15098 /CDEC/TMS/EC/01FEB2017/15MIN/100-E/ 183 | 23989 T15099 /CDEC/TMS/EC/01MAR2017/15MIN/100-E/ 184 | 23990 T15100 /CDEC/TMS/EC/01APR2017/15MIN/100-E/ 185 | 23991 T15101 /CDEC/TMS/EC/01MAY2017/15MIN/100-E/ 186 | 23992 T15102 /CDEC/TMS/EC/01JUN2017/15MIN/100-E/ 187 | 23993 T15103 /CDEC/TMS/EC/01JUL2017/15MIN/100-E/ 188 | 23994 T15104 /CDEC/TMS/EC/01AUG2017/15MIN/100-E/ 189 | 23995 T15105 /CDEC/TMS/EC/01SEP2017/15MIN/100-E/ 190 | 23996 T15106 /CDEC/TMS/EC/01OCT2017/15MIN/100-E/ 191 | 23997 T15107 /CDEC/TMS/EC/01NOV2017/15MIN/100-E/ 192 | 23998 T15108 /CDEC/TMS/EC/01DEC2017/15MIN/100-E/ 193 | 23999 T15109 /CDEC/TMS/EC/01JAN2018/15MIN/100-E/ 194 | 24000 T15110 /CDEC/TMS/EC/01FEB2018/15MIN/100-E/ 195 | 24001 T15111 /CDEC/TMS/EC/01MAR2018/15MIN/100-E/ 196 | 24002 T15112 /CDEC/TMS/EC/01APR2018/15MIN/100-E/ 197 | 24003 T15113 /CDEC/TMS/EC/01MAY2018/15MIN/100-E/ 198 | 24004 T15114 /CDEC/TMS/EC/01JUN2018/15MIN/100-E/ 199 | 24005 T15115 /CDEC/TMS/EC/01JUL2018/15MIN/100-E/ 200 | 24006 T15116 /CDEC/TMS/EC/01AUG2018/15MIN/100-E/ 201 | 24007 T15117 /CDEC/TMS/EC/01SEP2018/15MIN/100-E/ 202 | 24008 T15118 /CDEC/TMS/EC/01OCT2018/15MIN/100-E/ 203 | 24009 T15119 /CDEC/TMS/EC/01NOV2018/15MIN/100-E/ 204 | 24010 T15120 /CDEC/TMS/EC/01DEC2018/15MIN/100-E/ 205 | 24011 T15121 /CDEC/TMS/EC/01JAN2019/15MIN/100-E/ 206 | 24012 T15122 /CDEC/TMS/EC/01FEB2019/15MIN/100-E/ 207 | 24013 T15123 /CDEC/TMS/EC/01MAR2019/15MIN/100-E/ 208 | 24014 T15124 /CDEC/TMS/EC/01APR2019/15MIN/100-E/ 209 | 24015 T15125 /CDEC/TMS/EC/01MAY2019/15MIN/100-E/ 210 | 24016 T15126 /CDEC/TMS/EC/01JUN2019/15MIN/100-E/ 211 | 24017 T15127 /CDEC/TMS/EC/01JUL2019/15MIN/100-E/ 212 | 24018 T15128 /CDEC/TMS/EC/01AUG2019/15MIN/100-E/ 213 | 24019 T15129 /CDEC/TMS/EC/01SEP2019/15MIN/100-E/ 214 | 24020 T15130 /CDEC/TMS/EC/01OCT2019/15MIN/100-E/ 215 | 24021 T15131 /CDEC/TMS/EC/01NOV2019/15MIN/100-E/ 216 | 24022 T15132 /CDEC/TMS/EC/01DEC2019/15MIN/100-E/ 217 | -------------------------------------------------------------------------------- /tests/test_catalog_dsc_read.py: -------------------------------------------------------------------------------- 1 | import pyhecdss 2 | import pandas as pd 3 | import numpy as np 4 | import os 5 | 6 | 7 | def test_catalog_dsc_read(): 8 | dfc = pyhecdss.DSSFile._read_catalog_dsc('test_catalog.dsc') 9 | assert len(dfc) == 1 10 | assert dfc.loc[0, 'D'] == '01NOV2002 - 01DEC2019' 11 | 12 | 13 | def test_catalog_dsc_read_failing(): 14 | ''' 15 | Case with missing T column. Looks like its an option when cataloging a DSS file 16 | ''' 17 | dfc = pyhecdss.DSSFile._read_catalog_dsc('test_failing_catalog.dsc') 18 | assert len(dfc) == 4 19 | assert dfc.loc[0, 'D'] == '01JAN1915 - 01JAN2015' 20 | -------------------------------------------------------------------------------- /tests/test_helper.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Tests helper function 3 | ''' 4 | import pytest 5 | import pyhecdss 6 | 7 | 8 | @pytest.mark.parametrize("pathname", ["//SIN/////", "/SAMPLE/SIN/////", "///WAVE////", "/SAMPLE/SIN/WAVE/01JAN1990/15MIN/SAMPLE1/","///wAvE////"]) 9 | def test_get_rts(pathname): 10 | filename = 'test1.dss' 11 | matching_list = list(pyhecdss.get_ts(filename, pathname)) 12 | assert len(matching_list) == 1 13 | dfsin, units, ptype = matching_list[0] 14 | assert len(dfsin) > 10 15 | 16 | 17 | @pytest.mark.parametrize("pathname", ["//S.*/////", "/S.*PLE/S.*N/////", "///WAV.*////", "/SAMPLE/SIN/WAVE/01JAN1990/15MIN/SAMPLE1/", "/saMpLE/sIn/w.*e////"]) 18 | def test_get_matching_rts(pathname): 19 | filename = 'test1.dss' 20 | matching_list = list(pyhecdss.get_matching_ts(filename, pathname)) 21 | assert len(matching_list) == 1 22 | dfsin, units, ptype = matching_list[0] 23 | assert len(dfsin) > 10 24 | 25 | 26 | @pytest.mark.parametrize("pathname", ["/////IR-YEAR//", ]) 27 | def test_get_ts(pathname): 28 | filename = 'test1.dss' 29 | matching_list = list(pyhecdss.get_ts(filename, pathname)) 30 | assert len(matching_list) == 2 31 | dfsin, units, ptype = matching_list[0] 32 | assert len(dfsin) > 1 33 | 34 | 35 | @pytest.mark.parametrize("pathname", ["/.*//////", "//.*/////", "///.*////", "////.*///", "/////.*//", "//////.*/"]) 36 | def test_get_matching_ts(pathname): 37 | filename = 'test1.dss' 38 | matching_list = list(pyhecdss.get_matching_ts(filename, pathname)) 39 | assert len(matching_list) == 3 40 | dfsin, units, ptype = matching_list[0] 41 | assert len(dfsin) > 1 42 | 43 | def test_non_existent_file(): 44 | filename='test_non_existent.dss' 45 | with pytest.raises(Exception): 46 | matching_list=list(pyhecdss.get_matching_ts(filename,'///////')) 47 | import os 48 | assert not os.path.exists(filename) 49 | -------------------------------------------------------------------------------- /tests/test_peraver.py: -------------------------------------------------------------------------------- 1 | import pyhecdss 2 | import pandas as pd 3 | import numpy as np 4 | import os 5 | 6 | 7 | def test_read_write_cycle_rts(): 8 | ''' 9 | Test reading and writing of period time stamped data so 10 | that reads and writes don't result in shifting the data 11 | ''' 12 | fname = "test2.dss" 13 | if os.path.exists(fname): 14 | os.remove(fname) 15 | path = '/SAMPLE/SIN/WAVE/01JAN1990 - 01JAN1990/15MIN/SAMPLE1/' 16 | sina = np.sin(np.linspace(-np.pi, np.pi, 201)) 17 | dfr = pd.DataFrame(sina, 18 | index=pd.period_range('01jan1990 0100', periods=len(sina), freq='15min'), 19 | columns=[path]) 20 | 21 | d = pyhecdss.DSSFile(fname, create_new=True) 22 | unit2, ptype2 = 'UNIT-X', 'PER-VAL' 23 | d.write_rts(path, dfr, unit2, ptype2) 24 | d.close() 25 | # 26 | d2 = pyhecdss.DSSFile(fname) 27 | plist2 = d2.get_pathnames() 28 | path = plist2[0] 29 | dfr2, unit2, ptype2 = d.read_rts(path) 30 | pd.testing.assert_frame_equal(dfr, dfr2) 31 | -------------------------------------------------------------------------------- /tests/test_pyhecdss.py: -------------------------------------------------------------------------------- 1 | from pyhecdss.pyhecdss import DSSFile 2 | import unittest 3 | import pytest 4 | import pyhecdss 5 | import numpy as np 6 | import pandas as pd 7 | import os 8 | 9 | 10 | class TestPyDsUtilsBasic(unittest.TestCase): 11 | 12 | def cleanTempFiles(): 13 | file_list = ['./test_rts1.dss', 14 | './test_rts1.dsc', 15 | './test_rts1.dsd', 16 | './test_its1.dss', 17 | './test_its1.dsc', 18 | './test_its1.dsd', 19 | './test.dsc', 20 | './test.dsd', 21 | './test.dsc', 22 | './test.dsd', 23 | './test.dsk', 24 | './test_offset.dss', 25 | './test_rts1.dss', 26 | './test2.dss', 27 | './testnew.dss'] 28 | 29 | for file in file_list: 30 | try: 31 | os.remove(file) 32 | except OSError: 33 | pass 34 | 35 | @ classmethod 36 | def setupClass(cls): 37 | cls.cleanTempFiles() 38 | 39 | @ classmethod 40 | def tearDownClass(cls): 41 | cls.cleanTempFiles() 42 | 43 | def test_with(self): 44 | with pyhecdss.DSSFile('test1.dss') as d: 45 | assert len(d.read_catalog()) > 0 46 | 47 | def test_open_close(self): 48 | fname = "test1.dss" 49 | dssfile = pyhecdss.DSSFile(fname) 50 | dssfile.open() 51 | dssfile.close() 52 | 53 | def test_catalog(self): 54 | fname = "test1.dss" 55 | with pyhecdss.DSSFile(fname) as dssfile: 56 | dssfile.catalog() 57 | self.assertTrue(os.path.exists('test1.dsc')) 58 | self.assertTrue(os.path.exists('test1.dsd')) 59 | 60 | def test_read_ts(self): 61 | fname = "test1.dss" 62 | pathname = '/SAMPLE/SIN/WAVE/01JAN1990/15MIN/SAMPLE1/' 63 | sdate = '01JAN1990' 64 | edate = '31JAN1990' 65 | with pyhecdss.DSSFile(fname) as dssfile: 66 | values, units, periodtype = dssfile.read_rts(pathname, sdate, edate) 67 | self.assertEqual(units, 'UNIT-X') 68 | self.assertEqual(periodtype, 'INST-VAL') 69 | self.assertEqual(len(values['10JAN1990': '11JAN1990'].values), 70 | 96*2) # 96 15 min values per day 71 | # get series 72 | vseries = values.iloc[:, 0] 73 | self.assertTrue(abs(vseries.at['01JAN1990 0430']-(-0.42578)) < 1e-03) 74 | 75 | def test_write_ts(self): 76 | fname = "test_rts1.dss" 77 | pathname = '/TEST1/ONLY1/VANILLA//1DAY/JUST-ONES/' 78 | startDateStr, endDateStr = '01JAN1990 0100', '01JAN1991 0100' 79 | dtr = pd.date_range(startDateStr, endDateStr, freq='1D') 80 | df = pd.DataFrame(np.ones(len(dtr), 'd'), index=dtr) 81 | cunits, ctype = 'CCC', 'INST-VAL' 82 | with pyhecdss.DSSFile(fname, create_new=True) as dssfile2: 83 | dssfile2.write_rts(pathname, df, cunits, ctype) 84 | startDateStr = "01JAN1990" 85 | endDateStr = "01JAN1991" 86 | with pyhecdss.DSSFile(fname) as dssfile1: 87 | df2, cunits2, ctype2 = dssfile1.read_rts(pathname, startDateStr, endDateStr) 88 | self.assertEqual(ctype, ctype2) 89 | self.assertEqual(cunits, cunits2) 90 | self.assertEqual(1, df.iloc[0, 0]) 91 | 92 | def test_write_rts_series(self): 93 | ''' 94 | write_rts should work with pandas.Series as well. 95 | ''' 96 | fname = "test_rts1.dss" 97 | pathname = '/TEST1/ONLY1/VANILLA//1DAY/JUST-ONES-SERIES/' 98 | startDateStr, endDateStr = '01JAN1990 0100', '01JAN1991 0100' 99 | dtr = pd.date_range(startDateStr, endDateStr, freq='1D') 100 | s = pd.Series(np.ones(len(dtr), 'd'), index=dtr) 101 | cunits, ctype = 'CCC', 'INST-VAL' 102 | with pyhecdss.DSSFile(fname, create_new=True) as dssfile2: 103 | dssfile2.write_rts(pathname, s, cunits, ctype) 104 | startDateStr = "01JAN1990" 105 | endDateStr = "01JAN1991" 106 | with pyhecdss.DSSFile(fname) as dssfile1: 107 | df2, cunits2, ctype2 = dssfile1.read_rts(pathname, startDateStr, endDateStr) 108 | self.assertEqual(ctype, ctype2) 109 | self.assertEqual(cunits, cunits2) 110 | self.assertEqual(1, s.iloc[0]) 111 | 112 | def test_read_its(self): 113 | fname = "test1.dss" 114 | pathname = '/SAMPLE/ITS1/RANDOM/01JAN1990 - 01JAN1992/IR-YEAR/SAMPLE2/' 115 | with pyhecdss.DSSFile(fname) as dssfile: 116 | values, units, periodtype = dssfile.read_its(pathname) 117 | self.assertEqual(units, 'YYY') 118 | self.assertEqual(periodtype, 'INST-VAL') 119 | self.assertEqual(len(values), 3) 120 | # get series 121 | vseries = values.iloc[:, 0] 122 | self.assertTrue(abs(vseries.at['01JAN1990 0317']-1.5) < 1e-03) 123 | self.assertTrue(abs(vseries.at['05SEP1992 2349']-2.7) < 1e-03) 124 | 125 | def test_read_its_tw(self): 126 | # issue #26 127 | fname = "test1.dss" 128 | pathname = '/SAMPLE/ITS1/RANDOM/01JAN1990 0143 - 01JAN1992/IR-YEAR/SAMPLE2/' 129 | with pyhecdss.DSSFile(fname) as dssfile: 130 | values, units, periodtype = dssfile.read_its(pathname) 131 | self.assertEqual(units, 'YYY') 132 | self.assertEqual(periodtype, 'INST-VAL') 133 | self.assertEqual(len(values), 3) 134 | 135 | def test_write_its(self): 136 | fname = "test1.dss" 137 | pathname = '/TEST/ITS1/VANILLA//IR-YEAR/RANDOM/' 138 | ta = pd.to_datetime(['01apr1990', '05nov1991', '07apr1997'], format='%d%b%Y') 139 | df = pd.DataFrame([0.5, 0.6, 0.7], index=ta, columns=["random"]) 140 | cunits, ctype = 'CCC', 'INST-VAL' 141 | with pyhecdss.DSSFile(fname) as dssfile2: 142 | dssfile2.write_its(pathname, df, cunits, ctype) 143 | with pyhecdss.DSSFile(fname) as dssfile1: 144 | df2, cunits2, ctype2 = dssfile1.read_its(pathname, "01JAN1990", "01JAN1998") 145 | self.assertEqual(ctype, ctype2) 146 | self.assertEqual(cunits, cunits2) 147 | self.assertEqual(df2.iloc[0, 0], df.iloc[0, 0]) 148 | self.assertEqual(df2.iloc[1, 0], df.iloc[1, 0]) 149 | self.assertEqual(df2.iloc[2, 0], df.iloc[2, 0]) 150 | 151 | def test_write_its_series(self): 152 | fname = "test1.dss" 153 | pathname = '/TEST/ITS1/VANILLA//IR-YEAR/RANDOM/' 154 | ta = pd.to_datetime(['01apr1990', '05nov1991', '07apr1997'], format='%d%b%Y') 155 | df = pd.Series([0.5, 0.6, 0.7], index=ta) 156 | cunits, ctype = 'CCC', 'INST-VAL' 157 | with pyhecdss.DSSFile(fname) as dssfile2: 158 | dssfile2.write_its(pathname, df, cunits, ctype) 159 | with pyhecdss.DSSFile(fname) as dssfile1: 160 | df2, cunits2, ctype2 = dssfile1.read_its(pathname, "01JAN1990", "01JAN1998") 161 | self.assertEqual(ctype, ctype2) 162 | self.assertEqual(cunits, cunits2) 163 | self.assertEqual(df2.iloc[0, 0], df.iloc[0]) 164 | self.assertEqual(df2.iloc[1, 0], df.iloc[1]) 165 | self.assertEqual(df2.iloc[2, 0], df.iloc[2]) 166 | 167 | def test_read_catalog(self): 168 | fname = "test1.dss" 169 | with pyhecdss.DSSFile(fname) as dssfile: 170 | df = dssfile.read_catalog() 171 | self.assertTrue(len(df) >= 1) 172 | 173 | def test_get_pathnames(self): 174 | fname = "test1.dss" 175 | with pyhecdss.DSSFile(fname) as dssfile: 176 | pathnames = dssfile.get_pathnames() 177 | self.assertTrue(len(pathnames) > 0) 178 | 179 | def test_version(self): 180 | fname = "test1.dss" 181 | cver, iver = pyhecdss.get_version(fname) 182 | self.assertEqual(6, iver) 183 | self.assertEqual('6-VE', cver) 184 | 185 | def test_set_message_level(self): 186 | fname = "test1.dss" 187 | print("No easy way to check automatically. Just look at screen and see if lot of messages are printed?") 188 | pyhecdss.set_message_level(10) 189 | with pyhecdss.DSSFile(fname) as d1: 190 | d1.close() 191 | print('No easy way to check automatically. Just look at screen and no DSS messages should be printed') 192 | pyhecdss.set_message_level(0) 193 | with pyhecdss.DSSFile(fname) as d1: 194 | d1.close() 195 | 196 | def test_except_on_bad_path(self): 197 | fname = "test1.dss" 198 | dssfile = pyhecdss.DSSFile(fname) 199 | pathname = '/SAMPLE/INVALID_MARKER/WAVE/01JAN1990/15MIN/SAMPLE1/' 200 | sdate = '01JAN1990' 201 | edate = '31JAN1990' 202 | # changed to a debugging level message so no error is now raised on missing pathname 203 | # values,units,periodtype=dssfile.read_rts(pathname,sdate,edate) 204 | 205 | def test_missing_dir(self): 206 | ''' 207 | missing directory in filename causes crash. So check before trying to open 208 | ''' 209 | fname = 'testnew.dss' 210 | if os.path.exists(fname): 211 | os.remove(fname) 212 | with pyhecdss.DSSFile(fname, create_new=True) as d: 213 | d.close() 214 | assert os.path.exists(fname) 215 | with pytest.raises(FileNotFoundError): 216 | fname2 = 'no_such_dir/testnew.dss' 217 | d = pyhecdss.DSSFile(fname2) 218 | d.close() 219 | 220 | def test_num_values_in_interval(self): 221 | fname = 'testnew.dss' 222 | if os.path.exists(fname): 223 | os.remove(fname) 224 | with pyhecdss.DSSFile(fname, create_new=True) as d: 225 | d.close() 226 | # only checking if values are greater than expected, HECLIB will return the exact number of values found 227 | assert DSSFile.num_values_in_interval('01JAN2000', '01FEB2000', '1DAY') > 31 228 | assert DSSFile.num_values_in_interval('01JAN2000', '01FEB2000', '1MON') > 1 229 | assert DSSFile.num_values_in_interval('01JAN2000', '01FEB2000', '1YEAR') > 0 230 | 231 | 232 | if __name__ == '__main__': 233 | unittest.main() 234 | -------------------------------------------------------------------------------- /tests/test_pyhecdss_intrinsic.py: -------------------------------------------------------------------------------- 1 | # Tests intrinsic functions of pyhecdss 2 | import pytest 3 | import pandas as pd 4 | import numpy as np 5 | import pyhecdss 6 | from datetime import timedelta 7 | 8 | 9 | def test_number_between(): 10 | assert pyhecdss.DSSFile._number_between('01JAN2000', '01FEB2000', delta=timedelta(days=1)) > 31 11 | assert pyhecdss.DSSFile._number_between('01JAN2000', '01FEB2000', delta=timedelta(days=28)) > 1 12 | assert pyhecdss.DSSFile._number_between('01JAN2000', '01FEB2000', delta=timedelta(days=365)) > 0 13 | -------------------------------------------------------------------------------- /tests/test_pyheclib.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | from pyhecdss import pyheclib 3 | 4 | 5 | class TestPyHeclibBasic(unittest.TestCase): 6 | def test_open_close(self): 7 | ifltab = pyheclib.intArray(600) 8 | fname = "test1.dss" 9 | istat = pyheclib.hec_zopen(ifltab, fname) 10 | self.assertEqual(istat, 0) 11 | pyheclib.zclose_(ifltab) 12 | 13 | 14 | # 15 | if __name__ == '__main__': 16 | unittest.main() 17 | -------------------------------------------------------------------------------- /tests/test_rts_offset.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Test regular time series with offset 3 | 4 | This a time series that is say daily but the timestamp for the period 5 | is say an hour before the end of the day 6 | 7 | ''' 8 | import pytest 9 | import pyhecdss 10 | import numpy as np 11 | import pandas as pd 12 | import os 13 | 14 | 15 | @pytest.fixture 16 | def tsdaily(): 17 | return pd.DataFrame(np.array([1, 2, 3, 4, 5], 'd'), 18 | index=pd.date_range('01jan1970 2300', periods=5, freq='D'), 19 | columns=['/A/B-INSTVAL/C/01JAN1970/1DAY/TEST-OFFSET/']) 20 | 21 | 22 | def cleanup(file): 23 | try: 24 | os.remove(file) 25 | except: 26 | pass 27 | 28 | 29 | def test_store_as_instval(tsdaily): 30 | dssfilename = 'test_offset.dss' 31 | cleanup(dssfilename) 32 | with pyhecdss.DSSFile(dssfilename, create_new=True) as dssfh: 33 | pathname = tsdaily.columns[0] 34 | dssfh.write_rts(pathname, tsdaily, 'XXX', 'INST-VAL') 35 | with pyhecdss.DSSFile(dssfilename) as dssfh: 36 | dfcat = dssfh.read_catalog() 37 | plist = dssfh.get_pathnames(dfcat[dfcat.F == 'TEST-OFFSET']) 38 | assert len(plist) == 1 39 | df, cunits, ctype = dssfh.read_rts(plist[0]) 40 | assert cunits == 'XXX' 41 | assert ctype == 'INST-VAL' 42 | pd.testing.assert_series_equal(tsdaily.iloc[:, 0], df.iloc[:, 0], check_names=False) 43 | 44 | 45 | def test_store_as_perval(tsdaily): 46 | dssfilename = 'test_offset.dss' 47 | cleanup(dssfilename) 48 | 49 | with pyhecdss.DSSFile(dssfilename, create_new=True) as dssfh: 50 | pathname = tsdaily.columns[0] 51 | dssfh.write_rts(pathname, tsdaily, 'XXX', 'PER-VAL') 52 | with pyhecdss.DSSFile(dssfilename) as dssfh: 53 | dfcat = dssfh.read_catalog() 54 | plist = dssfh.get_pathnames(dfcat[dfcat.F == 'TEST-OFFSET']) 55 | assert len(plist) == 1 56 | df, cunits, ctype = dssfh.read_rts(plist[0]) 57 | assert cunits == 'XXX' 58 | assert ctype == 'PER-VAL' 59 | # --FIXME -- this is asserting as fail: see issue https://github.com/CADWRDeltaModeling/pyhecdss/issues/12 60 | with pytest.raises(AssertionError): 61 | pd.testing.assert_frame_equal(tsdaily, df, check_names=False, check_column_type=False) 62 | 63 | 64 | def test_store_and_read(): 65 | dssfilename = 'testbug1.dss' 66 | cleanup(dssfilename) 67 | arr = np.array([1.0, 2.0, 3.0]) 68 | dfr = pd.DataFrame(arr, index=pd.period_range('NOV1990', periods=len(arr), freq='1M')) 69 | with pyhecdss.DSSFile(dssfilename, create_new=True) as d: 70 | d.write_rts('/SAMPLE0/ARR/OP//1MON//', dfr, '', 'PER-AVER') 71 | with pyhecdss.DSSFile(dssfilename) as d: 72 | catdf = d.read_catalog() 73 | plist = d.get_pathnames(catdf) 74 | dfr2, units, type = d.read_rts(plist[0]) 75 | pd.testing.assert_series_equal(dfr.iloc[:, 0], dfr2.iloc[:, 0], check_names=False) 76 | -------------------------------------------------------------------------------- /tests/test_twstr.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Tests timewindow str parsing 3 | ''' 4 | import pytest 5 | import pyhecdss 6 | 7 | 8 | @pytest.mark.parametrize('twstr,sdate,edate', 9 | [ 10 | ('01jan1990 0000 - 05feb1991 0000', '01JAN1990', '05FEB1991'), 11 | ('05/01/2002 - 03/25/2003','01MAY2002','25MAR2003'), 12 | ('01OCT2001 0000 - 01OCT2012 0000','01OCT2001','01OCT2012') 13 | ] 14 | ) 15 | def test_twstr(twstr, sdate, edate): 16 | sd, ed = pyhecdss.get_start_end_dates(twstr) 17 | assert sdate == sd 18 | assert edate == ed 19 | --------------------------------------------------------------------------------