@@ -82,34 +82,55 @@ def test_surface_wrong_kind_of_input(ship_data):
82
82
surface (data = data , spacing = "5m" , region = [245 , 255 , 20 , 30 ])
83
83
84
84
85
- def test_surface_with_outfile_param (ship_data ):
85
+ def test_surface_with_outgrid_param (ship_data ):
86
86
"""
87
87
Run surface with the -Goutputfile.nc parameter.
88
88
"""
89
89
data = ship_data .values # convert pandas.DataFrame to numpy.ndarray
90
90
try :
91
91
output = surface (
92
- data = data , spacing = "5m" , region = [245 , 255 , 20 , 30 ], outfile = TEMP_GRID
92
+ data = data , spacing = "5m" , region = [245 , 255 , 20 , 30 ], outgrid = TEMP_GRID
93
93
)
94
- assert output is None # check that output is None since outfile is set
95
- assert os .path .exists (path = TEMP_GRID ) # check that outfile exists at path
94
+ assert output is None # check that output is None since outgrid is set
95
+ assert os .path .exists (path = TEMP_GRID ) # check that outgrid exists at path
96
96
with xr .open_dataarray (TEMP_GRID ) as grid :
97
97
assert isinstance (grid , xr .DataArray ) # ensure netcdf grid loads ok
98
98
finally :
99
99
os .remove (path = TEMP_GRID )
100
100
return output
101
101
102
102
103
+ def test_surface_deprecate_outfile_to_outgrid (ship_data ):
104
+ """
105
+ Make sure that the old parameter "outfile" is supported and it reports a
106
+ warning.
107
+ """
108
+ with pytest .warns (expected_warning = FutureWarning ) as record :
109
+ data = ship_data .values # convert pandas.DataFrame to numpy.ndarray
110
+ try :
111
+ output = surface (
112
+ data = data , spacing = "5m" , region = [245 , 255 , 20 , 30 ], outfile = TEMP_GRID
113
+ )
114
+ assert output is None # check that output is None since outfile is set
115
+ assert os .path .exists (path = TEMP_GRID ) # check that file exists at path
116
+
117
+ with xr .open_dataarray (TEMP_GRID ) as grid :
118
+ assert isinstance (grid , xr .DataArray ) # ensure netcdf grid loads ok
119
+ finally :
120
+ os .remove (path = TEMP_GRID )
121
+ assert len (record ) == 1 # check that only one warning was raised
122
+
123
+
103
124
def test_surface_short_aliases (ship_data ):
104
125
"""
105
126
Run surface using short aliases -I for spacing, -R for region, -G for
106
- outfile .
127
+ outgrid .
107
128
"""
108
129
data = ship_data .values # convert pandas.DataFrame to numpy.ndarray
109
130
try :
110
131
output = surface (data = data , I = "5m" , R = [245 , 255 , 20 , 30 ], G = TEMP_GRID )
111
- assert output is None # check that output is None since outfile is set
112
- assert os .path .exists (path = TEMP_GRID ) # check that outfile exists at path
132
+ assert output is None # check that output is None since outgrid is set
133
+ assert os .path .exists (path = TEMP_GRID ) # check that outgrid exists at path
113
134
with xr .open_dataarray (TEMP_GRID ) as grid :
114
135
assert isinstance (grid , xr .DataArray ) # ensure netcdf grid loads ok
115
136
finally :
0 commit comments