Skip to content

Commit 57d53be

Browse files
Updating decreasing depth error message with HINT
1 parent f3c59ab commit 57d53be

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/parcels/_core/xgrid.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,10 @@ def assert_valid_lat_lon(da_lat, da_lon, axes: _XGCM_AXES):
479479

480480
def assert_valid_depth(da_depth):
481481
if not np.all(np.diff(da_depth.values) > 0):
482-
raise ValueError(f"Depth DataArray {da_depth.name!r} with dims {da_depth.dims} must be strictly increasing.")
482+
raise ValueError(
483+
f"Depth DataArray {da_depth.name!r} with dims {da_depth.dims} must be strictly increasing. "
484+
f'HINT: you may be able to use ds.reindex to flip depth - e.g., ds = ds.reindex({da_depth.name}=ds["{da_depth.name}"][::-1])'
485+
)
483486

484487

485488
def _convert_center_pos_to_fpoint(

0 commit comments

Comments
 (0)