Skip to content

Update data_2d.py #1030

Update data_2d.py

Update data_2d.py #1030

name: TestingInConda
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test-matrix:
name: Test (${{ matrix.python-version }}, ${{ matrix.pandas-track }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.11", "3.12", "3.13"]
pandas-track: ["pandas2", "pandas3"]
include:
- python-version: "3.11"
pandas-track: "pandas2"
pandas-constraint: "<3"
- python-version: "3.11"
pandas-track: "pandas3"
pandas-constraint: ">=3"
- python-version: "3.12"
pandas-track: "pandas2"
pandas-constraint: "<3"
- python-version: "3.12"
pandas-track: "pandas3"
pandas-constraint: ">=3"
- python-version: "3.13"
pandas-track: "pandas2"
pandas-constraint: "<3"
- python-version: "3.13"
pandas-track: "pandas3"
pandas-constraint: ">=3"
steps:
- uses: actions/checkout@v3
- name: Setup Miniconda with Mamba
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
channels: conda-forge
channel-priority: strict
python-version: ${{ matrix.python-version }}
miniforge-version: latest
use-mamba: true
- name: Cache Conda Packages
uses: actions/cache@v3
with:
path: ~/conda_pkgs_dir
key: conda-pkgs-${{ runner.os }}-py${{ matrix.python-version }}-pd${{ matrix.pandas-track }}-${{ hashFiles('environment.yml') }}
restore-keys: |
conda-pkgs-${{ runner.os }}-py${{ matrix.python-version }}-pd${{ matrix.pandas-track }}-
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Install Env
shell: bash
env:
CONDA_OVERRIDE_PYTHON: ${{ matrix.python-version }}
PANDAS_CONSTRAINT: pandas${{ matrix.pandas-constraint }}
run: |
python --version
mamba env create -f environment.yml --name mtpy-v2-test python=${{ matrix.python-version }} "$PANDAS_CONSTRAINT"
source ~/.profile
conda init --all
conda activate mtpy-v2-test
python --version
uv pip install git+https://github.com/simpeg/pydiso.git
uv pip install git+https://github.com/kujaku11/mt_metadata@main
uv pip install git+https://github.com/kujaku11/mth5.git@master
uv pip install git+https://github.com/simpeg/aurora@main
uv pip install git+https://github.com/MTgeophysics/mtpy_data.git
- name: Install Our Package
shell: bash
run: |
source ~/.profile
conda init --all
conda activate mtpy-v2-test
uv pip install -e .[test]
python -c "import pandas as pd; print(f'pandas version: {pd.__version__}')"
conda list
- name: Run Simpeg1D tests (non-Windows)
if: runner.os != 'Windows'
shell: bash
run: |
source ~/.profile
conda init --all
conda activate mtpy-v2-test
pytest -rA -q tests/modeling/simpeg/test_simpeg_1d_inversion_recipe.py
- name: Run Tests
shell: bash
run: |
source ~/.profile
conda init --all
conda activate mtpy-v2-test
pytest -rA -n 2 --ignore=tests/perf
coverage:
name: Coverage (3.12, pandas2, ubuntu-latest)
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v3
- name: Setup Miniconda with Mamba
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
channels: conda-forge
channel-priority: strict
python-version: "3.12"
miniforge-version: latest
use-mamba: true
- name: Cache Conda Packages
uses: actions/cache@v3
with:
path: ~/conda_pkgs_dir
key: conda-pkgs-${{ runner.os }}-py3.12-pdpandas2-${{ hashFiles('environment.yml') }}
restore-keys: |
conda-pkgs-${{ runner.os }}-py3.12-pdpandas2-
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Install Env
shell: bash
env:
CONDA_OVERRIDE_PYTHON: "3.12"
PANDAS_CONSTRAINT: "pandas<3"
run: |
python --version
mamba env create -f environment.yml --name mtpy-v2-test python=3.12 "$PANDAS_CONSTRAINT"
source ~/.profile
conda init --all
conda activate mtpy-v2-test
python --version
uv pip install git+https://github.com/simpeg/pydiso.git
uv pip install git+https://github.com/kujaku11/mt_metadata@main
uv pip install git+https://github.com/kujaku11/mth5.git@master
uv pip install git+https://github.com/simpeg/aurora@main
uv pip install git+https://github.com/MTgeophysics/mtpy_data.git
- name: Install Our Package
shell: bash
run: |
source ~/.profile
conda init --all
conda activate mtpy-v2-test
uv pip install -e .[test]
python -c "import pandas as pd; print(f'pandas version: {pd.__version__}')"
conda list
- name: Run Tests with Coverage
shell: bash
run: |
source ~/.profile
conda init --all
conda activate mtpy-v2-test
pytest -rA --cov=mtpy --cov-report=xml -n 2 --ignore=tests/perf
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
fail_ci_if_error: false
verbose: true
flags: tests