2424from wqf .val .metrics import MAPD
2525from wqf .val .metrics import R2
2626from wqf .val .metrics import RMSE
27+ from wqf .val .metrics import RMSLE
2728from wqf .val .metrics import WRMSSE
2829from wqf .val .plots import DensityPlot
2930from wqf .val .plots import HistogramPlot
@@ -82,13 +83,37 @@ def plot_count_scene(
8283 data ,
8384 title = title ,
8485 fn = fn ,
85- cbar_label = "number of forecasts " ,
86+ cbar_label = "number of observations " ,
8687 vmin = 0.0 ,
8788 vmax = 250.0 ,
8889 xlocs = (1.0 , 2.5 , 4.0 , 5.5 , 7.0 , 8.5 , 10.0 ),
8990 )
9091
9192
93+ def plot_count_time_series (
94+ data : DataArray ,
95+ title : str | None = None ,
96+ fn : str | None = None ,
97+ xlim : tuple [int , int ] | None = None ,
98+ ylim : tuple [Any , Any ] = (0.0 , 150 ),
99+ ) -> Figure :
100+ return TimeSeriesPlot ().plot (
101+ data ,
102+ ylabel = r"number of observations ($10^3$)" ,
103+ xlim = (
104+ (
105+ np .datetime64 (f"{ xlim [0 ]} -01-01" ),
106+ np .datetime64 (f"{ xlim [1 ]} -01-01" ),
107+ )
108+ if xlim is not None
109+ else None
110+ ),
111+ ylim = ylim ,
112+ title = title ,
113+ fn = fn ,
114+ )
115+
116+
92117def plot_determination_coefficient_scene (
93118 data : DataArray , title : str | None = None , fn : str | None = None
94119) -> Figure :
@@ -241,6 +266,44 @@ def plot_rmse_time_series(
241266 )
242267
243268
269+ def plot_rmsle_scene (
270+ data : DataArray , title : str | None = None , fn : str | None = None
271+ ) -> Figure :
272+ return ScenePlot ().plot (
273+ data ,
274+ title = title ,
275+ fn = fn ,
276+ cbar_label = "RMSLE" ,
277+ vmin = 0.0 ,
278+ vmax = 1.0 ,
279+ xlocs = (1.0 , 2.5 , 4.0 , 5.5 , 7.0 , 8.5 , 10.0 ),
280+ )
281+
282+
283+ def plot_rmsle_time_series (
284+ data : DataArray ,
285+ title : str | None = None ,
286+ fn : str | None = None ,
287+ xlim : tuple [int , int ] | None = None ,
288+ ylim : tuple [Any , Any ] = (0.0 , 1.0 ),
289+ ) -> Figure :
290+ return TimeSeriesPlot ().plot (
291+ data ,
292+ ylabel = "RMSLE" ,
293+ xlim = (
294+ (
295+ np .datetime64 (f"{ xlim [0 ]} -01-01" ),
296+ np .datetime64 (f"{ xlim [1 ]} -01-01" ),
297+ )
298+ if xlim is not None
299+ else None
300+ ),
301+ ylim = ylim ,
302+ title = title ,
303+ fn = fn ,
304+ )
305+
306+
244307def plot_wrmsse_scene (
245308 data : DataArray , title : str | None = None , fn : str | None = None
246309) -> Figure :
@@ -286,7 +349,7 @@ def plot_value_density(
286349) -> Figure :
287350 return DensityPlot ().plot (
288351 data ,
289- xlabel = r"reference chlorophyll concentration (mg m$^{-3}$)" ,
352+ xlabel = r"observed chlorophyll concentration (mg m$^{-3}$)" ,
290353 ylabel = r"forecast (mg m$^{-3}$)" ,
291354 title = title ,
292355 fn = fn ,
@@ -304,7 +367,7 @@ def plot_value_scatter(
304367) -> Figure :
305368 return ScatterPlot ().plot (
306369 data ,
307- xlabel = r"reference chlorophyll concentration (mg m$^{-3}$)" ,
370+ xlabel = r"observed chlorophyll concentration (mg m$^{-3}$)" ,
308371 ylabel = r"forecast (mg m$^{-3}$)" ,
309372 xlim = (- 0.50 , 30.5 ),
310373 ylim = (- 0.50 , 30.5 ),
@@ -320,7 +383,7 @@ def plot_error_density(
320383) -> Figure :
321384 return DensityPlot ().plot (
322385 data ,
323- xlabel = r"reference chlorophyll concentration (mg m$^{-3}$)" ,
386+ xlabel = r"observed chlorophyll concentration (mg m$^{-3}$)" ,
324387 ylabel = r"forecast error (mg m$^{-3}$)" ,
325388 title = title ,
326389 fn = fn ,
@@ -338,7 +401,7 @@ def plot_error_scatter(
338401) -> Figure :
339402 return ScatterPlot ().plot (
340403 data ,
341- xlabel = r"reference chlorophyll concentration (mg m$^{-3}$)" ,
404+ xlabel = r"observed chlorophyll concentration (mg m$^{-3}$)" ,
342405 ylabel = r"forecast error (mg m$^{-3}$)" ,
343406 xlim = (- 0.50 , 30.5 ),
344407 ylim = (- 15.5 , 15.5 ),
@@ -372,7 +435,7 @@ def plot_relative_error_density(
372435) -> Figure :
373436 return DensityPlot ().plot (
374437 data ,
375- xlabel = r"reference chlorophyll concentration (mg m$^{-3}$)" ,
438+ xlabel = r"observed chlorophyll concentration (mg m$^{-3}$)" ,
376439 ylabel = "forecast relative error" ,
377440 title = title ,
378441 fn = fn ,
@@ -390,7 +453,7 @@ def plot_relative_error_scatter(
390453) -> Figure :
391454 return ScatterPlot ().plot (
392455 data ,
393- xlabel = "reference chlorophyll concentration (mg m$^{-3}$)" ,
456+ xlabel = "observed chlorophyll concentration (mg m$^{-3}$)" ,
394457 ylabel = "forecast relative error" ,
395458 xlim = (- 0.50 , 30.5 ),
396459 ylim = (- 1.55 , 1.55 ),
@@ -446,6 +509,13 @@ def generate_figures(args, period: tuple[int, int]):
446509 "rer_mockup_hist" ,
447510 ).clear ()
448511
512+ # noinspection PyTypeChecker
513+ plot_count_time_series (
514+ Count ().series (ref , pre ) / 1000.0 ,
515+ "Mockup chlorophyll forecast" ,
516+ "count_mockup_series" ,
517+ xlim = period ,
518+ ).clear ()
449519 plot_count_scene (
450520 Count ().image (ref , pre ),
451521 "Mockup chlorophyll forecast" ,
@@ -500,14 +570,26 @@ def generate_figures(args, period: tuple[int, int]):
500570 "rmse_mockup_image" ,
501571 ).clear ()
502572
573+ plot_rmsle_time_series (
574+ RMSLE ().series (ref , pre ),
575+ "Mockup chlorophyll forecast" ,
576+ "rmsle_mockup_series" ,
577+ xlim = period ,
578+ ).clear ()
579+ plot_rmsle_scene (
580+ RMSLE ().image (ref , pre ),
581+ "Mockup chlorophyll forecast" ,
582+ "rmsle_mockup_image" ,
583+ ).clear ()
584+
503585 plot_wrmsse_time_series (
504- WRMSSE ().series (ref , pre , condition = ref > 1.0 ),
586+ WRMSSE ().series (ref , pre ),
505587 "Mockup chlorophyll forecast" ,
506588 "wrmsse_mockup_series" ,
507589 xlim = period ,
508590 ).clear ()
509591 plot_wrmsse_scene (
510- WRMSSE ().image (ref , pre , condition = ref > 1.0 ),
592+ WRMSSE ().image (ref , pre ),
511593 "Mockup chlorophyll forecast" ,
512594 "wrmsse_mockup_image" ,
513595 ).clear ()
0 commit comments