Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
phobson committed Oct 25, 2024
1 parent 1dcf624 commit 42de813
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion pygridtools/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,10 @@ def test_masks_no_polys(mg):

def test_ModelGrid_to_point_geodataframe(g1):
expectedfile = resource_filename('pygridtools.tests.baseline_files', 'mgshp_nomask_nodes_points.shp')
expected = geopandas.read_file(expectedfile)
expected = geopandas.read_file(expectedfile).assign(
ii=lambda df: df["ii"].astype("int64"),
jj=lambda df: df["jj"].astype("int64"),
)
result = g1.to_point_geodataframe(which='nodes', usemask=False)
utils.assert_gdfs_equal(expected.drop(columns=['river', 'reach']), result)

Expand Down
5 changes: 4 additions & 1 deletion pygridtools/tests/test_iotools.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ def test_read_grid():
known_df = pandas.DataFrame(
data={'easting': [1., 2., 3.] * 4, 'northing': sorted([4., 5., 6., 7.] * 3)},
index=pandas.MultiIndex.from_product([[2, 3, 4, 5], [2, 3, 4]], names=['jj', 'ii'])
).assign(elev=0.0).assign(river='test').reset_index().set_index(['ii', 'jj']).sort_index()
).assign(elev=0.0).assign(river='test').reset_index().set_index(['ii', 'jj']).sort_index().assign(
ii=lambda df: df["ii"].astype("int64"),
jj=lambda df: df["jj"].astype("int64"),
)

pdtest.assert_frame_equal(result_df, known_df)

Expand Down
2 changes: 1 addition & 1 deletion pygridtools/tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ def test_gdf_of_points(usemasks, fname, example_crs):
y = numpy.ma.masked_array(y, mask)

baselinedir = Path(resource_filename('pygridtools.tests', 'baseline_files'))
river = 'test'

expected = geopandas.read_file(str(baselinedir / fname)).assign(
ii=lambda df: df["ii"].astype("int64"),
jj=lambda df: df["jj"].astype("int64"),
Expand Down

0 comments on commit 42de813

Please sign in to comment.