Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Translate test on CI #1

Merged
merged 11 commits into from
Feb 6, 2024
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ jobs:
sudo apt-get install libopenmpi-dev
- name: Install Python packages
run: |
python -m pip install --upgrade pip
pip install -r requirements_dev.txt -r requirements_lint.txt
python -m pip install --upgrade pip setuptools wheel
pip install .[develop]
- name: Run lint via pre-commit
run: |
pre-commit run --all-files
62 changes: 62 additions & 0 deletions .github/workflows/translate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: "Translate test (subset)"
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]

jobs:
all:
runs-on: ubuntu-latest
strategy:
matrix:
python: [3.11.7]
steps:
- name: Checkout repository
uses: actions/[email protected]
with:
submodules: 'recursive'
- name: Setup Python
uses: actions/[email protected]
with:
python-version: ${{ matrix.python }}
- name: Install OpenMPI & Boost for gt4py
run: |
sudo apt-get install libopenmpi-dev libboost1.74-dev
- name: Install Python packages
run: |
python -m pip install --upgrade pip setuptools wheel
pip install .[ndsl,test]
- name: Download data
run: |
mkdir -p test_data
cd test_data
wget https://portal.nccs.nasa.gov/datashare/astg/smt/pace-regression-data/8.1.3_c12_6_ranks_standard.FvTp2d.tar.gz
tar -xzvf 8.1.3_c12_6_ranks_standard.FvTp2d.tar.gz
wget https://portal.nccs.nasa.gov/datashare/astg/smt/pace-regression-data/8.1.3_c12_6_ranks_standard.D_SW.tar.gz
tar -xzvf 8.1.3_c12_6_ranks_standard.D_SW.tar.gz
wget https://portal.nccs.nasa.gov/datashare/astg/smt/pace-regression-data/8.1.3_c12_6_ranks_standard.Remapping.tar.gz
tar -xzvf 8.1.3_c12_6_ranks_standard.Remapping.tar.gz
cd -
- name: Numpy FvTp2d
run: |
pytest \
-v -s --data_path=./test_data/8.1.3/c12_6ranks_standard/dycore \
--backend=numpy \
--which_modules=FvTp2d \
--threshold_overrides_file=./tests/savepoint/translate/overrides/standard.yaml \
./tests/savepoint
- name: Numpy D_SW
run: |
pytest \
-v -s --data_path=./test_data/8.1.3/c12_6ranks_standard/dycore \
--backend=numpy \
--which_modules=D_SW \
--threshold_overrides_file=./tests/savepoint/translate/overrides/standard.yaml \
./tests/savepoint
- name: Numpy Remapping
run: |
pytest \
-v -s --data_path=./test_data/8.1.3/c12_6ranks_standard/dycore \
--backend=numpy \
--which_modules=Remapping \
--threshold_overrides_file=./tests/savepoint/translate/overrides/standard.yaml \
./tests/savepoint
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ celerybeat.pid

# Environments
.env
.venv
.venv*
env/
venv/
ENV/
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ repos:
- id: mypy
name: mypy-fv3core
args: [--config-file, setup.cfg]
files: fv3core
files: pyFV3
exclude: |
(?x)^(
fv3core/pace/fv3core/stencils/fv_subgridz.py |
fv3core/tests/conftest.py
pyFV3/stencils/fv_subgridz.py |
pyFV3/tests/conftest.py
)$
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
Expand Down
4 changes: 2 additions & 2 deletions pyFV3/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,9 @@ def __post_init__(self):
self.nf_omega = 0

@classmethod
def from_f90nml(self, f90_namelist: f90nml.Namelist) -> "DynamicalCoreConfig":
def from_f90nml(cls, f90_namelist: f90nml.Namelist) -> "DynamicalCoreConfig":
namelist = Namelist.from_f90nml(f90_namelist)
return self.from_namelist(namelist)
return cls.from_namelist(namelist)

@classmethod
def from_namelist(cls, namelist: Namelist) -> "DynamicalCoreConfig":
Expand Down
Empty file added pyFV3/wrappers/__init__.py
Empty file.
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,5 @@ ignore_missing_imports = True
follow_imports = normal
namespace_packages = True
strict_optional = False
mypy_path = pyFV3
warn_unreachable = True
explicit_package_bases = True
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"xarray",
]

test_requirements = ["pytest==5.2.2", "pytest-subtests>=0.3.0", "serialbox"]
test_requirements = ["pytest", "pytest-subtests", "serialbox"]
ndsl_requirements = ["ndsl @ git+https://github.com/NOAA-GFDL/NDSL.git@main"]
develop_requirements = test_requirements + ndsl_requirements + ["pre-commit"]

Expand Down
2 changes: 1 addition & 1 deletion tests/mpi/test_doubly_periodic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import ndsl.stencils.testing
import pyFV3
import pyFV3._config
import pyFV3.initialization.baroclinic as baroclinic_init
import pyFV3.initialization.test_cases.initialize_baroclinic as baroclinic_init
from ndsl.comm.communicator import CubedSphereCommunicator, TileCommunicator
from ndsl.comm.mpi import MPIComm
from ndsl.comm.partitioner import TilePartitioner
Expand Down
Loading