@@ -25,6 +25,12 @@ def dfs2_random_2items():
25
25
return mikeio .open (filepath )
26
26
27
27
28
+ @pytest .fixture
29
+ def dfs2_pt_spectrum_geographical ():
30
+ filepath = Path ("tests/testdata/spectra/pt_spectra_geographical.dfs2" )
31
+ return mikeio .open (filepath , type = "spectral" )
32
+
33
+
28
34
@pytest .fixture
29
35
def dfs2_pt_spectrum ():
30
36
filepath = Path ("tests/testdata/spectra/pt_spectra.dfs2" )
@@ -312,6 +318,31 @@ def test_properties_pt_spectrum(dfs2_pt_spectrum):
312
318
assert g .orientation == 0
313
319
314
320
321
+ def test_properties_pt_spectrum_geographical (dfs2_pt_spectrum_geographical ):
322
+ dfs = dfs2_pt_spectrum_geographical
323
+ assert dfs .x0 == pytest .approx (0.055 )
324
+ assert dfs .y0 == 0
325
+ assert dfs .dx == pytest .approx (1.1 )
326
+ assert dfs .dy == 22.5
327
+ assert dfs .nx == 25
328
+ assert dfs .ny == 16
329
+ assert dfs .longitude == pytest .approx (0 , abs = 1e-6 )
330
+ assert dfs .latitude == 0
331
+ assert dfs .orientation == 0
332
+ assert dfs .n_items == 1
333
+ assert dfs .n_timesteps == 31
334
+
335
+ g = dfs .geometry
336
+ assert g .is_spectral
337
+ assert g .x [0 ] == pytest .approx (0.055 )
338
+ # assert g.x[-1] > 25 # if considered linear
339
+ assert g .x [- 1 ] < 0.6 # logarithmic
340
+ assert g .y [0 ] == 0
341
+ assert g .dx == pytest .approx (1.1 )
342
+ assert g .dy == 22.5
343
+ assert g .orientation == 0
344
+
345
+
315
346
def test_properties_pt_spectrum_linearf (dfs2_pt_spectrum_linearf ):
316
347
dfs = dfs2_pt_spectrum_linearf
317
348
# This file doesn't have a valid projection string
0 commit comments