Casys Report
Report
,
ReportChapter
and ReportSection
classes specifically designed to ease the configuration of a report using these tools.NadirData
,
SwathData
, CasysPlot
,
TextParams
, …)
and each method of these objects has been associated with a configuration
representation allowing to write configuration files for these elements.Casys report configuration
The global report structure:
ReportCasys
3 types of
ReportSection
ReportAltiData
: used in the data part of theReportCasys
ReportSectionPlot
used for chapter’s section defining aCasysPlot
ReportSectionGrid
used for chapter’s section defining a grid of plots.
Report
ReportCasys
is a specialization of
the Report
class allowing the representation
of a Casys Toolbox report.
chapters are regular
ReportChapter
data sections are
NadirData
objectschapter’s section are
ReportSectionPlot
objects
ReportSectionGrid
objects
Class representing a Casys report.
Parameters
----------
ges_table_dir
GES_TABLE_DIR environment variable
metadata
Report metadata (used in PDF exports).
data
Dictionary of AltiData representations.
chapters
Dictionary of chapters.
A chapter has a list of sections as a section's parameter, each section
containing a plot or a grid of plots.
misc
Dictionary of miscellaneous data.
level
Report's level.
If the report level is 100 (default), only chapters and sections with a level
less or equal to 100 will be included.
ges_table_dir: <ges_table_dir>
metadata: <ReportMetadata_representation>
data:
<alti_data1>:
<AltiData_representation>
<alti_data2>:
<AltiData__representation>
...
chapters:
<chapter1>:
<ReportChapter_representation>
<chapter2>:
<ReportChapter_representation>
...
misc:
<dictionary>
level: <report_level>
Report’s metadata
Casys Toolbox metadata are regular metadata.
Report’s data
ReportSection
containing
NadirData
objects.Note
operations
parameter describing
operations to apply.
raw:
add_raw_data()
temporal:
add_time_stat()
histogram:
add_histogram()
scatter:
add_scatter()
binned:
add_binned_stat()
binned_2d:
add_binned_stat_2d()
geobox:
add_geobox_stat()
ratio:
add_ratio()
crossover:
add_crossover_stat()
missing_points:
add_missing_points_stat()
section_analysis:
add_section_analysis()
editing:
add_editing()
compute:
compute()
store:
store()
clear:
clear()
operations:
g1:
- type: TEMPORAL
name: swh_day_ts
field:
name: swh
source: IIF(FLAG_VAL.ALTI==0, SWH.ALTI, DV)
unit: m
freq: day
stats: ['mean']
- type: compute
- type: store
name: report_1.back
overwrite: True
- type: TEMPORAL
name: swh_pass_ts
field:
name: swh
source: IIF(FLAG_VAL.ALTI==0, SWH.ALTI, DV)
unit: m
freq: pass
stats: ['mean']
- type: compute
- type: store
name: report_2.back
overwrite: True
operations:
time_stat:
- name: swh_day_ts
field:
name: swh
source: IIF(FLAG_VAL.ALTI==0, SWH.ALTI, DV)
unit: m
freq: day
stats: ['mean']
- name: swh_pass_ts
field:
name: swh
source: IIF(FLAG_VAL.ALTI==0, SWH.ALTI, DV)
unit: m
freq: pass
stats: ['mean']
compute:
- type: compute
data:
data1:
date_start: 2019-07-22
date_end: 2019-07-31
source: TABLE_C_J3_B_GDRD
orf: C_J3_GDRD
longitude: LONGITUDE
latitude: LATITUDE
time: time
operations:
all:
- type: time_stat
name: swh_day_ts
field:
name: swh
source: IIF(FLAG_VAL.ALTI==0, SWH.ALTI, DV)
unit: m
freq: day
stats: ['mean']
- type: time_stat
name: swh_pass_ts
field:
name: swh
source: IIF(FLAG_VAL.ALTI==0, SWH.ALTI, DV)
unit: m
freq: pass
stats: ['mean']
- type: compute
...
Report’s chapter
Casys Toolbox chapters are regular chapters.
Report’s section
sections containing
CasysPlot
sections containing a grid of
CasysPlot
(as parameters of thecreate_image_grid()
function)
Note
operations
parameter describing
operations to apply.
set_ticks:
set_ticks()
add_color_bar:
add_color_bar()
add_stat_bar:
add_stat_bar()
add_stat_graph:
add_stat_graph()
add_hist_bar:
add_hist_bar()
add_event:
add_event()
add_plot:
add_plot()
add_ticks_space:
add_ticks_space()
show:
show()
showi:
showi()
save_figure:
save_figure()
store:
store()
Plot’s section
ReportSectionPlot
sections contain a
CasysPlot
.plot
keyword can be used instead of content
to indicate it’s a content of
type plot
.Representation of a section containing a plot.
Parameters
----------
title
Section's title.
text
Section's text.
content
plot's representation.
Should map CasysPlot parameters
misc
Miscellaneous section's data.
reference
A reference to this section.
sections
List of subsections.
level
Section's level.
Only sections with a level less or equal to the report's level will be included.
title: <section_title>
text: <section_text>
plot: <CasysPlot_representation>
misc:
<dictionary>
reference: <section_reference>
sections:
- <ReportSection_representation>
- <ReportSection_representation>
...
level: <section_level>
Grid’s section
ReportSectionGrid
sections contain a
grid of CasysPlot
.grid
keyword can be used instead of content
to indicate it’s a content of
type grid
.Representation of a report section containing a grid of plots.
Parameters
----------
title
Section's title.
text
Section's text.
content
Grid's representation.
Should map the create_image_grid parameters
misc
Miscellaneous section's data.
reference
A reference to this section.
sections
List of subsections.
level
Section's level.
Only sections with a level less or equal to the report's level will be included.
title: <section_title>
text: <section_text>
grid: <CasysPlot.create_image_grid_representation>
misc:
<dictionary>
sections:
- <ReportSection_representation>
- <ReportSection_representation>
...
level: <section_level>
Complete Example
Report’s configuration
ges_table_dir: /data/cvl_exj3/TABLES/DSC
data:
data1:
date_start: 2019-07-22
date_end: 2019-07-31
source: TABLE_C_J3_B_GDRD
orf: C_J3_GDRD
longitude: LONGITUDE
latitude: LATITUDE
time: time
operations:
all:
- type: time_stat
name: swh_day_ts
field:
name: swh
source: IIF(FLAG_VAL.ALTI==0, SWH.ALTI, DV)
unit: m
freq: day
stats: ['mean']
- type: time_stat
name: swh_pass_ts
field:
name: swh
source: IIF(FLAG_VAL.ALTI==0, SWH.ALTI, DV)
unit: m
freq: pass
stats: ['mean']
- type: compute
chapters:
swh_monitoring:
title: Sea waves height Monitoring
sections:
- title: Daily statistics of mean SWH
plot:
data: data1
data_name: swh_day_ts
stat: mean
text_params:
title: Day Mean SWH
plot_params:
grid: True
operations:
- type: show
- title: Pass statistics of mean SWH
plot:
data: data1
data_name: swh_pass_ts
stat: mean
text_params:
title: Pass Mean SWH
plot_params:
grid: True
operations:
- type: show
- title: Another section title
text: Text of the other section
another_chapter:
title: Another chapter title
text: Text of the other chapter
With a generic template like this one.
from casys.report import ReportCasys
from octantng.data.report import ReportManager
from octantng.parameters.configuration import Config
conf = Config.from_file("casys_report_conf.yaml")
r = ReportCasys.load(conf)
rm = ReportManager(template="generic_template.ipynb", report=r)
Expanding template
rm.expand_template()
rm.store_notebook(path="casys_notebook_expanded.ipynb")
Will generate the following expanded notebook.
Executing expanded notebook
rm.execute_notebook()
rm.store_notebook_executed(path="casys_notebook_executed.ipynb")
Will generate the following executed notebook.