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

descriptive BSF error message #1078

Open
irenavankova opened this issue Mar 25, 2025 · 2 comments · May be fixed by #1079
Open

descriptive BSF error message #1078

irenavankova opened this issue Mar 25, 2025 · 2 comments · May be fixed by #1079

Comments

@irenavankova
Copy link
Collaborator

Unclear BSF error message when analysis is run without purge

@xylar
Copy link
Collaborator

xylar commented Mar 25, 2025

Here is a typical example:

Execution time: 0:00:00.33

Plotting 2-d maps of Barotropic Streamfunction climatologies for ANN on the antarctic_extended grid...
analysis task climatologyMapBSF_plotANN_antarctic_extended_10_to_-10000m failed during run
Traceback (most recent call last):
  File "/usr/projects/climate/vankova/miniconda3/envs/develop/lib/python3.13/site-packages/xarray/core/dataset.py", line 1206, in _construct_dataarray
    variable = self._variables[name]
               ~~~~~~~~~~~~~~~^^^^^^
KeyError: 'barotropicStreamfunctionAntarcticExtended'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/projects/climate/vankova/miniconda3/envs/develop/lib/python3.13/site-packages/xarray/core/dataset.py", line 1305, in __getitem__
    return self._construct_dataarray(key)
           ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^
  File "/usr/projects/climate/vankova/miniconda3/envs/develop/lib/python3.13/site-packages/xarray/core/dataset.py", line 1208, in _construct_dataarray
    _, name, variable = _get_virtual_variable(self._variables, name, self.sizes)
                        ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/projects/climate/vankova/miniconda3/envs/develop/lib/python3.13/site-packages/xarray/core/dataset_utils.py", line 79, in _get_virtual_variable
    raise KeyError(key)
KeyError: 'barotropicStreamfunctionAntarcticExtended'

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

Traceback (most recent call last):
  File "/usr/projects/climate/vankova/mpas-analysis/develop/mpas_analysis/shared/analysis_task.py", line 322, in run
    self.run_task()
    ~~~~~~~~~~~~~^^
  File "/usr/projects/climate/vankova/mpas-analysis/develop/mpas_analysis/shared/plot/plot_climatology_map_subtask.py", line 488, in run_task
    self._plot_projection(remappedModelClimatology,
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
                          remappedRefClimatology,
                          ^^^^^^^^^^^^^^^^^^^^^^^
                          componentName, componentSubdirectory)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/projects/climate/vankova/mpas-analysis/develop/mpas_analysis/shared/plot/plot_climatology_map_subtask.py", line 588, in _plot_projection
    remappedModelClimatology[self.mpasFieldName].values)
    ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "/usr/projects/climate/vankova/miniconda3/envs/develop/lib/python3.13/site-packages/xarray/core/dataset.py", line 1318, in __getitem__
    raise KeyError(message) from e
KeyError: "No variable named 'barotropicStreamfunctionAntarcticExtended'. Did you mean one of ('barotropicStreamfunction',)?"

Execution time: 0:00:00.33

@xylar
Copy link
Collaborator

xylar commented Mar 25, 2025

I think it will probably be easier to change the task that computes the BSF to recompute if plot regions are missing than it will be to have the generic PlotClimatologyMapSubtask produce a useful error message in this case.

@xylar xylar linked a pull request Mar 26, 2025 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants