Skip to content

Commit

Permalink
Merge pull request #236 from jswhit/issue235
Browse files Browse the repository at this point in the history
fix for issue #235 (latlons doesn't work if only 1 latitude in grid)
  • Loading branch information
jswhit authored Feb 13, 2024
2 parents 6f1c5a4 + 5416327 commit 00c8892
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ version 2.1.6 (not yet released)
* switch dynamic version handling from pkg_resources (in setuptools) to packaging
* expose 'redtoreg' function for interpolating reduced to full gaussian
gridded fields, optimize function for 50x speedup.
* Fix for issue #235 (`latlons` doesn't work when only a single latitude in grid).

version 2.1.5 release
=====================
Expand Down
3 changes: 2 additions & 1 deletion src/pygrib/_pygrib.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,8 @@ cdef class gribmessage(object):
lat1 = self['latitudeOfFirstGridPointInDegrees']
lat2 = self['latitudeOfLastGridPointInDegrees']
lats = self['distinctLatitudes']
if lat2 < lat1 and lats[-1] > lats[0]: lats = lats[::-1]
if self['Nj'] > 1:
if lat2 < lat1 and lats[-1] > lats[0]: lats = lats[::-1]
lons = self['distinctLongitudes']
lons,lats = np.meshgrid(lons,lats)
elif self['gridType'] == 'reduced_gg': # reduced global gaussian grid
Expand Down

0 comments on commit 00c8892

Please sign in to comment.