Skip to content

Commit

Permalink
check xr.DataArray first
Browse files Browse the repository at this point in the history
  • Loading branch information
Lewis Blake committed Oct 1, 2024
1 parent bb1ab70 commit af3a797
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pyaerocom/colocation/colocated_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ def ensure_correct_dimensions(data: xr.DataArray):
If a ColocatedData object is created outside of pyaerocom, this checking is needed.
This function is used as part of the model validator.
"""
shape = data.shape[0]

if not isinstance(data, xr.DataArray):
raise ValueError("Could not interpret data")

shape = data.shape[0]
num_dims = len(data.dims)

if num_dims not in (2, 3, 4):
Expand Down

0 comments on commit af3a797

Please sign in to comment.