Skip to content

Conversation

@xylar
Copy link
Collaborator

@xylar xylar commented Feb 4, 2026

We need to compute the time mask before we can use it as an index.

Checklist

  • Testing comment in the PR documents testing used to verify the changes

We need to compute the time mask before we can use it as an index.
@xylar xylar self-assigned this Feb 4, 2026
@xylar xylar added the bug label Feb 4, 2026
@xylar
Copy link
Collaborator Author

xylar commented Feb 4, 2026

Testing

Using zppy, I ran time-series analysis first over years 1985-1990 and then 1985-1995. Whereas I previously saw an error:

Plotting sea-ice area and volume time series...
  Load sea-ice data...
analysis task timeSeriesSeaIceAreaVol failed during run 
Traceback (most recent call last):
  File "/gpfs/fs1/home/ac.xylar/mpas_work/MPAS-Analysis/develop/mpas_analysis/shared/analysis_task.py", line 328, in run
    self.run_task()
    ~~~~~~~~~~~~~^^
  File "/gpfs/fs1/home/ac.xylar/mpas_work/MPAS-Analysis/develop/mpas_analysis/sea_ice/time_series.py", line 259, in run_task
    dsTimeSeries = self._compute_area_vol()
  File "/gpfs/fs1/home/ac.xylar/mpas_work/MPAS-Analysis/develop/mpas_analysis/sea_ice/time_series.py", line 699, in _compute_area_vol
    ds = ds.isel(Time=timeMask)
  File "/gpfs/fs1/home/ac.xylar/chrysalis/miniforge3/envs/mpas_analysis_dev/lib/python3.14/site-packages/xarray/core/dataset.py", line 2848, in isel
    return self._isel_fancy(indexers, drop=drop, missing_dims=missing_dims)
           ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/gpfs/fs1/home/ac.xylar/chrysalis/miniforge3/envs/mpas_analysis_dev/lib/python3.14/site-packages/xarray/core/dataset.py", line 2904, in _isel_fancy
    new_var = var.isel(indexers=var_indexers)
  File "/gpfs/fs1/home/ac.xylar/chrysalis/miniforge3/envs/mpas_analysis_dev/lib/python3.14/site-packages/xarray/core/variable.py", line 1130, in isel
    return self[key]
           ~~~~^^^^^
  File "/gpfs/fs1/home/ac.xylar/chrysalis/miniforge3/envs/mpas_analysis_dev/lib/python3.14/site-packages/xarray/core/variable.py", line 817, in __getitem__
    dims, indexer, new_order = self._broadcast_indexes(key)
                               ~~~~~~~~~~~~~~~~~~~~~~~^^^^^
  File "/gpfs/fs1/home/ac.xylar/chrysalis/miniforge3/envs/mpas_analysis_dev/lib/python3.14/site-packages/xarray/core/variable.py", line 656, in _broadcast_indexes
    self._validate_indexers(key)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^
  File "/gpfs/fs1/home/ac.xylar/chrysalis/miniforge3/envs/mpas_analysis_dev/lib/python3.14/site-packages/xarray/core/variable.py", line 709, in _validate_indexers
    raise KeyError(
    ...<4 lines>...
    )
KeyError: 'Indexing with a boolean dask array is not allowed. This will result in a dask array of unknown shape. Such arrays are unsupported by Xarray.Please compute the indexer first using .compute()'

with this fix, the error was not present.

I also successfully ran the developer suite when I also included the fix from #1137. Output can be found here:
https://web.lcrc.anl.gov/public/e3sm/diagnostic_output/xasaydavis/analysis_testing/chrysalis/fix-sea-ice-time-series/

@xylar xylar merged commit ea6b998 into MPAS-Dev:develop Feb 4, 2026
5 checks passed
@xylar xylar deleted the fix-sea-ice-time-series branch February 4, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant