Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
anton-seaice committed Apr 4, 2024
1 parent 8be5509 commit 6b8c644
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
6 changes: 3 additions & 3 deletions om3utils/cice_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def build_from_mom(self, ocean_hgrid, ocean_mask):


if __name__ == "__main__":
#command line arguments
from utils import md5sum # load from file
# command line arguments
from utils import md5sum # load from file

Check warning on line 73 in om3utils/cice_grid.py

View check run for this annotation

Codecov / codecov/patch

om3utils/cice_grid.py#L73

Added line #L73 was not covered by tests

parser = argparse.ArgumentParser()
parser.add_argument("ocean_hgrid", help="ocean_hgrid.nc file")
Expand All @@ -84,4 +84,4 @@ def build_from_mom(self, ocean_hgrid, ocean_mask):
sys.exit(grid.build_from_mom(**args))

Check warning on line 84 in om3utils/cice_grid.py

View check run for this annotation

Codecov / codecov/patch

om3utils/cice_grid.py#L84

Added line #L84 was not covered by tests

else:
from .utils import md5sum #load from package
from .utils import md5sum # load from package
26 changes: 17 additions & 9 deletions tests/test_cice_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@ def __init__(self, tmp_path):
self.mask_path = str(tmp_path) + "/ocean_mask.nc"

# generate an tripolar grid as test data
run([
"ocean_grid_generator.py",
"-r", "0.25", #4 degree grid
"--no_south_cap",
"--ensure_nj_even",
"-f", self.path
])
run(
[
"ocean_grid_generator.py",
"-r",
"0.25", # 4 degree grid
"--no_south_cap",
"--ensure_nj_even",
"-f",
self.path,
]
)

# open ocean_hgrid.nc
self.ds = xr.open_dataset(self.path)
Expand Down Expand Up @@ -185,5 +189,9 @@ def test_inputs_logged(cice_grid, mom_grid):
sys_md5 = sys_md5.stdout.split(" ")[0]
assert ds.inputfile_md5 == sys_md5, f"inputfile md5sum attribute incorrect, {ds.inputfile_md5} != {sys_md5}"

assert cice_grid.ds.inputfile == mom_grid.path, "inputfile attribute incorrect ({cice_grid.ds.inputfile} != {mom_grid.path})"
assert cice_grid.kmt_ds.inputfile == mom_grid.mask_path, "mask inputfile attribute incorrect ({cice_grid.kmt_ds.inputfile} != {mom_grid.mask_path})"
assert (
cice_grid.ds.inputfile == mom_grid.path
), "inputfile attribute incorrect ({cice_grid.ds.inputfile} != {mom_grid.path})"
assert (
cice_grid.kmt_ds.inputfile == mom_grid.mask_path
), "mask inputfile attribute incorrect ({cice_grid.kmt_ds.inputfile} != {mom_grid.mask_path})"

0 comments on commit 6b8c644

Please sign in to comment.