Skip to content

Commit

Permalink
Refactor: rename to pressure levels.
Browse files Browse the repository at this point in the history
  • Loading branch information
truth-quark committed Aug 30, 2024
1 parent 8c6abdd commit 09c66c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions test/test_um2netcdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ def test_fix_plevs_no_pressure_coord(get_fake_cube_coords):
with pytest.raises(iris.exceptions.CoordinateNotFoundError):
cube.coord("pressure") # ensure missing 'pressure' coord

um2nc.fix_plevs(cube) # should just exit
um2nc.fix_pressure_levels(cube) # should just exit


def _add_attrs_points(m_plevs: mock.MagicMock, points):
Expand All @@ -775,7 +775,7 @@ def test_fix_plevs_do_rounding(get_fake_cube_coords):
extra = {"pressure": m_plevs}
cube = get_fake_cube_coords(extra)

um2nc.fix_plevs(cube)
um2nc.fix_pressure_levels(cube)

# TODO: test flaw, this verifies pressure coord but ignores fix_plevs()
# returning a new cube if the pressure is reversed. This is verified
Expand All @@ -792,7 +792,7 @@ def test_fix_plevs_reverse_pressure(get_fake_cube_coords):
cube = get_fake_cube_coords(extra)

with mock.patch("iris.util.reverse"):
um2nc.fix_plevs(cube)
um2nc.fix_pressure_levels(cube)

# TODO: test flaw, this verifies pressure coord but ignores fix_plevs()
# returning a new cube if the pressure is reversed. This is verified
Expand Down
4 changes: 2 additions & 2 deletions umpost/um2netcdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def _add_coord_bounds(coord):
# TODO: split cube ops into functions, this will likely increase process() workflow steps
def cubewrite(cube, sman, compression, use64bit, verbose):
# TODO: move into process() AND if a new cube is returned, swap into filtered cube list
cube = fix_plevs(cube) or cube # NB: use new cube if pressure points are modified
cube = fix_pressure_levels(cube) or cube # NB: use new cube if pressure points are modified

if not use64bit:
if cube.data.dtype == 'float64':
Expand Down Expand Up @@ -727,7 +727,7 @@ def fix_level_coord(cube, z_rho, z_theta, tol=1e-6):
c_sigma.var_name = 'sigma_theta'


def fix_plevs(cube, decimals=5):
def fix_pressure_levels(cube, decimals=5):
"""
Reformat pressure level data for NetCDF output.
Expand Down

0 comments on commit 09c66c0

Please sign in to comment.