Skip to content

Commit

Permalink
Fix issue with alternativeRowScanning and mercator grid (#358)
Browse files Browse the repository at this point in the history
  • Loading branch information
iainrussell committed Nov 30, 2023
1 parent 5c493fc commit a0ff19f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cfgrib/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,11 @@ def get_values_in_order(message, shape):
# type: (abc.Field, T.Tuple[int]) -> np.ndarray
# inform the data provider to return missing values as missing_value
values = message["values"]
if len(values.shape) == 2 and message.get("alternativeRowScanning", False):
if (
isinstance(values, np.ndarray)
and len(values.shape) == 2
and message.get("alternativeRowScanning", False)
):
values = values.copy().reshape(shape)
values[1::2, :] = values[1::2, ::-1]
return values.flatten()
Expand Down

0 comments on commit a0ff19f

Please sign in to comment.