Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ocean integrals seemingly don't work anymore #16

Open
JanStreffing opened this issue Jun 18, 2024 · 0 comments
Open

Ocean integrals seemingly don't work anymore #16

JanStreffing opened this issue Jun 18, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@JanStreffing
Copy link
Contributor

On branch: https://github.com/FESOM/fdiag/tree/feat/prep_for_2.6 in script https://github.com/FESOM/fdiag/blob/feat/prep_for_2.6/workflows/prep_fesom2.6/reference_vs_remove_PARMS.yml

ocean_integrals:
    Global Ocean:
        temp:
            uplows: [[0, 100]]

results in:

!!! Performing ocean_integrals !!!
Passed unknown parameter: workflow_name
Passed unknown parameter: climatology_path
Passed unknown parameter: climatology_year
Passed unknown parameter: columns
Passed unknown parameter: bbox
Passed unknown parameter: res
Passed unknown parameter: mapproj
Passed unknown parameter: figsize_small
Passed unknown parameter: start_year
Passed unknown parameter: end_year
Passed unknown parameter: start_year_short
Passed unknown parameter: end_year_short
Passed unknown parameter: years_short
Passed unknown parameter: workflow_settings
Passed unknown parameter: ofolder_notebooks
Passed unknown parameter: ofolder_figures
Passed unknown parameter: uplows
Executing:  58%|██████████████████████████████████████████████████████████████▍                                            | 7/12 [03:55<02:48, 33.69s/cell]
Traceback (most recent call last):
  File "/work/ab0246/a270092/software/miniconda3/envs/fdiag/bin/fdiag", line 33, in <module>
    sys.exit(load_entry_point('fdiag', 'console_scripts', 'fdiag')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/ab0246/a270092/software/fdiag/fdiag/fdiag.py", line 242, in fdiag
    webpage = analyses[analysis](settings, analysis)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/ab0246/a270092/software/fdiag/fdiag/drivers.py", line 278, in drive_ocean_integrals
    pm.execute_notebook(
  File "/work/ab0246/a270092/software/miniconda3/envs/fdiag/lib/python3.12/site-packages/papermill/execute.py", line 131, in execute_notebook
    raise_for_execution_errors(nb, output_path)
  File "/work/ab0246/a270092/software/miniconda3/envs/fdiag/lib/python3.12/site-packages/papermill/execute.py", line 251, in raise_for_execution_errors
    raise error
papermill.exceptions.PapermillExecutionError:
---------------------------------------------------------------------------
Exception encountered at "In [7]":
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
Cell In[7], line 5
      3 for key, value in ocean_int.items():
      4     at_level[key] = {}
----> 5     at_level[key]['data'] = pf.volmean_data(value['data'], mesh, [uplow[0], uplow[1]], mask=mask )

File /work/ab0246/a270092/software/miniconda3/envs/fdiag/lib/python3.12/site-packages/pyfesom2/diagnostics.py:341, in volmean_data(data, mesh, uplow, meshdiag, runid, mask)
    339 if mask is not None:
    340     nod_area = nod_area[:, mask]
--> 341     data = data[:, mask, :]
    343 for i in indexes:
    344     nod_area_at_level = np.ma.masked_equal(nod_area[i, :].data, 0)

File /work/ab0246/a270092/software/miniconda3/envs/fdiag/lib/python3.12/site-packages/xarray/core/dataarray.py:876, in DataArray.__getitem__(self, key)
    873     return self._getitem_coord(key)
    874 else:
    875     # xarray-style array indexing
--> 876     return self.isel(indexers=self._item_key_to_dict(key))

File /work/ab0246/a270092/software/miniconda3/envs/fdiag/lib/python3.12/site-packages/xarray/core/dataarray.py:1509, in DataArray.isel(self, indexers, drop, missing_dims, **indexers_kwargs)
   1504     return self._from_temp_dataset(ds)
   1506 # Much faster algorithm for when all indexers are ints, slices, one-dimensional
   1507 # lists, or zero or one-dimensional np.ndarray's
-> 1509 variable = self._variable.isel(indexers, missing_dims=missing_dims)
   1510 indexes, index_variables = isel_indexes(self.xindexes, indexers)
   1512 coords = {}

File /work/ab0246/a270092/software/miniconda3/envs/fdiag/lib/python3.12/site-packages/xarray/core/variable.py:1033, in Variable.isel(self, indexers, missing_dims, **indexers_kwargs)
   1030 indexers = drop_dims_from_indexers(indexers, self.dims, missing_dims)
   1032 key = tuple(indexers.get(dim, slice(None)) for dim in self.dims)
-> 1033 return self[key]

File /work/ab0246/a270092/software/miniconda3/envs/fdiag/lib/python3.12/site-packages/xarray/core/variable.py:797, in Variable.__getitem__(self, key)
    784 def __getitem__(self, key) -> Self:
    785     """Return a new Variable object whose contents are consistent with
    786     getting the provided key from the underlying data.
    787
   (...)
    795     array `x.values` directly.
    796     """
--> 797     dims, indexer, new_order = self._broadcast_indexes(key)
    798     indexable = as_indexable(self._data)
    800     data = indexing.apply_indexer(indexable, indexer)

File /work/ab0246/a270092/software/miniconda3/envs/fdiag/lib/python3.12/site-packages/xarray/core/variable.py:637, in Variable._broadcast_indexes(self, key)
    634 if all(isinstance(k, BASIC_INDEXING_TYPES) for k in key):
    635     return self._broadcast_indexes_basic(key)
--> 637 self._validate_indexers(key)
    638 # Detect it can be mapped as an outer indexer
    639 # If all key is unlabeled, or
    640 # key can be mapped as an OuterIndexer.
    641 if all(not isinstance(k, Variable) for k in key):

File /work/ab0246/a270092/software/miniconda3/envs/fdiag/lib/python3.12/site-packages/xarray/core/variable.py:679, in Variable._validate_indexers(self, key)
    677 if k.dtype.kind == "b":
    678     if self.shape[self.get_axis_num(dim)] != len(k):
--> 679         raise IndexError(
    680             f"Boolean array size {len(k):d} is used to index array "
    681             f"with shape {str(self.shape):s}."
    682         )
    683     if k.ndim > 1:
    684         raise IndexError(
    685             f"{k.ndim}-dimensional boolean indexing is "
    686             "not supported. "
    687         )

IndexError: Boolean array size 126858 is used to index array with shape (61, 47, 126858).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants