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 Dec 1, 2023
1 parent a0ff19f commit 540df98
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions cfgrib/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,8 @@ 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 (
isinstance(values, np.ndarray)
and len(values.shape) == 2
and message.get("alternativeRowScanning", False)
):
# for 2D array (lat/lon) re-arrange if alternative row scanning
if len(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 540df98

Please sign in to comment.