From df86cc5ff9055af898397d091604f247079aa38e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dieter=20Werthm=C3=BCller?= Date: Tue, 2 Aug 2022 14:52:10 +0200 Subject: [PATCH] v1.7.1 : Bugfix trimmed z-vector (#294) * Fix vector-domain-seasurface * Update workflows --- .github/workflows/linkcheck.yml | 4 ++-- .github/workflows/linux.yml | 9 ++++----- .github/workflows/macos_windows.yml | 9 ++++----- CHANGELOG.rst | 10 ++++++++++ emg3d/meshes.py | 20 ++++++++++---------- 5 files changed, 30 insertions(+), 22 deletions(-) diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml index 6e8d8c28..ac01dee6 100644 --- a/.github/workflows/linkcheck.yml +++ b/.github/workflows/linkcheck.yml @@ -20,9 +20,9 @@ jobs: steps: - # Cancel any previous run of the test job; [pin v0.8.0 (2021-02-13)] + # Cancel any previous run of the test job; [pin v0.10.0 (2022-06-27)] - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@3d86a7cc43670094ac248017207be0295edbc31d + uses: styfle/cancel-workflow-action@bb6001c4ea612bf59c3abfc4756fbceee4f870c7 with: access_token: ${{ github.token }} diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 5cd7cb8f..804b7e9d 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -67,9 +67,9 @@ jobs: steps: - # Cancel any previous run of the test job; [pin v0.8.0 (2021-02-13)] + # Cancel any previous run of the test job; [pin v0.10.0 (2022-06-27)] - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@3d86a7cc43670094ac248017207be0295edbc31d + uses: styfle/cancel-workflow-action@bb6001c4ea612bf59c3abfc4756fbceee4f870c7 with: access_token: ${{ github.token }} @@ -109,8 +109,7 @@ jobs: conda config --set always_yes yes --set changeps1 no conda config --show-sources conda config --show - conda install ${{ matrix.case.conda }} pytest pytest-cov pytest-console-scripts pip - pip install setuptools_scm coveralls pytest-flake8 + conda install ${{ matrix.case.conda }} pytest pytest-cov pytest-console-scripts coveralls pytest-flake8 setuptools_scm conda info -a conda list @@ -166,7 +165,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v2 with: - python-version: "3.8" + python-version: "3.9" - name: Install dependencies run: | diff --git a/.github/workflows/macos_windows.yml b/.github/workflows/macos_windows.yml index 3d868bb9..c4117b67 100644 --- a/.github/workflows/macos_windows.yml +++ b/.github/workflows/macos_windows.yml @@ -34,9 +34,9 @@ jobs: steps: - # Cancel any previous run of the test job; [pin v0.8.0 (2021-02-13)] + # Cancel any previous run of the test job; [pin v0.10.0 (2022-06-27)] - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@3d86a7cc43670094ac248017207be0295edbc31d + uses: styfle/cancel-workflow-action@bb6001c4ea612bf59c3abfc4756fbceee4f870c7 with: access_token: ${{ github.token }} @@ -66,7 +66,7 @@ jobs: python-version: ${{ matrix.python }} miniforge-variant: Mambaforge use-mamba: true - # The following should not be necessary with Mambaforg(?). + # The following should not be necessary with Mambaforge(?). channels: conda-forge,defaults channel-priority: strict @@ -76,8 +76,7 @@ jobs: conda config --set always_yes yes --set changeps1 no conda config --show-sources conda config --show - conda install numba scipy pytest pytest-console-scripts pip - pip install setuptools_scm pytest-flake8 + conda install numba scipy pytest pytest-console-scripts pytest-flake8 scooby setuptools_scm conda info -a conda list diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f8be2cd8..18882f9b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,16 @@ Changelog """""""""" +v1.7.1 : Bugfix trimmed z-vector +-------------------------------- + +- Meshing: Small fix to the automatic gridding from v1.5.0 (non-backwards + compatible). A provided z-vector is new trimmed to the domain before the + domain might be expanded due to the provided seasurface (which is as it was + always intended, but not as it was implemented). +- Few small maintenance things in the meta files. + + v1.7.0 : CLI-clean ------------------ diff --git a/emg3d/meshes.py b/emg3d/meshes.py index 997bc305..4c2f4493 100644 --- a/emg3d/meshes.py +++ b/emg3d/meshes.py @@ -671,16 +671,6 @@ def origin_and_widths(frequency, properties, center, domain=None, vector=None, "At least one of `domain`/`distance`/`vector` must be provided." ) - # Check seasurface. - if seasurface is not None: - - # Check that seasurface > center. - if seasurface <= center: - raise ValueError("The `seasurface` must be bigger than `center`.") - - # Expand domain to include seasurface if necessary. - domain[1] = max(domain[1], seasurface) - # Check vector if provided if vector is not None: @@ -697,6 +687,16 @@ def origin_and_widths(frequency, properties, center, domain=None, vector=None, if len(vector) < 3: vector = None + # Check seasurface. + if seasurface is not None: + + # Check that seasurface > center. + if seasurface <= center: + raise ValueError("The `seasurface` must be bigger than `center`.") + + # Expand domain to include seasurface if necessary. + domain[1] = max(domain[1], seasurface) + # If center_on_edge and no vector, we create a vector. if vector is None and center_on_edge: vector = np.r_[center-dmin, center, center+dmin]