@@ 169-185 (lines=17) @@ | ||
166 | _assert_class_equal(l2_o, l2_t) |
|
167 | ||
168 | ||
169 | @pytest.mark.parametrize( |
|
170 | "dirname, version", |
|
171 | [["level2_v1.2.3", "1.2.3"], ["foo", None]], |
|
172 | ) |
|
173 | def test_level2_round_trip_txt(tmpdir, dirname, version): |
|
174 | from sciapy.level2.density import scia_densities |
|
175 | odir = os.path.join(tmpdir, dirname) |
|
176 | if not os.path.exists(odir): |
|
177 | os.makedirs(odir) |
|
178 | obase = os.path.join(odir, os.path.basename(IFILE)) |
|
179 | oftxt = obase + ".txt" |
|
180 | l2_o = scia_densities(data_ver=version) |
|
181 | l2_o.read_from_file(IFILE) |
|
182 | l2_o.write_to_textfile(oftxt) |
|
183 | l2_t = scia_densities() |
|
184 | l2_t.read_from_textfile(oftxt) |
|
185 | _assert_class_equal(l2_o, l2_t) |
|
186 | ||
187 | ||
188 | @pytest.mark.parametrize( |
|
@@ 150-166 (lines=17) @@ | ||
147 | assert np.all(_l == _r), (_k, _l, _r) |
|
148 | ||
149 | ||
150 | @pytest.mark.parametrize( |
|
151 | "dirname, version", |
|
152 | [["level2_v1.2.3", "1.2.3"], ["foo", None]], |
|
153 | ) |
|
154 | def test_level2_round_trip_nc(tmpdir, dirname, version): |
|
155 | from sciapy.level2.density import scia_densities |
|
156 | odir = os.path.join(tmpdir, dirname) |
|
157 | if not os.path.exists(odir): |
|
158 | os.makedirs(odir) |
|
159 | obase = os.path.join(odir, os.path.basename(IFILE)) |
|
160 | ofnc = obase + ".nc" |
|
161 | l2_o = scia_densities(data_ver=version) |
|
162 | l2_o.read_from_file(IFILE) |
|
163 | l2_o.write_to_netcdf(ofnc) |
|
164 | l2_t = scia_densities() |
|
165 | l2_t.read_from_netcdf(ofnc) |
|
166 | _assert_class_equal(l2_o, l2_t) |
|
167 | ||
168 | ||
169 | @pytest.mark.parametrize( |