@@ -17,8 +17,9 @@ def fixture_grid():
17
17
Load the grid data from the sample earth_relief file and set value(s) to
18
18
NaN.
19
19
"""
20
- grid = load_earth_relief (registration = "pixel" )
21
- grid [10 , 10 ] = np .nan
20
+ grid = load_earth_relief (registration = "pixel" , region = [- 5 , 5 , - 5 , 5 ])
21
+ grid [3 :5 , 3 :5 ] = np .nan
22
+ grid [5 :7 , 5 :7 ] = np .inf
22
23
return grid
23
24
24
25
@@ -29,7 +30,11 @@ def test_grdfill_dataarray_out(grid):
29
30
result = grdfill (grid = grid , mode = "c20" )
30
31
# check information of the output grid
31
32
assert isinstance (result , xr .DataArray )
32
- assert result [10 , 10 ] == 20
33
+ assert result [4 , 4 ] == 20
34
+ assert result [5 , 5 ] == np .inf
35
+ assert not result .isnull ().all () # check that no NaN values exists
36
+ assert result .gmt .gtype == 1 # Geographic grid
37
+ assert result .gmt .registration == 1 # Pixel registration
33
38
34
39
35
40
def test_grdfill_file_out (grid ):
@@ -41,4 +46,4 @@ def test_grdfill_file_out(grid):
41
46
assert result is None # return value is None
42
47
assert os .path .exists (path = tmpfile .name ) # check that outgrid exists
43
48
result = grdinfo (tmpfile .name , per_column = True ).strip ()
44
- assert result == "-180 180 -90 90 -8182 5651 .5 1 1 360 180 1 1"
49
+ assert result == "-5 5 -5 5 -5130 .5 inf 1 1 10 10 1 1"
0 commit comments