Skip to content

Commit 026d696

Browse files
authored
Merge pull request #391 from xylar/add_depth_coord_testing
Fix further bugs in ocean depth module
2 parents e9fd47b + e654fbe commit 026d696

14 files changed

+204
-32
lines changed

azure-pipelines.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ jobs:
2424
python.version: '3.7'
2525
Python38:
2626
python.version: '3.8'
27+
Python39:
28+
python.version: '3.9'
2729

2830
steps:
2931
- bash: echo "##vso[task.prependpath]$CONDA/bin"
@@ -141,6 +143,8 @@ jobs:
141143
python.version: '3.7'
142144
Python38:
143145
python.version: '3.8'
146+
Python39:
147+
python.version: '3.9'
144148

145149
steps:
146150
- bash: echo "##vso[task.prependpath]$CONDA/bin"

conda_package/ci/linux_python3.6.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ channel_sources:
33
cxx_compiler:
44
- gxx
55
cxx_compiler_version:
6-
- '7'
6+
- '9'
77
hdf5:
88
- 1.10.6
99
libnetcdf:

conda_package/ci/linux_python3.7.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ channel_sources:
33
cxx_compiler:
44
- gxx
55
cxx_compiler_version:
6-
- '7'
6+
- '9'
77
hdf5:
88
- 1.10.6
99
libnetcdf:

conda_package/ci/linux_python3.8.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ channel_sources:
33
cxx_compiler:
44
- gxx
55
cxx_compiler_version:
6-
- '7'
6+
- '9'
77
hdf5:
88
- 1.10.6
99
pin_run_as_build:
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
channel_sources:
2+
- conda-forge,defaults
3+
cxx_compiler:
4+
- gxx
5+
cxx_compiler_version:
6+
- '9'
7+
hdf5:
8+
- 1.10.6
9+
pin_run_as_build:
10+
python:
11+
min_pin: x.x
12+
max_pin: x.x
13+
python:
14+
- 3.9.* *_cpython

conda_package/ci/osx_python3.6.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ channel_sources:
33
cxx_compiler:
44
- clangxx
55
cxx_compiler_version:
6-
- '10'
6+
- '11'
77
hdf5:
88
- 1.10.6
99
libnetcdf:

conda_package/ci/osx_python3.7.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ channel_sources:
33
cxx_compiler:
44
- clangxx
55
cxx_compiler_version:
6-
- '10'
6+
- '11'
77
hdf5:
88
- 1.10.6
99
libnetcdf:

conda_package/ci/osx_python3.8.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ channel_sources:
33
cxx_compiler:
44
- clangxx
55
cxx_compiler_version:
6-
- '10'
6+
- '11'
77
hdf5:
88
- 1.10.6
99
libnetcdf:
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
channel_sources:
2+
- conda-forge,defaults
3+
cxx_compiler:
4+
- clangxx
5+
cxx_compiler_version:
6+
- '11'
7+
hdf5:
8+
- 1.10.6
9+
libnetcdf:
10+
- 4.7.4
11+
pin_run_as_build:
12+
python:
13+
min_pin: x.x
14+
max_pin: x.x
15+
python:
16+
- 3.9.* *_cpython

conda_package/mpas_tools/ocean/depth.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ def compute_zmid(bottomDepth, maxLevelCell, layerThickness,
8989
zMid = zLayerBot + 0.5*layerThickness
9090

9191
zMid = zMid.where(vertIndex < maxLevelCell)
92-
zMid = zMid.transpose('Time', 'nCells', depth_dim)
92+
if 'Time' in zMid.dims:
93+
zMid = zMid.transpose('Time', 'nCells', depth_dim)
94+
else:
95+
zMid = zMid.transpose('nCells', depth_dim)
9396

9497
return zMid
9598

@@ -202,6 +205,8 @@ def add_zmid(inFileName, outFileName, coordFileName=None):
202205
# dsCoord doesn't have masking disabled because we want it for zMid
203206
dsCoord = xarray.open_dataset(coordFileName)
204207
dsCoord = dsCoord.rename({'nVertLevels': 'depth'})
208+
if 'Time' in dsCoord.dims:
209+
dsCoord = dsCoord.isel(Time=0)
205210

206211
ds.coords['zMid'] = compute_zmid(dsCoord.bottomDepth,
207212
dsCoord.maxLevelCell,
@@ -254,7 +259,7 @@ def main_add_zmid():
254259

255260

256261
def write_time_varying_zmid(inFileName, outFileName, coordFileName=None,
257-
prefix=None):
262+
prefix=''):
258263
"""
259264
Add a 3D, time-independent depth coordinate to an MPAS-Ocean file.
260265

0 commit comments

Comments
 (0)