diff --git a/.github/workflows/hsp2-pip-install-test.yml b/.github/workflows/hsp2-pip-install-test.yml
index 16f7db1c..92eda6d9 100644
--- a/.github/workflows/hsp2-pip-install-test.yml
+++ b/.github/workflows/hsp2-pip-install-test.yml
@@ -1,87 +1,94 @@
+---
name: Python application
-on:
- push:
- branches: [ "master" ]
- pull_request:
- branches: [ "master", "develop", "develop-specact" ]
+on: # yamllint disable-line rule:truthy
+ push:
+ branches: [master]
+ pull_request:
+ branches: [master, develop, develop-specact]
permissions:
- contents: read
+ contents: read
jobs:
- lint:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- - name: Set up Python
- uses: actions/setup-python@v4
- with:
- python-version: "3.11"
- cache: "pip"
- - name: Install dependencies
- run: |
- pip install flake8
- - name: Lint with flake8
- run: |
- # stop the build if there are Python syntax errors or undefined names
- flake8 . --count --select=E9,F63,F7,F82 --ignore=F821 --show-source --statistics --exclude=build/*
- # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
-
- test-pytest:
- runs-on: ubuntu-latest
- continue-on-error: true
- strategy:
- matrix:
- python-version: ["3.9", "3.10", "3.11", "3.12"]
- pandas-version: [""]
- include:
- - python-version: "3.11"
- pandas-version: "pandas>2.0"
- coverage: true
- - python-version: "3.11"
- pandas-version: "pandas>1.5,<2.0"
- steps:
- - uses: actions/checkout@v4
- - name: Set up Python
- uses: actions/setup-python@v4
- with:
- python-version: ${{ matrix.python-version }}
- cache: "pip"
- - name: Install hsp2
- run: |
- # install the hsp2 executable
- pip install .[dev]
- - if: ${{ matrix.pandas-version }}
- run: pip install "${{ matrix.pandas-version }}"
- - if: ${{ matrix.coverage }}
- run: |
- # python coverage
- NUMBA_DISABLE_JIT=1 pytest --cov --cov-branch --cov-report term-missing
- - if: ${{ ! matrix.coverage }}
- run: pytest
-
- test-cmd:
- runs-on: ubuntu-latest
- continue-on-error: true
- strategy:
- matrix:
- python-version: ["3.9", "3.10", "3.11", "3.12"]
- steps:
- - uses: actions/checkout@v4
- - name: Set up Python
- uses: actions/setup-python@v4
- with:
- python-version: ${{ matrix.python-version }}
- cache: "pip"
- - name: Install hsp2
- run: |
- # install the hsp2 executable
- pip install .
- - name: Run hsp2
- run: |
- # TODO: find much shorter test case.
- hsp2 import_uci ./tests/test10/HSP2results/test10.uci _temp_test10.h5
- hsp2 run _temp_test10.h5
-
+ lint:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - name: Set up Python
+ uses: actions/setup-python@v4
+ with:
+ python-version: '3.11'
+ cache: pip
+ - name: Install dependencies
+ run: |
+ pip install flake8
+ - name: Lint with flake8
+ run: |
+ # stop the build if there are Python syntax errors or
+ # undefined names
+ flake8 . --count --select=E9,F63,F7,F82 --ignore=F821 \
+ --show-source --statistics --exclude=build/*
+ # exit-zero treats all errors as warnings.
+ # The GitHub editor is 127 chars wide
+ flake8 . --count --exit-zero --max-complexity=10 \
+ --max-line-length=127 --statistics
+
+ test-pytest:
+ runs-on: ubuntu-latest
+ continue-on-error: true
+ strategy:
+ matrix:
+ python-version: ['3.9', '3.10', '3.11', '3.12']
+ pandas-version: ['']
+ include:
+ - python-version: '3.11'
+ pandas-version: pandas>2.0
+ coverage: true
+ - python-version: '3.11'
+ pandas-version: pandas>1.5,<2.0
+ steps:
+ - uses: actions/checkout@v4
+ - name: Set up Python
+ uses: actions/setup-python@v4
+ with:
+ python-version: ${{ matrix.python-version }}
+ cache: pip
+ - name: Install hsp2
+ run: |
+ # install the hsp2 executable
+ pip install .[dev]
+ - if: ${{ matrix.pandas-version }}
+ run: pip install "${{ matrix.pandas-version }}"
+ - if: ${{ matrix.coverage }}
+ run: |
+ # python coverage
+ NUMBA_DISABLE_JIT=1 pytest --cov --cov-branch --cov-report \
+ term-missing
+ - if: ${{ ! matrix.coverage }}
+ run: pytest
+
+ test-cmd:
+ runs-on: ubuntu-latest
+ continue-on-error: true
+ strategy:
+ matrix:
+ python-version: ['3.9', '3.10', '3.11', '3.12']
+ steps:
+ - uses: actions/checkout@v4
+ - name: Set up Python
+ uses: actions/setup-python@v4
+ with:
+ python-version: ${{ matrix.python-version }}
+ cache: pip
+ - name: Install hsp2
+ run: |
+ # install the hsp2 executable
+ pip install .
+ - name: Run hsp2
+ run: |
+ # TODO: find much shorter test case.
+ hsp2 import_uci \
+ ./tests/test10/HSP2results/test10.uci \
+ _temp_test10.h5
+ hsp2 run _temp_test10.h5
diff --git a/.gitignore b/.gitignore
index 8cad0c9b..7a22225a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -68,7 +68,7 @@ tests/GLWACSO/HSP2results/hspp007.uci
tests/test_report_conversion.html
# Omit big files
-tests/**/*.h5
+tests/**/**/*.h5
tests/testcbp/HSP2results/*.csv
# R files
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 00000000..bdc42a59
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,96 @@
+---
+# See https://pre-commit.com for more information
+# See https://pre-commit.com/hooks.html for more hooks
+
+exclude: |
+ (?x)^(
+ .*\.hbn|
+ .*\.wdm|
+ .*\.hdf5|
+ .*\.h5
+ )$
+
+repos:
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v4.6.0
+ hooks:
+ - id: check-case-conflict
+ - id: check-docstring-first
+ - id: check-executables-have-shebangs
+ - id: check-json
+ - id: check-merge-conflict
+ - id: check-shebang-scripts-are-executable
+ - id: check-toml
+ - id: check-xml
+ - id: end-of-file-fixer
+ exclude: notebooks/tstoolbox_plot_bash.sh
+ - id: fix-encoding-pragma
+ args: [--remove]
+ - id: mixed-line-ending
+ - id: trailing-whitespace
+ exclude: notebooks/tstoolbox_plot_bash.sh
+
+ - repo: https://github.com/astral-sh/ruff-pre-commit
+ # Ruff version.
+ rev: v0.5.5
+ hooks:
+ # Run the linter.
+ # Uncomment the following lines to enable the linter.
+ # Right now way to many things fail.
+ # - id: ruff
+ # types_or: [python, pyi, jupyter]
+ # args: [--fix]
+
+ # Run the linter sort imports.
+ - id: ruff
+ types_or: [python, pyi, jupyter]
+ args: [--select, I, --fix]
+
+ # Run the formatter.
+ - id: ruff-format
+ types_or: [python, pyi, jupyter]
+
+ - repo: https://github.com/pappasam/toml-sort
+ rev: v0.23.1
+ hooks:
+ - id: toml-sort-fix
+ args: [--in-place, --spaces-indent-inline-array, '4']
+
+ - repo: https://github.com/adrienverge/yamllint.git
+ rev: v1.35.1
+ hooks:
+ - id: yamllint
+ args: [--format, parsable, --strict]
+
+ - repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
+ rev: 0.2.3
+ hooks:
+ - id: yamlfmt
+
+ - repo: https://github.com/jumanjihouse/pre-commit-hooks
+ rev: 3.0.0
+ hooks:
+ - id: shellcheck
+ args: [-s, bash]
+
+ - repo: https://github.com/lovesegfault/beautysh
+ rev: v6.2.1
+ hooks:
+ - id: beautysh
+ args: [--indent-size, '4']
+
+ - repo: https://github.com/asottile/blacken-docs
+ rev: 1.18.0
+ hooks:
+ - id: blacken-docs
+
+ - repo: https://github.com/asottile/pyupgrade
+ rev: v3.16.0
+ hooks:
+ - id: pyupgrade
+
+ - repo: https://github.com/commitizen-tools/commitizen
+ rev: v3.28.0
+ hooks:
+ - id: commitizen
+ stages: [commit-msg]
diff --git a/HSP2_Driver.py b/HSP2_Driver.py
index c91b8963..262699e8 100644
--- a/HSP2_Driver.py
+++ b/HSP2_Driver.py
@@ -1,4 +1,5 @@
-import os, sys
+import os
+import sys
# print('in HSP2_Driver')
command_line = ""
@@ -6,25 +7,29 @@
if len(sys.argv) >= 2:
# see if anything on command line
command_line = sys.argv[1]
- print('command line' + command_line)
+ print("command line" + command_line)
# if given UCI, import to h5 file
# if given WDM, import to h5 file
# if given h5, run HSP2
-from PyQt5.QtWidgets import QFileDialog, QApplication
+from PyQt5.QtWidgets import QApplication, QFileDialog
application = QApplication(sys.argv)
-if command_line == '':
- file_filter = "Run HDF5 (*.h5) Full Output;;" \
- "Run HDF5 (*.h5) Light Output;;" \
- "Import UCI to HDF5 (*.uci);;" \
- "Import WDM to HDF5 (*.wdm)"
- filename, filetype = QFileDialog.getOpenFileName(None, 'HSP2 Open File...', '', file_filter)
+if command_line == "":
+ file_filter = (
+ "Run HDF5 (*.h5) Full Output;;"
+ "Run HDF5 (*.h5) Light Output;;"
+ "Import UCI to HDF5 (*.uci);;"
+ "Import WDM to HDF5 (*.wdm)"
+ )
+ filename, filetype = QFileDialog.getOpenFileName(
+ None, "HSP2 Open File...", "", file_filter
+ )
else:
filename = command_line
- filetype = ''
+ filetype = ""
file_ext = filename[-3:]
dir_name = os.path.dirname(filename)
@@ -33,12 +38,14 @@
if file_ext.upper() == "UCI":
h5_name = filename[:-3] + "h5"
from hsp2.hsp2tools.readUCI import readUCI
+
readUCI(filename, h5_name)
# readUCI('HSPF.uci', 'test.h5')
if file_ext.upper() == "WDM":
h5_name = filename[:-3] + "h5"
from hsp2.hsp2tools.readWDM import readWDM
+
readWDM(filename, h5_name)
# readWDM('GRICM.wdm', 'test.h5')
# readWDM('ZUMBROSCEN.WDM', 'test.h5')
@@ -52,11 +59,7 @@
io_manager = IOManager(hdf5_instance)
SaveLevel = True
- if 'Light' in filetype:
+ if "Light" in filetype:
SaveLevel = False
main(io_manager, saveall=SaveLevel, jupyterlab=False)
# main('test.h5', saveall=True)
-
-
-
-
diff --git a/README.rst b/README.rst
index 179d43a9..e4003f95 100644
--- a/README.rst
+++ b/README.rst
@@ -44,7 +44,7 @@ Source Code Directories
future automation and model coupling. - NOTE: With v0.10 the I/O abstraction
classes provide an alternate approach to running HSP2. Our plan is to migrate
solely using the I/O abstracted methods, but we will maintain both approaches
- for for several more releases for backward compatibility.
+ for for several more releases for backward compatibility.
- **docs** contains relevant reference documentation.
@@ -65,13 +65,13 @@ We recommend getting started by:
HSP2 Installation
=================
-We **recommend Python 3.10**.
+We **recommend Python 3.10**.
Install From Pre-built Packages
-------------------------------
Python Package Index (PyPI)
+++++++++++++++++++++++++++
-Starting with version 0.11.0a1 we provide a PyPI wheel package for HSP2 which
+Starting with version 0.11.0a1 we provide `a PyPI wheel package for HSP2`_ which
should work on any supported platform for Python 3.10, 3.11, and 3.12.
.. code-block:: console
@@ -113,13 +113,17 @@ Option 1: Install using "conda"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Follow these steps to install using the conda_ package manager.
-1. Install the Anaconda Python Distribution
+1. Install Miniconda or Anaconda Python Distribution
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-Install the `latest release`_ of the Anaconda Distribution, which includes the
-conda package manager, a complete Python (and R) data science stack, and the
-Anaconda Navigator GUI. Follow `Anaconda Installation`_ documentation.
+We recommend installing the light-weight Miniconda_ that includes Python, the
+conda_ environment and package management system, and their dependencies.
+
+NOTE: Follow conda defaults to install in your local user directory. DO NOT
+install for all users, to avoid substantial headaches with permissions.
+
+If you have already installed the Anaconda Distribution, you can use it to
+complete the next steps, but you may need to update to the `latest release`_.
-A lighter-weight alternative is to install Miniconda_.
2. Create a Conda Environment for HSP2 Modeling (optional)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -131,7 +135,7 @@ Use the following `conda create`_ command in your terminal or console:
.. code-block:: console
- conda create -c conda-forge -n hsp2_310 python=3.10
+ conda create -c conda-forge -n hsp2_310 python=3.10
Install the necessary and optional packages for HSP2 in the new environment:
@@ -147,13 +151,21 @@ Install the necessary and optional packages for HSP2 in the new environment:
cd /path/to/module/hsp2
pip install . # or "pip install -e ." to install in editable mode
+**Alternately**, you can replace all of the create and install steps above by
+creating the new environment from the included `environment.yml` file
+from this single line of code:
+
+.. code-block:: console
+
+ conda env create --file=environment.yml --solver=libmamba
+
You should now be able to run the Tutorials and create your own Jupyter
Notebooks!
Option 2: Install From Source Code Using `pip`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Installing HSP2 using `pip`, the `Package Installer for Python`_
-is an alternative method to installing with `conda`.
+is an alternative method to installing with `conda`.
1. Install Python
^^^^^^^^^^^^^^^^^
@@ -170,7 +182,7 @@ activate a new environment for running HSP2.
python -m venv hsp2_env /path/to/python/virtual/environments/hsp2_env
-3. PIP install HSP2
+3. PIP install HSP2
^^^^^^^^^^^^^^^^^^^
Navigate to your copy of the HSPsquared folder (for these instructions
/path/to/module/hsp2) on your computer in the command
@@ -221,8 +233,9 @@ The HSP2 API is designed to be used in Python scripts and Jupyter notebooks.
.. _`HSPF Conversion Project`: https://github.com/respec/HSPsquared/blob/archivePy2/Why%20HSP2%20(EAA).pdf
.. _`Introduction to HSP2 by Jason Love (RESPEC)`: https://www.youtube.com/watch?v=aeLScKsP1Wk
.. _`initial release`: https://github.com/respec/HSPsquared/releases/tag/0.7.7
-.. _`GNU Affero General Public License (AGPL), copyrighted 2017 by RESPEC`: https://github.com/respec/HSPsquared/blob/master/LICENSE
+.. _`GNU Affero General Public License (AGPL), copyrighted 2017 by RESPEC`: https://github.com/respec/HSPsquared/blob/master/LICENSE
.. _JupyterLab: https://jupyterlab.readthedocs.io/en/stable/
+.. _`a PyPI wheel package for HSP2`: https://pypi.org/project/hsp2/
.. _conda: https://docs.conda.io/en/latest/
.. _`latest release`: https://docs.anaconda.com/anaconda/reference/release-notes/
.. _`Anaconda Installation`: https://docs.anaconda.com/anaconda/install/
diff --git a/_version.py b/_version.py
deleted file mode 100644
index 2fb6788e..00000000
--- a/_version.py
+++ /dev/null
@@ -1,4 +0,0 @@
-import os
-
-with open(os.path.join(os.path.dirname(__file__), "VERSION"), encoding="ascii") as version_file:
- __version__ = version_file.read().strip()
diff --git a/compare_case.json b/compare_case.json
index 5cd4e8c3..cb746076 100644
--- a/compare_case.json
+++ b/compare_case.json
@@ -17,4 +17,3 @@
}
}
}
-
diff --git a/environment.yml b/environment.yml
index 807dd2c7..343e179d 100644
--- a/environment.yml
+++ b/environment.yml
@@ -1,45 +1,49 @@
-name: hsp2_py38
+---
+name: hsp2
channels:
- conda-forge
+ - nodefaults # Speeds solving env, by limiting the number of options
dependencies:
- # Aligned with Anaconda 2021.05 (May 13, 2021)
- # package management
- - conda
- - conda-build
- - pip
+ - python >=3.10
# Running HSP2
- - python =3.8*
- - scipy # Scipy also installs numpy
- - pandas ==1.2.* # Pandas installs most scientific Python modules, such as Numpy, etc.
- - numba ==0.53.1
- - numpy ==1.20.* # for compatibility with numba version <0.53
- - hdf5 ==1.10.6 # latest compatible with both versions of PyTables & h5py below - doesn't work with setup.py
- - pytables ==3.6.1
- - h5py >=3.1
+ - scipy # Scipy also installs numpy
+ # Pandas installs most scientific Python modules, such as Numpy, etc.
+ - pandas
+ - numba
+ - numpy
+ - hdf5
+ - pytables
+ - h5py
- hdf5plugin # HDF5 compression filters for h5py & jupyterlab_hdf
- - mando # for Python CLI app in HSP2tools/HSP2_CLI.py; hasn't been updated since 2017 and doesn't support Python 3.9: https://github.com/rubik/mando
+ - cltoolbox
- # Interactivity & Visualization via Jupyter Notebooks (optional, but required for tutorials)
- - jupyterlab ==3.0.* # also installs classic Jupyter notbook
- - ipympl # jupyter-matplotlib, https://github.com/matplotlib/ipympl
- - nodejs # required for many JupyterLab extensions
- - nb_conda # Conda environment & package access extension from within Jupyter
- # HoloViz, https://holoviz.org
+ # Operational Model (om)
+ - pyparsing
+
+ # Interactivity via Jupyter Notebooks (optional, but required for tutorials)
+ - jupyterlab # also installs classic Jupyter notbook
+ - nodejs # required for many JupyterLab extensions
+
+ # Visualization (optional)
- hvplot # hvPlot installs most HoloViz libs, including matplotlib
+ - ipympl # jupyter-matplotlib, https://github.com/matplotlib/ipympl
- ipywidgets # Required for HoloViz interactivity in Jupyter notebooks
+ - ipywidgets_bokeh
+ - jupyter_bokeh # Renders Holviz / Bokeh objects in Jupyter
+ - pyviz_comms # bidirectional communication between Python & JavaScript for Jupyter
# Dev tools (optional)
- - python-language-server
- - jupyter-lsp-python # Includes both the server extension (jupyter-lsp) and pyls third-party server (python-language-server)
- - jupyterlab-lsp # Docs at https://github.com/krassowski/jupyterlab-lsp
-
+ # Language Server Protocol (LSP) extension for Python (pylsp)
+ - python-lsp-server
+ - jupyterlab-lsp # Provides both server extension and lab extension
+ # Environment and package management
+ - conda
+ - conda-libmamba-solver
+ - pip
# PIP install requirements only if it is not possible with conda
# https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#using-pip-in-an-environment
- pip:
- # Optional, but recommended for tutorials
- # - lckr-jupyterlab-variableinspector # https://github.com/lckr/jupyterlab-variableInspector
- # - jupyterlab_hdf # Explore HDF5 files in JupyterLab. Requires an additional step to install.
- # Installation instructions: https://github.com/jupyterlab/jupyterlab-hdf5#installation
+ - hsp2
diff --git a/environment_dev.yml b/environment_dev.yml
index 2bf310a7..78bfc5a9 100644
--- a/environment_dev.yml
+++ b/environment_dev.yml
@@ -1,40 +1,45 @@
+---
name: hsp2_py311_dev
channels:
- conda-forge
- - nodefaults # Speeds solving env, by limiting the number of options
+ - nodefaults # Speeds solving env, by limiting the number of options
dependencies:
- # Python 3.11 is supported by Anaconda since 2023.03-0 (Mar 20, 2023)
- # https://docs.anaconda.com/free/anaconda/release-notes/#anaconda-2023-03-0-mar-20-2023
- # package management
- - conda
- - conda-build
- - conda-libmamba-solver
- - pip
+ # Python 3.11 was default for Anaconda 2023.07-0 (Jul 11, 2023)
+ # https://docs.anaconda.com/anaconda/release-notes/#anaconda-2023-07-0-jul-11-2023
+ - python =3.11
# Running HSP2
- - python =3.11
- - scipy # Scipy also installs numpy
- - pandas >=2.0 # Pandas installs most scientific Python modules, such as Numpy, etc.
- - numba
- - numpy
+ - scipy # Scipy also installs numpy
+ # Pandas installs most scientific Python modules, such as Numpy, etc.
+ - pandas >=2.0
+ - numba
+ - numpy
- hdf5
- - pytables
- - h5py
+ - pytables
+ - h5py
- hdf5plugin # HDF5 compression filters for h5py & jupyterlab_hdf
# - dask # for future performance enhancements
- - mando # for Python CLI app in HSP2tools/HSP2_CLI.py; hasn't been updated since 2017 and doesn't support Python 3.9: https://github.com/rubik/mando
+ - cltoolbox
- # Interactivity & Visualization via Jupyter Notebooks (optional, but required for tutorials)
- - jupyterlab # also installs classic Jupyter notbook
- - ipympl # jupyter-matplotlib, https://github.com/matplotlib/ipympl
- - nodejs # required for many JupyterLab extensions
- # HoloViz, https://holoviz.org
+ # Operational Model (om)
+ - pyparsing
+
+ # Interactivity via Jupyter Notebooks (optional, but required for tutorials)
+ - jupyterlab # also installs classic Jupyter notbook
+ - nodejs # required for many JupyterLab extensions
+
+ # Visualization (optional)
- hvplot # hvPlot installs most HoloViz libs, including matplotlib
+ - ipympl # jupyter-matplotlib, https://github.com/matplotlib/ipympl
- ipywidgets # Required for HoloViz interactivity in Jupyter notebooks
+ - ipywidgets_bokeh
+ - jupyter_bokeh # Renders Holviz / Bokeh objects in Jupyter
+ - pyviz_comms # bidirectional communication between Python & JavaScript for Jupyter
# Dev tools (optional)
- - python-lsp-server # Language Server Protocol (LSP) extension for Python (pylsp)
+ # Language Server Protocol (LSP) extension for Python (pylsp)
+ - python-lsp-server
# Rope for Completions and renaming
# Pyflakes linter to detect various errors
# McCabe linter for complexity checking
@@ -46,7 +51,12 @@ dependencies:
# pylint for code linting (disabled by default)
- jupyterlab-lsp # Provides both server extension and lab extension
-
+ # Environment and package management
+ - conda
+ - conda-build
+ - conda-libmamba-solver
+ - pip
# PIP install requirements only if it is not possible with conda
# https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#using-pip-in-an-environment
- - pip:
\ No newline at end of file
+ - pip:
+ # For developing HPS2, we recommend using the `conda build` command to "install"
diff --git a/examples/1_Intro_to_HSP2.ipynb b/examples/1_Intro_to_HSP2.ipynb
index 0e15e45b..61d5964e 100644
--- a/examples/1_Intro_to_HSP2.ipynb
+++ b/examples/1_Intro_to_HSP2.ipynb
@@ -34,56 +34,184 @@
"source": [
"# Installation and Setup\n",
"\n",
- "## Install HSP2\n",
- "\n",
- "Carefully follow our **[Installation Instructions](https://github.com/respec/HSPsquared#installation)**, especially including:\n",
- "- Creating a virtual environment for HSP2 (step 3)\n",
- "- Adding HSPsquared to your Python path (step 4)"
+ "This notebook is designed to be run from: \n",
+ "- a cloned or copied version of the [HSPsquared](https://github.com/respec/HSPsquared) respository and \n",
+ "- a custom virtual environment as described in our **[HSP2 Installation](https://github.com/respec/HSPsquared#hsp2-installation) Instructions**, especially including:\n",
+ " - Creating a virtual environment for HSP2 (step 3)\n",
+ " - Adding HSP2 to your Python path (step 4)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Python Imports"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### General Imports"
]
},
{
"cell_type": "code",
"execution_count": 1,
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-05-21T17:40:19.613424Z",
+ "iopub.status.busy": "2024-05-21T17:40:19.613169Z",
+ "iopub.status.idle": "2024-05-21T17:40:19.737150Z",
+ "shell.execute_reply": "2024-05-21T17:40:19.736693Z",
+ "shell.execute_reply.started": "2024-05-21T17:40:19.613404Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "import os\n",
+ "from pathlib import Path\n",
+ "\n",
+ "import tables"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Import HSP2"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
- "'hsp2_py38'"
+ "'hsp2'"
]
},
- "execution_count": 1,
+ "execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Confirm that your active environment for this notebook is the one you created for HSP2.\n",
- "import os\n",
- "\n",
"os.environ[\"CONDA_DEFAULT_ENV\"]"
]
},
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Install HSP2, HSP2 Tools, and HSP2 IO Utillties\n",
+ "from hsp2 import hsp2, hsp2tools, hsp2io"
+ ]
+ },
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "## Import Python Dependencies\n",
- "- Most dependancies get installed when you import the `HSP2` and `HSP2tools` modules. "
+ "### If you get `ModuleNotFoundError`\n",
+ "\n",
+ "If you get `ModuleNotFoundError`, you need to install hsp2 into your environment, either using \n",
+ "- `pip` (see [HSP2 Installation](https://github.com/respec/HSPsquared#hsp2-installation) Instructions) for normal use, or using\n",
+ "- [`conda develop`](https://docs.conda.io/projects/conda-build/en/latest/resources/commands/conda-develop.html) if you want to develop HSP2.\n",
+ "\n",
+ "If using the development environment, the following steps will install in develop mode:\n",
+ "1. Run the [`conda develop`](https://docs.conda.io/projects/conda-build/en/latest/resources/commands/conda-develop.html) command in your terminal with your local absolute path to the `src` directory of this repo.\n",
+ "2. Restart the kernel.\n",
+ "3. Rerun the import statements above."
]
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": 4,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "PosixPath('/Users/aaufdenkampe/Documents/Python/respec.HSPsquared')"
+ ]
+ },
+ "execution_count": 4,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# Find project directory (i.e. the parent to `/examples` directory for this notebook)\n",
+ "project_path = Path.cwd().parent\n",
+ "project_path"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "PosixPath('/Users/aaufdenkampe/Documents/Python/respec.HSPsquared/src')"
+ ]
+ },
+ "execution_count": 5,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# Your source directory should be: \n",
+ "src_path = project_path / 'src' \n",
+ "src_path"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### To install in developer mode:\n",
+ "- Copy from the output of `src_path` from the cell above, and \n",
+ "- Paste it after `!conda develop` in the cell below (replacing the previous user's path). \n",
+ " - NOTE 1: If your path has any blank spaces, you must enclose the path with quotes.\n",
+ " - NOTE 2: The Jupyter `!` magic command runs a the follwoing terminal command from this notebook."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
"metadata": {
"execution": {
- "iopub.execute_input": "2024-05-21T17:40:19.613424Z",
- "iopub.status.busy": "2024-05-21T17:40:19.613169Z",
- "iopub.status.idle": "2024-05-21T17:40:19.737150Z",
- "shell.execute_reply": "2024-05-21T17:40:19.736693Z",
- "shell.execute_reply.started": "2024-05-21T17:40:19.613404Z"
+ "iopub.execute_input": "2024-05-21T17:40:25.655357Z",
+ "iopub.status.busy": "2024-05-21T17:40:25.654849Z",
+ "iopub.status.idle": "2024-05-21T17:40:25.768746Z",
+ "shell.execute_reply": "2024-05-21T17:40:25.768142Z",
+ "shell.execute_reply.started": "2024-05-21T17:40:25.655339Z"
}
},
+ "outputs": [],
+ "source": [
+ " # !conda develop '/Users/aaufdenkampe/Documents/Python/respec.HSPsquared/src'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "You now need to **restart the Python kernel** for this notebook, if the path didn't already exist."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {},
"outputs": [
{
"data": {
@@ -116,47 +244,47 @@
"
\n",
" \n",
" | Python | \n",
- " 3.10.14 | packaged by conda-forge | (main, Mar... | \n",
+ " 3.12.8 | packaged by conda-forge | (main, Dec ... | \n",
"
\n",
" \n",
- " | HSP2 | \n",
+ " hsp2 | \n",
" n/a | \n",
"
\n",
" \n",
" | numpy | \n",
- " 1.26.4 | \n",
+ " 2.0.2 | \n",
"
\n",
" \n",
" | numba | \n",
- " 0.59.1 | \n",
+ " 0.60.0 | \n",
"
\n",
" \n",
" | pandas | \n",
- " 1.5.3 | \n",
+ " 2.2.3 | \n",
"
\n",
" \n",
" | matplotlib | \n",
- " 3.8.4 | \n",
+ " 3.10.0 | \n",
"
\n",
" \n",
" | tables | \n",
- " 3.9.2 | \n",
+ " 3.10.1 | \n",
"
\n",
" \n",
" | h5py | \n",
- " 3.11.0 | \n",
+ " 3.12.1 | \n",
"
\n",
" \n",
" | os | \n",
- " Linux-5.15.0-91-generic-x86_64-with-glibc2.35 | \n",
+ " macOS-14.7.1-arm64-arm-64bit | \n",
"
\n",
" \n",
" | processor | \n",
- " x86_64 | \n",
+ " arm | \n",
"
\n",
" \n",
" | Date/Time | \n",
- " 2024-05-21T13:40:19.728733 | \n",
+ " 2024-12-17T10:48:52.834595 | \n",
"
\n",
" \n",
"\n",
@@ -165,77 +293,89 @@
"text/plain": [
" version\n",
"name \n",
- "Python 3.10.14 | packaged by conda-forge | (main, Mar...\n",
- "HSP2 n/a\n",
- "numpy 1.26.4\n",
- "numba 0.59.1\n",
- "pandas 1.5.3\n",
- "matplotlib 3.8.4\n",
- "tables 3.9.2\n",
- "h5py 3.11.0\n",
- "os Linux-5.15.0-91-generic-x86_64-with-glibc2.35\n",
- "processor x86_64\n",
- "Date/Time 2024-05-21T13:40:19.728733"
+ "Python 3.12.8 | packaged by conda-forge | (main, Dec ...\n",
+ "hsp2 n/a\n",
+ "numpy 2.0.2\n",
+ "numba 0.60.0\n",
+ "pandas 2.2.3\n",
+ "matplotlib 3.10.0\n",
+ "tables 3.10.1\n",
+ "h5py 3.12.1\n",
+ "os macOS-14.7.1-arm64-arm-64bit\n",
+ "processor arm\n",
+ "Date/Time 2024-12-17T10:48:52.834595"
]
},
- "execution_count": 2,
+ "execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
- "import os\n",
- "from pathlib import Path\n",
- "\n",
- "import tables\n",
- "\n",
- "from hsp2 import hsp2, hsp2tools\n",
- "from hsp2.hsp2io import hdf, io\n",
- "\n",
"# Confirm installed versions of HSP2 and key dependencies\n",
- "hsp2.versions([\"matplotlib\", \"tables\", \"h5py\"])"
+ "hsp2.versions([\"matplotlib\", \"tables\", \"h5py\"])\n",
+ "# TODO: need to fix hsp2 version links"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "### If you get HSP2 `ModuleNotFoundError`:\n",
- "\n",
- "If you get this error:\n",
- "```python\n",
- "ModuleNotFoundError: No module named 'HSP2'\n",
- "```\n",
- "Then:\n",
- "1. Run the following terminal command with your local absolute path to this repo.\n",
- " - NOTE: Here we use Jupyter `!` magic command to run from the terminal via this notebook. \n",
- "2. Restart the kernel.\n",
- "3. Rerun the import statements above."
+ "Alternate ways to get the HSP2 version:"
]
},
{
"cell_type": "code",
- "execution_count": 3,
- "metadata": {
- "execution": {
- "iopub.execute_input": "2024-05-21T17:40:25.655357Z",
- "iopub.status.busy": "2024-05-21T17:40:25.654849Z",
- "iopub.status.idle": "2024-05-21T17:40:25.768746Z",
- "shell.execute_reply": "2024-05-21T17:40:25.768142Z",
- "shell.execute_reply.started": "2024-05-21T17:40:25.655339Z"
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Built in approach, that will work with next release\n",
+ "# hsp2.__version__"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "'0.11.0a1'"
+ ]
+ },
+ "execution_count": 9,
+ "metadata": {},
+ "output_type": "execute_result"
}
- },
+ ],
+ "source": [
+ "# From PyPI Package\n",
+ "# NOTE: this won't work when in `conda develop` mode.\n",
+ "from importlib.metadata import version\n",
+ "version('hsp2')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "/bin/bash: line 1: conda-develop: command not found\n"
+ "# packages in environment at /Users/aaufdenkampe/miniconda3/envs/hsp2:\n",
+ "#\n",
+ "# Name Version Build Channel\n",
+ "hsp2 0.11.0a1 pypi_0 pypi\n"
]
}
],
"source": [
- "!conda-develop /Users/aaufdenkampe/Documents/Python/respec.HSPsquared/"
+ "# From conda magic command\n",
+ "!conda list hsp2"
]
},
{
@@ -249,50 +389,31 @@
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": 11,
"metadata": {
"execution": {
- "iopub.execute_input": "2024-05-21T17:40:35.309422Z",
- "iopub.status.busy": "2024-05-21T17:40:35.309181Z",
- "iopub.status.idle": "2024-05-21T17:40:35.312823Z",
- "shell.execute_reply": "2024-05-21T17:40:35.312344Z",
- "shell.execute_reply.started": "2024-05-21T17:40:35.309405Z"
+ "iopub.execute_input": "2024-05-21T17:40:36.407261Z",
+ "iopub.status.busy": "2024-05-21T17:40:36.406989Z",
+ "iopub.status.idle": "2024-05-21T17:40:36.409351Z",
+ "shell.execute_reply": "2024-05-21T17:40:36.408997Z",
+ "shell.execute_reply.started": "2024-05-21T17:40:36.407244Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
- "PosixPath('/home/tim/programming/HSPsquared/examples')"
+ "PosixPath('/Users/aaufdenkampe/Documents/Python/respec.HSPsquared')"
]
},
- "execution_count": 4,
+ "execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
- "# Get your current working directory, for reference\n",
- "Path.cwd()"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 5,
- "metadata": {
- "execution": {
- "iopub.execute_input": "2024-05-21T17:40:36.407261Z",
- "iopub.status.busy": "2024-05-21T17:40:36.406989Z",
- "iopub.status.idle": "2024-05-21T17:40:36.409351Z",
- "shell.execute_reply": "2024-05-21T17:40:36.408997Z",
- "shell.execute_reply.started": "2024-05-21T17:40:36.407244Z"
- }
- },
- "outputs": [],
- "source": [
- "# Set your project directory to your local folder for your clone of the HSPsquared repository\n",
- "\n",
- "project_folder = Path(\"/Users/aaufdenkampe/Documents/Python/respec.HSPsquared/\")"
+ "# Project directory, found above, is local folder for your clone or copy of the HSPsquared repository\n",
+ "project_path"
]
},
{
@@ -308,7 +429,7 @@
},
{
"cell_type": "code",
- "execution_count": 13,
+ "execution_count": 12,
"metadata": {
"execution": {
"iopub.execute_input": "2024-05-21T18:52:11.477985Z",
@@ -323,17 +444,18 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "../tests/test10/HSP2results/test10.uci\n",
+ "/Users/aaufdenkampe/Documents/Python/respec.HSPsquared/tests/test10/HSP2results/test10.uci\n",
"File exists? True\n",
- "../tests/test10/HSP2results/test10.wdm\n",
+ "/Users/aaufdenkampe/Documents/Python/respec.HSPsquared/tests/test10/HSP2results/test10.wdm\n",
"File exists? True\n"
]
}
],
"source": [
- "# Set input data paths, using our Test10 example\n",
+ "# Get input data paths for the Test10 example\n",
+ "# Using `pathlib` concatenation\n",
+ "inputs_path = project_path / 'tests' / 'test10' / 'HSP2results' \n",
"\n",
- "input_data_folder = Path(\"../tests/test10/HSP2results/\")\n",
"\n",
"input_files = [\n",
" \"test10.uci\",\n",
@@ -341,16 +463,16 @@
"]\n",
"\n",
"# HSPF User Control Inputs text file\n",
- "input_uci_path = input_data_folder / input_files[0]\n",
+ "input_uci_filepath = inputs_path / input_files[0]\n",
"\n",
- "print(input_uci_path)\n",
- "print(f\"File exists? {input_uci_path.exists()}\")\n",
+ "print(input_uci_filepath)\n",
+ "print(f\"File exists? {input_uci_filepath.exists()}\")\n",
"\n",
"# HSPF Watershed Data Management Fortran binary file for timeseries inputs\n",
- "input_wdm_path = input_data_folder / input_files[1]\n",
+ "input_wdm_filepath = inputs_path / input_files[1]\n",
"\n",
- "print(input_wdm_path)\n",
- "print(f\"File exists? {input_wdm_path.exists()}\")"
+ "print(input_wdm_filepath)\n",
+ "print(f\"File exists? {input_wdm_filepath.exists()}\")"
]
},
{
@@ -362,7 +484,7 @@
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 13,
"metadata": {
"execution": {
"iopub.execute_input": "2024-05-21T17:40:42.208083Z",
@@ -374,61 +496,26 @@
},
"outputs": [
{
- "ename": "PermissionError",
- "evalue": "[Errno 13] Permission denied: '/Users'",
- "output_type": "error",
- "traceback": [
- "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
- "\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)",
- "File \u001b[0;32m~/anaconda3/envs/hsp2_310/lib/python3.10/pathlib.py:1175\u001b[0m, in \u001b[0;36mPath.mkdir\u001b[0;34m(self, mode, parents, exist_ok)\u001b[0m\n\u001b[1;32m 1174\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m-> 1175\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_accessor\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmkdir\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmode\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1176\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mFileNotFoundError\u001b[39;00m:\n",
- "\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: '/Users/aaufdenkampe/Documents/Python/respec.HSPsquared/examples/_TutorialData'",
- "\nDuring handling of the above exception, another exception occurred:\n",
- "\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)",
- "File \u001b[0;32m~/anaconda3/envs/hsp2_310/lib/python3.10/pathlib.py:1175\u001b[0m, in \u001b[0;36mPath.mkdir\u001b[0;34m(self, mode, parents, exist_ok)\u001b[0m\n\u001b[1;32m 1174\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m-> 1175\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_accessor\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmkdir\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmode\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1176\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mFileNotFoundError\u001b[39;00m:\n",
- "\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: '/Users/aaufdenkampe/Documents/Python/respec.HSPsquared/examples'",
- "\nDuring handling of the above exception, another exception occurred:\n",
- "\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)",
- "File \u001b[0;32m~/anaconda3/envs/hsp2_310/lib/python3.10/pathlib.py:1175\u001b[0m, in \u001b[0;36mPath.mkdir\u001b[0;34m(self, mode, parents, exist_ok)\u001b[0m\n\u001b[1;32m 1174\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m-> 1175\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_accessor\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmkdir\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmode\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1176\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mFileNotFoundError\u001b[39;00m:\n",
- "\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: '/Users/aaufdenkampe/Documents/Python/respec.HSPsquared'",
- "\nDuring handling of the above exception, another exception occurred:\n",
- "\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)",
- "File \u001b[0;32m~/anaconda3/envs/hsp2_310/lib/python3.10/pathlib.py:1175\u001b[0m, in \u001b[0;36mPath.mkdir\u001b[0;34m(self, mode, parents, exist_ok)\u001b[0m\n\u001b[1;32m 1174\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m-> 1175\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_accessor\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmkdir\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmode\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1176\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mFileNotFoundError\u001b[39;00m:\n",
- "\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: '/Users/aaufdenkampe/Documents/Python'",
- "\nDuring handling of the above exception, another exception occurred:\n",
- "\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)",
- "File \u001b[0;32m~/anaconda3/envs/hsp2_310/lib/python3.10/pathlib.py:1175\u001b[0m, in \u001b[0;36mPath.mkdir\u001b[0;34m(self, mode, parents, exist_ok)\u001b[0m\n\u001b[1;32m 1174\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m-> 1175\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_accessor\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmkdir\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmode\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1176\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mFileNotFoundError\u001b[39;00m:\n",
- "\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: '/Users/aaufdenkampe/Documents'",
- "\nDuring handling of the above exception, another exception occurred:\n",
- "\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)",
- "File \u001b[0;32m~/anaconda3/envs/hsp2_310/lib/python3.10/pathlib.py:1175\u001b[0m, in \u001b[0;36mPath.mkdir\u001b[0;34m(self, mode, parents, exist_ok)\u001b[0m\n\u001b[1;32m 1174\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m-> 1175\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_accessor\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmkdir\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmode\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1176\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mFileNotFoundError\u001b[39;00m:\n",
- "\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: '/Users/aaufdenkampe'",
- "\nDuring handling of the above exception, another exception occurred:\n",
- "\u001b[0;31mPermissionError\u001b[0m Traceback (most recent call last)",
- "Cell \u001b[0;32mIn[7], line 7\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[38;5;66;03m# Create temporary directory, which we ignore in Git\u001b[39;00m\n\u001b[1;32m 6\u001b[0m tutoral_temp_path \u001b[38;5;241m=\u001b[39m project_folder \u001b[38;5;241m/\u001b[39m output_data_folder\n\u001b[0;32m----> 7\u001b[0m \u001b[43mtutoral_temp_path\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmkdir\u001b[49m\u001b[43m(\u001b[49m\u001b[43mparents\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mexist_ok\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[1;32m 9\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mFolder exists? \u001b[39m\u001b[38;5;124m'\u001b[39m \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(tutoral_temp_path\u001b[38;5;241m.\u001b[39mexists()) )\n",
- "File \u001b[0;32m~/anaconda3/envs/hsp2_310/lib/python3.10/pathlib.py:1179\u001b[0m, in \u001b[0;36mPath.mkdir\u001b[0;34m(self, mode, parents, exist_ok)\u001b[0m\n\u001b[1;32m 1177\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m parents \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mparent \u001b[38;5;241m==\u001b[39m \u001b[38;5;28mself\u001b[39m:\n\u001b[1;32m 1178\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m\n\u001b[0;32m-> 1179\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mparent\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmkdir\u001b[49m\u001b[43m(\u001b[49m\u001b[43mparents\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mexist_ok\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[1;32m 1180\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmkdir(mode, parents\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m, exist_ok\u001b[38;5;241m=\u001b[39mexist_ok)\n\u001b[1;32m 1181\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mOSError\u001b[39;00m:\n\u001b[1;32m 1182\u001b[0m \u001b[38;5;66;03m# Cannot rely on checking for EEXIST, since the operating system\u001b[39;00m\n\u001b[1;32m 1183\u001b[0m \u001b[38;5;66;03m# could give priority to other errors like EACCES or EROFS\u001b[39;00m\n",
- "File \u001b[0;32m~/anaconda3/envs/hsp2_310/lib/python3.10/pathlib.py:1179\u001b[0m, in \u001b[0;36mPath.mkdir\u001b[0;34m(self, mode, parents, exist_ok)\u001b[0m\n\u001b[1;32m 1177\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m parents \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mparent \u001b[38;5;241m==\u001b[39m \u001b[38;5;28mself\u001b[39m:\n\u001b[1;32m 1178\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m\n\u001b[0;32m-> 1179\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mparent\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmkdir\u001b[49m\u001b[43m(\u001b[49m\u001b[43mparents\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mexist_ok\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[1;32m 1180\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmkdir(mode, parents\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m, exist_ok\u001b[38;5;241m=\u001b[39mexist_ok)\n\u001b[1;32m 1181\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mOSError\u001b[39;00m:\n\u001b[1;32m 1182\u001b[0m \u001b[38;5;66;03m# Cannot rely on checking for EEXIST, since the operating system\u001b[39;00m\n\u001b[1;32m 1183\u001b[0m \u001b[38;5;66;03m# could give priority to other errors like EACCES or EROFS\u001b[39;00m\n",
- " \u001b[0;31m[... skipping similar frames: Path.mkdir at line 1179 (3 times)]\u001b[0m\n",
- "File \u001b[0;32m~/anaconda3/envs/hsp2_310/lib/python3.10/pathlib.py:1179\u001b[0m, in \u001b[0;36mPath.mkdir\u001b[0;34m(self, mode, parents, exist_ok)\u001b[0m\n\u001b[1;32m 1177\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m parents \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mparent \u001b[38;5;241m==\u001b[39m \u001b[38;5;28mself\u001b[39m:\n\u001b[1;32m 1178\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m\n\u001b[0;32m-> 1179\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mparent\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmkdir\u001b[49m\u001b[43m(\u001b[49m\u001b[43mparents\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mexist_ok\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[1;32m 1180\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmkdir(mode, parents\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m, exist_ok\u001b[38;5;241m=\u001b[39mexist_ok)\n\u001b[1;32m 1181\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mOSError\u001b[39;00m:\n\u001b[1;32m 1182\u001b[0m \u001b[38;5;66;03m# Cannot rely on checking for EEXIST, since the operating system\u001b[39;00m\n\u001b[1;32m 1183\u001b[0m \u001b[38;5;66;03m# could give priority to other errors like EACCES or EROFS\u001b[39;00m\n",
- "File \u001b[0;32m~/anaconda3/envs/hsp2_310/lib/python3.10/pathlib.py:1175\u001b[0m, in \u001b[0;36mPath.mkdir\u001b[0;34m(self, mode, parents, exist_ok)\u001b[0m\n\u001b[1;32m 1171\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 1172\u001b[0m \u001b[38;5;124;03mCreate a new directory at this given path.\u001b[39;00m\n\u001b[1;32m 1173\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 1174\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m-> 1175\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_accessor\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmkdir\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmode\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1176\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mFileNotFoundError\u001b[39;00m:\n\u001b[1;32m 1177\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m parents \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mparent \u001b[38;5;241m==\u001b[39m \u001b[38;5;28mself\u001b[39m:\n",
- "\u001b[0;31mPermissionError\u001b[0m: [Errno 13] Permission denied: '/Users'"
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Folder exists? True\n"
]
}
],
"source": [
"# Create temporary data output folder, where you want to store your outputs\n",
- "\n",
- "output_data_folder = Path(\"examples/_TutorialData\")\n",
+ "tutoral_temp_path = project_path / 'examples' / '_TutorialData'\n",
"\n",
"# Create temporary directory, which we ignore in Git\n",
- "tutoral_temp_path = project_folder / output_data_folder\n",
"tutoral_temp_path.mkdir(parents=True, exist_ok=True)\n",
"\n",
- "print(\"Folder exists? \" + str(tutoral_temp_path.exists()))"
+ "print('Folder exists? ', tutoral_temp_path.exists())"
]
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": 14,
"metadata": {
"execution": {
"iopub.execute_input": "2024-05-21T17:40:43.187481Z",
@@ -444,18 +531,15 @@
"output_type": "stream",
"text": [
"/Users/aaufdenkampe/Documents/Python/respec.HSPsquared/examples/_TutorialData/test10.h5\n",
- "File exists? False\n"
+ "File exists? True\n"
]
}
],
"source": [
"# Create path for temporary data output file\n",
- "\n",
"output_file = \"test10.h5\" # HSP2 data HDF5 binary file, for all inputs and outputs\n",
"\n",
- "output_hdf5_path = (\n",
- " project_folder / output_data_folder / output_file\n",
- ") # pathlib concatenation\n",
+ "output_hdf5_path = tutoral_temp_path / output_file\n",
"\n",
"print(output_hdf5_path)\n",
"print(\"File exists? \" + str(output_hdf5_path.exists()))\n",
@@ -490,15 +574,159 @@
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": 15,
"metadata": {},
"outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n",
+ "/Users/aaufdenkampe/miniconda3/envs/hsp2/lib/python3.12/site-packages/hsp2/hsp2tools/readUCI.py:102: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead\n",
+ " df = df.apply(pd.to_numeric, errors='ignore') # todo: 'ignore' is deprecated.\n"
+ ]
+ },
{
"name": "stdout",
"output_type": "stream",
"text": [
- "CPU times: user 18.2 s, sys: 621 ms, total: 18.8 s\n",
- "Wall time: 18.9 s\n"
+ "CPU times: user 5.91 s, sys: 340 ms, total: 6.25 s\n",
+ "Wall time: 6.31 s\n"
]
}
],
@@ -508,13 +736,13 @@
"# from the HSPF *.uci text file in Fortran punchard format\n",
"# to the HDF5 file\n",
"\n",
- "HSP2tools.readUCI(input_uci_path, output_hdf5_path)\n",
- "# NOTE that parsing this text file is not very efficient!"
+ "hsp2tools.readUCI(input_uci_filepath, output_hdf5_path)\n",
+ "# NOTE that parsing this text file is not very efficient, takign 8-20 seconds"
]
},
{
"cell_type": "code",
- "execution_count": 10,
+ "execution_count": 16,
"metadata": {},
"outputs": [
{
@@ -532,7 +760,7 @@
},
{
"cell_type": "code",
- "execution_count": 11,
+ "execution_count": 17,
"metadata": {},
"outputs": [
{
@@ -558,8 +786,8 @@
"135 reading from wdm\n",
"136 reading from wdm\n",
"140 reading from wdm\n",
- "CPU times: user 2.88 s, sys: 70.1 ms, total: 2.95 s\n",
- "Wall time: 3.05 s\n"
+ "CPU times: user 1.26 s, sys: 201 ms, total: 1.46 s\n",
+ "Wall time: 17.5 s\n"
]
},
{
@@ -598,7 +826,7 @@
"