Skip to content

Commit

Permalink
BUG #1106: wrong dataset created from nc file with decreasing lat and…
Browse files Browse the repository at this point in the history
… bounds

We did not handle correctly a nc file which specifies bounds and
has decreasing latitude or longitude.
  • Loading branch information
danlipsa committed Nov 24, 2015
1 parent f89af2f commit 49d80ef
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions Packages/vcs/Lib/vcs2vtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,22 @@ def genGrid(data1, data2, gm, deep=True, grid=None, geo=None):
try:
blat = lat.getBounds()
blon = lon.getBounds()
lat2[:len(lat)] = blat[:, 0]
lat2[len(lat)] = blat[-1, 1]
lon2[:len(lon)] = blon[:, 0]
lon2[len(lon)] = blon[-1, 1]
if (lat[0] < lat[-1]):
# latitude is increasing
lat2[:len(lat)] = blat[:, 0]
lat2[len(lat)] = blat[-1, 1]
else:
# latitude is decreasing
lat2[:len(lat)] = blat[:, 1]
lat2[len(lat)] = blat[-1, 0]
if (lon[0] < lon[-1]):
# longitude is incresing
lon2[:len(lon)] = blon[:, 0]
lon2[len(lon)] = blon[-1, 1]
else:
# longitude is decreasing
lon2[:len(lon)] = blon[:, 1]
lon2[len(lon)] = blon[-1, 0]
xm = blon[0][0]
xM = blon[-1][1]
ym = blat[0][0]
Expand Down

0 comments on commit 49d80ef

Please sign in to comment.