Skip to content

Commit

Permalink
updates to 1xMxN vs MxN issue
Browse files Browse the repository at this point in the history
  • Loading branch information
freemansw1 committed Jan 24, 2025
1 parent 1364012 commit d6ee0a1
Show file tree
Hide file tree
Showing 3 changed files with 243 additions and 953 deletions.

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion tobac/segmentation/watershed_segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import copy
import logging
import datetime
import warnings

import iris.cube
import xarray as xr
Expand Down Expand Up @@ -353,7 +354,7 @@ def segmentation_timestep(
Parameters
----------
field_in : iris.cube.Cube
field_in : xr.DataArray
Input field to perform the watershedding on (2D or 3D for one
specific point in time).
Expand Down Expand Up @@ -1264,6 +1265,13 @@ def segmentation(
else:
all_times = features["time"].map(np.datetime64)

if len(field.coords[time_var_name]) == 1:
warnings.warn(
"As of v1.6.0, segmentation with time length 1 will return time as a coordinate"
" instead of dropping it (i.e., output will now be 1xMxN instead of MxN). ",
UserWarning,
)

for time_iteration_number, time_iteration_value in enumerate(
field.coords[time_var_name]
):
Expand Down
Empty file.

0 comments on commit d6ee0a1

Please sign in to comment.