Skip to content

Commit

Permalink
Use center_grid when opening tiff-file (#234)
Browse files Browse the repository at this point in the history
* Use center_grid when opening tiff-file

* use center_grid in test
  • Loading branch information
pat-schmitt authored Jan 31, 2024
1 parent fe1a230 commit f5e7e09
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions salem/sio.py
Original file line number Diff line number Diff line change
Expand Up @@ -922,8 +922,8 @@ def open_xr_dataset(file):
geo = GeoTiff(file)
# TODO: currently everything is loaded in memory (baaad)
da = xr.DataArray(geo.get_vardata(),
coords={'x': geo.grid.x_coord,
'y': geo.grid.y_coord},
coords={'x': geo.grid.center_grid.x_coord,
'y': geo.grid.center_grid.y_coord},
dims=['y', 'x'])
ds = xr.Dataset()
ds.attrs['pyproj_srs'] = geo.grid.proj.srs
Expand Down
4 changes: 2 additions & 2 deletions salem/tests/test_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ def test_xarray(self):
np.testing.assert_array_equal(ref.shape, (gos.salem.grid.ny, gos.salem.grid.nx))
np.testing.assert_array_equal(ref.shape, totest.shape)
np.testing.assert_array_equal(ref, totest)
rlon, rlat = geo.grid.ll_coordinates
tlon, tlat = go.salem.grid.ll_coordinates
rlon, rlat = geo.grid.center_grid.ll_coordinates
tlon, tlat = go.salem.grid.center_grid.ll_coordinates
assert_allclose(rlon, tlon)
assert_allclose(rlat, tlat)

Expand Down

0 comments on commit f5e7e09

Please sign in to comment.