Skip to content

Commit

Permalink
Squeeze output in get_slice_miss only if more than 1 dimension
Browse files Browse the repository at this point in the history
  • Loading branch information
mcuntz committed Jan 14, 2024
1 parent 5aa90a5 commit edeeb30
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/ncvue/ncvmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
* Allow groups in netcdf files, Jan 2024, Matthias Cuntz
"""
from __future__ import absolute_import, division, print_function
import sys
import tkinter as tk
try:
Expand Down
8 changes: 6 additions & 2 deletions src/ncvue/ncvmethods.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
(get_dim_var) Oct 2021, Matthias Cuntz
* Address fi.variables[name] directly by fi[name], Jan 2024, Matthias Cuntz
* Allow groups in netcdf files, Jan 2024, Matthias Cuntz
* Squeeze output in get_slice_miss only if more than 1 dim,
Jan 2024, Matthias Cuntz
"""
from __future__ import absolute_import, division, print_function
Expand Down Expand Up @@ -557,8 +559,10 @@ def get_slice_miss(self, dimspins, x):
"""
miss = get_miss(self, x)
xx = get_slice(dimspins, x).squeeze()
xx = set_miss(miss, xx)
xx = get_slice(dimspins, x)
if xx.ndim > 1:
xx = xx.squeeze()
xx = set_miss(miss, xx)
# catch variables that have only one string or similar
try:
sx = xx.shape[0]
Expand Down

0 comments on commit edeeb30

Please sign in to comment.