Skip to content

Commit 4148e60

Browse files
committed
2d network image tests
1 parent af85a3d commit 4148e60

5 files changed

Lines changed: 33 additions & 1 deletion

File tree

tests/test_base_plot.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from pyxlma.plot.xlma_base_plot import *
44
from pyxlma.plot.xlma_plot_feature import *
55
from pyxlma.lmalib.grid import *
6+
from pyxlma.lmalib.io import read as lma_read
67
import datetime as dt
78
import pandas as pd
89
import matplotlib.dates as md
@@ -135,4 +136,33 @@ def test_plot_feature_inset_view():
135136
c=colors, edgecolors='k', linewidths=0.1, add_to_histogram=True)
136137
inset_view(bk_plot, dataset.event_longitude.data, dataset.event_latitude.data,
137138
[-102.75, -102.25], [32, 32.5], .01, .01)
138-
return bk_plot.fig
139+
return bk_plot.fig
140+
141+
142+
@pytest.mark.mpl_image_compare
143+
def test_plot_feature_ndln_time():
144+
start_time = dt.datetime(2023, 12, 24, 0, 57, 0, 0)
145+
end_time = start_time + dt.timedelta(seconds=60)
146+
bk_plot = BlankPlot(start_time, bkgmap=True, xlim=[-103.5, -99.5], ylim=[31.5, 35.5], zlim=[0, 20], tlim=[start_time, end_time], title='XLMA Test Plot')
147+
nldn_data = lma_read.nldn('examples/network_samples/gld360enldnns_20231224_daily_v1_lit.raw')
148+
plot_2d_network_points(bk_plot, nldn_data)
149+
return bk_plot.fig
150+
151+
152+
@pytest.mark.mpl_image_compare
153+
def test_plot_feature_entln_real_height():
154+
start_time = dt.datetime(2023, 12, 24, 0, 57, 0, 0)
155+
end_time = start_time + dt.timedelta(seconds=60)
156+
bk_plot = BlankPlot(start_time, bkgmap=True, xlim=[-103.5, -99.5], ylim=[31.5, 35.5], zlim=[0, 20], tlim=[start_time, end_time], title='XLMA Test Plot')
157+
entln_data = lma_read.entln('examples/network_samples/lxarchive_pulse20231224.csv')
158+
plot_2d_network_points(bk_plot, entln_data, actual_height=entln_data['icheight'])
159+
return bk_plot.fig
160+
161+
@pytest.mark.mpl_image_compare
162+
def test_plot_feature_ndln_polarity():
163+
start_time = dt.datetime(2023, 12, 24, 0, 57, 0, 0)
164+
end_time = start_time + dt.timedelta(seconds=60)
165+
bk_plot = BlankPlot(start_time, bkgmap=True, xlim=[-103.5, -99.5], ylim=[31.5, 35.5], zlim=[0, 20], tlim=[start_time, end_time], title='XLMA Test Plot')
166+
nldn_data = lma_read.nldn('examples/network_samples/gld360enldnns_20231224_daily_v1_lit.raw')
167+
plot_2d_network_points(bk_plot, nldn_data, color_by='polarity')
168+
return bk_plot.fig

tests/test_io.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def test_read_onefile_dataset():
2525
for var in truth.data_vars:
2626
compare_dataarrays(dataset, truth, var)
2727

28+
2829
def test_read_nldn():
2930
dataset = lma_read.nldn('examples/network_samples/gld360enldnns_20231224_daily_v1_lit.raw')
3031
truth = pd.DataFrame({
@@ -43,6 +44,7 @@ def test_read_nldn():
4344
})
4445
assert dataset.equals(truth)
4546

47+
4648
def test_read_entln():
4749
dataset = lma_read.entln('examples/network_samples/lxarchive_pulse20231224.csv')
4850
truth = pd.DataFrame({
75.6 KB
Loading
76.2 KB
Loading
76.4 KB
Loading

0 commit comments

Comments
 (0)