Skip to content

Commit

Permalink
v1.7.1 : Bugfix trimmed z-vector (#294)
Browse files Browse the repository at this point in the history
* Fix vector-domain-seasurface
* Update workflows
  • Loading branch information
prisae authored Aug 2, 2022
1 parent bd515ba commit df86cc5
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/linkcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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: |
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/macos_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
------------------

Expand Down
20 changes: 10 additions & 10 deletions emg3d/meshes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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]
Expand Down

0 comments on commit df86cc5

Please sign in to comment.