From a0ff19f9891c7a957ecb263b1c66301dd7fe560f Mon Sep 17 00:00:00 2001 From: Iain Russell Date: Thu, 30 Nov 2023 23:19:05 +0000 Subject: [PATCH] Fix issue with alternativeRowScanning and mercator grid (#358) --- cfgrib/dataset.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cfgrib/dataset.py b/cfgrib/dataset.py index 3b16ca4c..8a52411b 100644 --- a/cfgrib/dataset.py +++ b/cfgrib/dataset.py @@ -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()