@@ -237,8 +237,14 @@ def reproject_geodata(geodata, t_proj4str, return_grid=None):
237
237
# Reproject grid on fall-back projection
238
238
if return_grid is not None :
239
239
if return_grid == "coords" :
240
- y_coord = np .linspace (y1 , y2 , shape [0 ]) + geodata ["ypixelsize" ] / 2.0
241
- x_coord = np .linspace (x1 , x2 , shape [1 ]) + geodata ["xpixelsize" ] / 2.0
240
+ y_coord = (
241
+ np .linspace (y1 , y2 , shape [0 ], endpoint = False )
242
+ + geodata ["ypixelsize" ] / 2.0
243
+ )
244
+ x_coord = (
245
+ np .linspace (x1 , x2 , shape [1 ], endpoint = False )
246
+ + geodata ["xpixelsize" ] / 2.0
247
+ )
242
248
elif return_grid == "quadmesh" :
243
249
y_coord = np .linspace (y1 , y2 , shape [0 ] + 1 )
244
250
x_coord = np .linspace (x1 , x2 , shape [1 ] + 1 )
@@ -327,7 +333,7 @@ def get_geogrid(nlat, nlon, geodata=None):
327
333
Four-element tuple specifying the extent of the domain according to
328
334
(lower left x, upper right x, lower left y, upper right y).
329
335
regular_grid: bool
330
- True is the grid is regular. False otherwise.
336
+ True if the grid is regular. False otherwise.
331
337
origin: str
332
338
Place the [0, 0] index of the array to plot in the upper left or lower left
333
339
corner of the axes.
@@ -337,13 +343,15 @@ def get_geogrid(nlat, nlon, geodata=None):
337
343
regular_grid = geodata .get ("regular_grid" , True )
338
344
339
345
x_lims = sorted ((geodata ["x1" ], geodata ["x2" ]))
340
- x = np .linspace (x_lims [0 ], x_lims [1 ], nlon )
341
- xpixelsize = np .abs (x [1 ] - x [0 ])
346
+ x , xpixelsize = np .linspace (
347
+ x_lims [0 ], x_lims [1 ], nlon , endpoint = False , retstep = True
348
+ )
342
349
x += xpixelsize / 2.0
343
350
344
351
y_lims = sorted ((geodata ["y1" ], geodata ["y2" ]))
345
- y = np .linspace (y_lims [0 ], y_lims [1 ], nlat )
346
- ypixelsize = np .abs (y [1 ] - y [0 ])
352
+ y , ypixelsize = np .linspace (
353
+ y_lims [0 ], y_lims [1 ], nlat , endpoint = False , retstep = True
354
+ )
347
355
y += ypixelsize / 2.0
348
356
349
357
extent = (geodata ["x1" ], geodata ["x2" ], geodata ["y1" ], geodata ["y2" ])
0 commit comments