Figure Modules Organization

Web site figures are generated by code modules stored in the nowcast/figures/ directory tree. There are 5 sub-directories in that tree:

  • fvcom/

  • comparison/

  • publish/

  • research/

The fvcom/ directory contains modules for figures that show results from the VHFR FVCOM model.

The comparison/ directory contains modules for figures that compare model results to observations; for example temperature and salinity comparisons at the deep ONC nodes, and comparison of surface quantities to data from the ONC ferry instrument packages.

The publish/ directory contains modules for figures that are considered to be “official” SalishSeaCast model product - results we have evaluated and believe to be of the best quality and accuracy.

The research/ directory contains modules for figures that we’re interested in looking at on a daily basis to gain insight into the model’s performance.

The wwatch3/ directory contains modules for figures that show results from the Strait of Georgia WaveWatchIII™ model.

The research/ directory is generally where new figure modules for NEMO results should be put.

In Python terms, those directories are namespaces from which figure modules can be imported:

  • nowcast.figures.fvcom

  • nowcast.figures.comparison

  • nowcast.figures.publish

  • nowcast.figures.research

  • nowcast.figures.wwatch3

Within each of those namespaces the figure-producing functions are organized into a module for each figure. So, for example, the nowcast.figures.research.tracer_thalweg_and_surface module contains the code to produce a figure showing colour contours of a tracer on a vertical slice along a section of the domain thalweg, and on the surface for a section of the domain that excludes Puget Sound in the south and Johnstone Strait in the north.

The code in the figure modules is just the code that is specific to creating that one figure. Generic functions that are useful in the creation of more than one figure are collected in the nowcast.figures.shared module. Figure modules also often import modules from the SalishSeaTools Package. For example, salishsea_tools.viz_tools.set_aspect() is used to set the aspect ratio of a figure axes object appropriately for the SalishSeaCast NEMO model grid.

The Creating a Figure Module docs contain a detailed element-by-element discussion of how to create and structure a web site figure module. They use the nowcast.figures.research.tracer_thalweg_and_surface module as an example.

The DevelopTracerThalwegAndSurfaceModule notebook in notebooks/figures/research/ is an example of developing figure module functions in a Jupyter notebook. You can take that approach if you wish, or you can develop directly in a module.

Of course, the ultimate goal is to produce a module. Once you’ve got a code module, you should create a notebook that tests it in the nowcast system context. The TestTracerThalwegAndSurfaceModule notebook in notebooks/figures/research/ is an example for the nowcast.figures.research.tracer_thalweg_and_surface module.