Skip to content

Commit

Permalink
Merge pull request #2904 from nawendt/fix-grid-bug
Browse files Browse the repository at this point in the history
Fix bug in GempakGrid
  • Loading branch information
dopplershift authored Jan 27, 2023
2 parents 0b499ba + 7d5c59f commit bb6d261
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/metpy/io/gempak.py
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ def __init__(self, file, *args, **kwargs):
n,
head.GTM1[0],
head.GDT1 + head.GTM1[1],
head.GDT2 + head.GTM2[1] if head.GDT2 and head.GDTM2 else None,
head.GDT2 + head.GTM2[1] if head.GDT2 and head.GTM2 else None,
head.GPM1 + head.GPM2 + head.GPM3,
head.GLV1,
head.GLV2,
Expand Down
1 change: 1 addition & 0 deletions src/metpy/static-data-manifest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ gem_cylindrical.grd 1b2ee56e4ee50d8d3012aa319f24a7c09e092db8e8a5a8f58e2d857a8fd1
gem_cylindrical.npz 68ea33a58b24b651254dd4d2c935c33fe4f414ffd404296c9098b6404a37e408
gem_model_mrg.csv 304afb3bb4b662f7adfc8803e8661fc217a691d0b1790d5e0e6d085f198c4257
gem_model_mrg.snd 6d229a7af8d3e86d8da02403023cdaf0f86b6c982eb8b6f7f84c3836811df014
gem_multi_time.grd a11746f162f2ea3944573246a477db94026f76e72ce7ecb98bd08c8475e2ca3f
gem_packing_dec.grd 547cda1ffb5e143623a33afce76a6cfa8c3c543eed04cf388f3005ccf1ba677d
gem_packing_dec.npz b4b3b838b245c0e0d0d803c049a9169c34fe1c09f267d98df5a0d0586297d18d
gem_packing_diff.grd 35de37fb378fe1c8cb1be56962ab3496ee079a3c6df4ef838cf1e2e8fd86da3f
Expand Down
Binary file added staticdata/gem_multi_time.grd
Binary file not shown.
13 changes: 13 additions & 0 deletions tests/io/test_gempak.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,16 @@ def test_special_surface_observation():
assert stn['chc2'] == 8004
assert stn['chc3'] == -9999
assert stn['vsby'] == 2


def test_multi_time_grid():
"""Test files with multiple times on a single grid."""
g = get_test_data('gem_multi_time.grd')

grid = GempakGrid(g)
grid_info = grid.gdinfo()[0]
dattim1 = grid_info.DATTIM1
dattim2 = grid_info.DATTIM2

assert dattim1 == datetime(1991, 8, 19, 0, 0)
assert dattim2 == datetime(1991, 8, 20, 0, 0)

0 comments on commit bb6d261

Please sign in to comment.