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

[BUG/ISSUE] Index error when creating 1-year benchmark plots for GCClassic vs GCHP #254

Closed
msulprizio opened this issue Aug 29, 2023 · 4 comments · Fixed by #255 or #257
Closed

[BUG/ISSUE] Index error when creating 1-year benchmark plots for GCClassic vs GCHP #254

msulprizio opened this issue Aug 29, 2023 · 4 comments · Fixed by #255 or #257
Labels
category: Bug Something isn't working

Comments

@msulprizio
Copy link
Contributor

Describe the bug

When trying to generate plots for GCClassic vs GCHP 1-year benchmarks (both fullchem and transport tracers), GCPy crashes with the following error:

%%% Creating GCHP vs. GCC emissions plots %%%

Creating plots for annual mean
joblib.externals.loky.process_executor._RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/n/home05/msulprizio/python/mamba/envs/gcpy_env/lib/python3.9/site-packages/joblib/externals/loky/process_executor.py", line 463, in _process_worker
    r = call_item()
  File "/n/home05/msulprizio/python/mamba/envs/gcpy_env/lib/python3.9/site-packages/joblib/externals/loky/process_executor.py", line 291, in __call__
    return self.fn(*self.args, **self.kwargs)
  File "/n/home05/msulprizio/python/mamba/envs/gcpy_env/lib/python3.9/site-packages/joblib/parallel.py", line 589, in __call__
    return [func(*args, **kwargs)
  File "/n/home05/msulprizio/python/mamba/envs/gcpy_env/lib/python3.9/site-packages/joblib/parallel.py", line 589, in <listcomp>
    return [func(*args, **kwargs)
  File "/n/home05/msulprizio/python/gcpy/gcpy/benchmark.py", line 1834, in createfile_hco_cat
    compare_single_level(
  File "/n/home05/msulprizio/python/gcpy/gcpy/plot.py", line 1710, in compare_single_level
    results = createfig(i, temp_dir)
  File "/n/home05/msulprizio/python/gcpy/gcpy/plot.py", line 1303, in createfig
    ds_dev_reg = get_extent_for_colors(
  File "/n/home05/msulprizio/python/gcpy/gcpy/plot.py", line 1291, in get_extent_for_colors
    return ds_new.where(ds_new[lon_var] >= minlon, drop=True).\
  File "/n/home05/msulprizio/python/mamba/envs/gcpy_env/lib/python3.9/site-packages/xarray/core/common.py", line 1181, in where
    self = self.isel(**indexers)
  File "/n/home05/msulprizio/python/mamba/envs/gcpy_env/lib/python3.9/site-packages/xarray/core/dataarray.py", line 1445, in isel
    ds = self._to_temp_dataset()._isel_fancy(
  File "/n/home05/msulprizio/python/mamba/envs/gcpy_env/lib/python3.9/site-packages/xarray/core/dataset.py", line 2930, in _isel_fancy
    new_var = var.isel(indexers=var_indexers)
  File "/n/home05/msulprizio/python/mamba/envs/gcpy_env/lib/python3.9/site-packages/xarray/core/variable.py", line 1368, in isel
    return self[key]
  File "/n/home05/msulprizio/python/mamba/envs/gcpy_env/lib/python3.9/site-packages/xarray/core/variable.py", line 891, in __getitem__
    dims, indexer, new_order = self._broadcast_indexes(key)
  File "/n/home05/msulprizio/python/mamba/envs/gcpy_env/lib/python3.9/site-packages/xarray/core/variable.py", line 724, in _broadcast_indexes
    self._validate_indexers(key)
  File "/n/home05/msulprizio/python/mamba/envs/gcpy_env/lib/python3.9/site-packages/xarray/core/variable.py", line 776, in _validate_indexers
    raise KeyError(
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()'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/n/home05/msulprizio/gcpy/benchmark/run_benchmark.py", line 1591, in <module>
    main()
  File "/n/home05/msulprizio/gcpy/benchmark/run_benchmark.py", line 1587, in main
    choose_benchmark_type(config)
  File "/n/home05/msulprizio/gcpy/benchmark/run_benchmark.py", line 92, in choose_benchmark_type
    run_1yr_benchmark(
  File "/n/home05/msulprizio/python/gcpy/benchmark/modules/run_1yr_fullchem_benchmark.py", line 978, in run_benchmark
    bmk.make_benchmark_emis_plots(
  File "/n/home05/msulprizio/python/gcpy/gcpy/benchmark.py", line 1861, in make_benchmark_emis_plots
    results = Parallel(n_jobs=n_job)(delayed(createfile_hco_cat)(c)
  File "/n/home05/msulprizio/python/mamba/envs/gcpy_env/lib/python3.9/site-packages/joblib/parallel.py", line 1952, in __call__
    return output if self.return_generator else list(output)
  File "/n/home05/msulprizio/python/mamba/envs/gcpy_env/lib/python3.9/site-packages/joblib/parallel.py", line 1595, in _get_outputs
    yield from self._retrieve()
  File "/n/home05/msulprizio/python/mamba/envs/gcpy_env/lib/python3.9/site-packages/joblib/parallel.py", line 1699, in _retrieve
    self._raise_error_fast()
  File "/n/home05/msulprizio/python/mamba/envs/gcpy_env/lib/python3.9/site-packages/joblib/parallel.py", line 1734, in _raise_error_fast
    error_job.get_result(self.timeout)
  File "/n/home05/msulprizio/python/mamba/envs/gcpy_env/lib/python3.9/site-packages/joblib/parallel.py", line 736, in get_result
    return self._return_or_raise()
  File "/n/home05/msulprizio/python/mamba/envs/gcpy_env/lib/python3.9/site-packages/joblib/parallel.py", line 754, in _return_or_raise
    raise self._result
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()'
real 38.78
user 57.60
sys 5.95
srun: error: holy7c24212: task 0: Exited with exit code 1

To Reproduce

I am using the latest version of the dev branch the this configuration file:
1yr_fullchem_benchmark.yml.txt

@msulprizio msulprizio added the category: Bug Something isn't working label Aug 29, 2023
@lizziel
Copy link
Contributor

lizziel commented Aug 29, 2023

It looks like this might be an xarray library version things. See StackOverflow post on it here.

@yantosca
Copy link
Contributor

@msulprizio, @lizziel: I am building a new (temporary) python environment using xarray==2023.02.0, which should not have this issue. Will keep you posted.

@yantosca
Copy link
Contributor

Fixed by #255

@yantosca
Copy link
Contributor

We can now close this as PR #257 has been merged into the GCPy 1.4.0 development stream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: Bug Something isn't working
Projects
None yet
3 participants