Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
6879bf3
Add a source bathy class
manishvenu Apr 17, 2026
8a524ec
Black
manishvenu Apr 17, 2026
cdff74c
Bleh
manishvenu Apr 17, 2026
2ce1f06
Black + other
manishvenu Apr 17, 2026
b3f7a2c
Bump
manishvenu Apr 17, 2026
8da58c9
Compute topo stats func
manishvenu Apr 17, 2026
58d67d1
Add reqs
manishvenu Apr 17, 2026
a07f7b1
Bleh
manishvenu Apr 17, 2026
2894902
Smoke test
manishvenu Apr 17, 2026
422caa2
Reformat with xesmf (provides significant seam protection)
manishvenu Apr 20, 2026
7ea2573
Bleh
manishvenu Apr 20, 2026
e4f7b22
Changes
manishvenu Apr 20, 2026
94057e7
NewName
manishvenu Apr 20, 2026
4d1fc7a
this
manishvenu Apr 20, 2026
f492221
Merge branch 'source_bathy' into compute_stats
manishvenu Apr 20, 2026
6298b0b
Bug Fixes
manishvenu Apr 20, 2026
5277c23
Print
manishvenu Apr 23, 2026
abe58c3
Black
manishvenu Apr 23, 2026
8f05fec
Merge branch 'main' into source_bathy
manishvenu Apr 27, 2026
16f824a
Merge branch 'main' into source_bathy
manishvenu Apr 30, 2026
e6a9a3a
Merge branch 'source_bathy' into compute_stats
manishvenu Apr 30, 2026
3ce309d
Bleh
manishvenu Apr 30, 2026
cf08bc1
Source Property
manishvenu Apr 30, 2026
c004fb1
Merge branch 'source_bathy' into compute_stats
manishvenu Apr 30, 2026
a71834d
Src
manishvenu Apr 30, 2026
d8f8431
Merge branch 'source_bathy' into compute_stats
manishvenu Apr 30, 2026
77a5738
This
manishvenu Apr 30, 2026
0d3e55e
Bleh
manishvenu Apr 30, 2026
02bc910
Merge branch 'compute_stats' into stats_depth
manishvenu Apr 30, 2026
3006ab0
Bug Fix
manishvenu Apr 30, 2026
090eba8
Merge branch 'compute_stats' into stats_depth
manishvenu Apr 30, 2026
f62bf9d
Fix
manishvenu Apr 30, 2026
525445e
positive down
manishvenu Apr 30, 2026
46ed171
Merge branch 'source_bathy' into compute_stats
manishvenu Apr 30, 2026
294beea
Sb
manishvenu Apr 30, 2026
8d43ec3
Merge branch 'source_bathy' into compute_stats
manishvenu Apr 30, 2026
9263664
Merge branch 'compute_stats' into stats_depth
manishvenu Apr 30, 2026
700740a
Have Slice be on Init like tcm
manishvenu May 1, 2026
ffb8365
Merge branch 'source_bathy' into compute_stats
manishvenu May 1, 2026
f85df12
Merge branch 'compute_stats' into stats_depth
manishvenu May 1, 2026
045b713
Changes
manishvenu May 1, 2026
a6555da
Merge branch 'source_bathy' into compute_stats
manishvenu May 1, 2026
28550ab
Merge branch 'compute_stats' into stats_depth
manishvenu May 1, 2026
cd3a4f0
Merge branch 'main' into source_bathy
manishvenu May 1, 2026
72c366b
Merge branch 'source_bathy' into compute_stats
manishvenu May 1, 2026
1c7bd5d
Merge branch 'compute_stats' into stats_depth
manishvenu May 1, 2026
7b46dcf
Bug Fix
manishvenu May 1, 2026
594f898
Source XESMF ready dataset
manishvenu May 1, 2026
faec9d6
Merge branch 'source_bathy' into compute_stats
manishvenu May 1, 2026
6dbbb11
Merge branch 'compute_stats' into stats_depth
manishvenu May 1, 2026
d10c07f
Bleh
manishvenu May 1, 2026
a57b604
Merge branch 'compute_stats' into stats_depth
manishvenu May 1, 2026
24bc6af
Review Comments
manishvenu May 4, 2026
fdca235
Pass Tests
manishvenu May 4, 2026
a2da4e6
Merge branch 'source_bathy' into compute_stats
manishvenu May 4, 2026
7dcf6d3
Review Comments
manishvenu May 4, 2026
c81311b
tests pass
manishvenu May 4, 2026
292c57f
Ensure attributes are there on the source ds
manishvenu May 4, 2026
8db1346
Review Commetns
manishvenu May 8, 2026
feb866e
Bleh
manishvenu May 8, 2026
dfb4b08
Doc
manishvenu May 11, 2026
d136b54
Merge branch 'main' into source_bathy
manishvenu May 19, 2026
9bd4a3e
Replace config_dataset
manishvenu May 19, 2026
b338fa3
GIt
manishvenu May 19, 2026
d8896c0
Changes
manishvenu May 19, 2026
8390f69
rm the tidy dataset positive down situation
manishvenu May 19, 2026
c494878
Last Fixes
manishvenu May 19, 2026
f095aa9
Merge branch 'source_bathy' into compute_stats
manishvenu May 19, 2026
0f2a928
Put the stats on the source
manishvenu May 19, 2026
07d0230
Merge branch 'compute_stats' into stats_depth
manishvenu May 19, 2026
b6c3e90
Merge branch 'source_bathy' into compute_stats
manishvenu May 19, 2026
87b0217
Merge branch 'compute_stats' into stats_depth
manishvenu May 19, 2026
7cf2011
Fix
manishvenu May 19, 2026
f864bbc
Merge branch 'compute_stats' into stats_depth
manishvenu May 19, 2026
f58f36c
pass
manishvenu May 19, 2026
622e429
Balc
manishvenu May 19, 2026
dab0138
Docs & Move Longitude Slicer
manishvenu May 20, 2026
d2d93ec
Review Comments
manishvenu May 20, 2026
b5583cb
Merge branch 'source_bathy' into compute_stats
manishvenu May 20, 2026
69fc827
black
manishvenu May 20, 2026
e398bc3
remove extra fxtures
manishvenu May 20, 2026
2c9b0fe
Imports
manishvenu May 20, 2026
33a43e4
Merge branch 'main' into compute_stats_try_merge
manishvenu May 20, 2026
7d0a5c1
Thing
manishvenu May 20, 2026
c11d450
Merge branch 'compute_stats' into stats_depth
manishvenu May 21, 2026
61778af
Fix
manishvenu May 21, 2026
b98b129
Property
manishvenu May 21, 2026
3ea0cca
One more
manishvenu May 21, 2026
6a6f99e
Add Chl improvement
manishvenu May 21, 2026
474a4a1
Revert "Add Chl improvement"
manishvenu May 22, 2026
2974394
Allow regrid_with_subsampling to take additional dims
manishvenu May 22, 2026
b0c2bb4
Add Saving Regridder
manishvenu May 22, 2026
20021ec
Merge branch 'compute_stats' into stats_depth
manishvenu May 22, 2026
5b10ccb
Merge branch 'main' into stats_depth
manishvenu May 22, 2026
e94fd96
Issue
manishvenu May 22, 2026
1f2b3bd
Rename direct_stats_depth to set_depth_from_stats, fix docstring
manishvenu May 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions mom6_forge/topo.py
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,30 @@ def _compute_stats(self, nx_sub, ny_sub, mask_hmin):
)
return self.stats

def set_depth_from_stats(self, statistic):
"""
Set the topo depth to a statistic computed by _compute_stats.

Parameters
----------
statistic : str
Which depth statistic to use. Must be one of the "D_*" keys
in self.src.stats (e.g. "mean", "min", "max").
"""

assert (
self.src.stats is not None
), "Source bathymetry must have topo stats computed, please call _compute_stats first if you have not already"
approved_list = []
for key in self.src.stats.data_vars:
if key.startswith("D_"):
approved_list.append(key[2:])
assert (
statistic in approved_list
), f"Invalid statistic {statistic}, must be one of {approved_list}"

self.send_entire_depth_change_to_tcm(self.src.stats[f"D_{statistic}"])

def set_from_dataset(
self,
bathymetry_path,
Expand Down
22 changes: 22 additions & 0 deletions tests/test_topo_bathymetry_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,25 @@ def test_compute_topo_stats(get_rect_topo, synthetic_bathy_file):
stats2 = topo._compute_stats(nx_sub=nx_sub, ny_sub=ny_sub, mask_hmin=0.0)
# Should be the exact same object (cached)
assert stats2 is stats


def test_set_depth_from_stats(get_rect_topo, synthetic_bathy_file):
"""Test set_depth_from_stats sets topo depth to the chosen statistic from _compute_stats."""
topo = get_rect_topo

# Load source bathymetry and slice to topo domain
src = SourceBathy(
topo,
synthetic_bathy_file,
depth_name="elevation",
is_input_positive_below_msl=False,
)
topo.src = src
topo._compute_stats(nx_sub=2, ny_sub=2, mask_hmin=0.0)

topo.set_depth_from_stats("mean")

mask = ~np.isnan(topo.depth.values)
assert np.isclose(
topo.depth.values[mask], topo.src.stats["D_mean"].values[mask]
).all()
Loading