Skip to content

Commit 373f9a8

Browse files
fixed vtransform=1 case to sfc at h+zeta
1 parent d28f6ef commit 373f9a8

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

gridded/depth.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import warnings
3+
import pdb
34

45
import numpy as np
56

@@ -675,6 +676,7 @@ def from_netCDF(
675676
if vtransform is None:
676677
vtransform = 2 # default for ROMS
677678

679+
print('678 ', zeta)
678680
return cls(
679681
name=name,
680682
time=time,
@@ -924,6 +926,7 @@ def interpolation_alphas(
924926
np.digitize, signature="(),(n)->()", excluded=["right"]
925927
)
926928
digitized_idxs = vf(depths, transects, right=False) - 1
929+
print('928 ', depths, transects)
927930

928931
# Re-apply horizontal boundary tracking via transect mask
929932
indices = np.ma.MaskedArray(digitized_idxs, mask=transects.mask[:, 0])
@@ -953,6 +956,8 @@ def interpolation_alphas(
953956
alphas[within_layer] = (depths[within_layer] - L0[within_layer]) / (
954957
L1[within_layer] - L0[within_layer]
955958
)
959+
print('957 ', surface_boundary_condition)
960+
print('958 ', indices, alphas.mask)
956961

957962
# Final pass validation checking actual data fields
958963
if np.isnan(alphas.filled(0)).any():
@@ -1091,6 +1096,8 @@ def get_transect(
10911096

10921097
s_c = self.s_rho if data_shape[0] == self.num_layers else self.s_w
10931098
C_s = self.Cs_r if data_shape[0] == self.num_layers else self.Cs_w
1099+
#print(self.s_rho, self.s_w, self.Cs_r, self.Cs_w)
1100+
#pdb.set_trace()
10941101
h = self.bathymetry.at(
10951102
points, time, unmask=False, _hash=_hash, **kwargs
10961103
)
@@ -1101,10 +1108,12 @@ def get_transect(
11011108
# rather than geoid
11021109
if self.vtransform == 1:
11031110
S = (hc * s_c) + hCs - (hc * C_s)[np.newaxis, :]
1104-
s_coord = -(S + zeta * (1 + S / h)) # RDM -(S + zeta * (1 + S / h))
1111+
s_coord = -(S + zeta * (S / h)) # RDM -(S + zeta * (1 + S / h))
11051112
elif self.vtransform == 2:
11061113
S = ((hc * s_c) + hCs) / (hc + h)
11071114
s_coord = -(zeta + h) * S #RDM -(zeta + (zeta + h) * S)
1115+
#print(S, s_coord)
1116+
#pdb.set_trace()
11081117
return s_coord
11091118

11101119

@@ -1237,4 +1246,4 @@ def from_netCDF(
12371246
data_file=data_file,
12381247
grid_file=grid_file,
12391248
**kwargs,
1240-
)
1249+
)

0 commit comments

Comments
 (0)