GoMSS Nowcast System Workers¶
Process Flow¶
The system workflow looks like:

Work flow of preparation for and execution of the daily runs.¶
The green boxes in the figure above are workers,
Python processes that are launched by the system to do a particular job and terminate when that job is finished.
The workers are defined in Python modules in the nowcast.workers
and nemo_nowcast.workers
namespaces.
The Scheduler is a long-running process that periodically checks the system clock and launches workers when their scheduled time to run is reached.
Please see NEMO Nowcast Framework Architecture for a description of the system architecture.
Workers¶
download_weather¶
GoMSS NEMO nowcast weather model products download worker.
Download the netCDF files from the Environment Canada GEM 2.5km HRDPS research model forecast produced by Luc Fillion’s group for a specified date; (defaults to today).
download_psy4¶
GoMSS NEMO nowcast worker to download Mercator Ocean PSY4 model fields.
A slice of the Mercator Ocean PSY4V1R2 daily average model product fields are downloaded for use in the preparation of boundary condition files containing u & v currents, sea surface height, salinity, and temperature.
make_weather_forcing¶
GoMSS NEMO nowcast worker to assemble a weather forcing file from a collection of HRDPS forecast files.
Concatenate the contents of the gzipped hourly netCDF files from the Environment Canada GEM 2.5km HRDPS research model forecast for a specified date; (defaults to today) to create a weather forcing file for NEMO.
The concatenated file is a netCDF-4/HDF5 format file with LZ-deflated variables to reduce its size. The number of hours in the forcing file is the same as the number of hours in the forecast (see the weather:download:forecast hrs value in the system configuration file).
The final hour of the previous day’s forecast is used as the 0th hour of weather forcing to avoid restart artifacts from the HRDPS product.
The precipitation is transformed from the cumulative metres of equivalent water to flux in kg/m^2/s. The 0th hour flux is calculated from the final 2 hours accummulation inthe previous day’s forecast.
Solid phase precipitation flux is calculated by assuming that precipitation at grid points where the value of the 2m air temperature (tair) is less than 273.15 Kelvin is snow. The calculated snow file is merged into the dataset created from the HRDPS forecast files to produce the NEMO forcing file.
make_boundary_conditions¶
GoMSS NEMO nowcast worker to run Matlab scripts that generate daily boundary conditions files from downloaded Mercator Ocean PSY4 model fields.
run_nemo¶
GoMSS NEMO nowcast worker that prepares the YAML run description file and bash run script for a nowcast, and launches the run.
watch_nemo¶
GoMSS NEMO nowcast worker that monitors and reports on the progress of a NEMO run.
make_plots¶
GoMSS NEMO nowcast worker that produces model results visualization images for the web site from run results.
clear_checklist¶
NEMO_Nowcast framework clear_checklist worker.
Send a message to the nowcast system manager requesting that it clear its system state checklist.
This worker is normally launched in automation at the end of a nowcast
processing cycle (e.g. end of the day), just prior to launching the
nemo_nowcast.workers.rotate_logs
worker.
It can also be launched from the command-line by the nowcast administrator as necessary for system maintenance.
rotate_logs¶
NEMO_Nowcast framework rotate_logs worker.
Iterate through the nowcast system logging handlers, calling the
doRollover()
method on any that are instances of
logging.handlers.RotatingFileHandler
.
This worker is normally launched in automation at the end of a nowcast processing cycle (e.g. end of the day).
It can also be launched from the command-line by the nowcast administrator as necessary for system maintenance.
next_workers Module¶
Functions to calculate lists of workers to launch after previous workers end their work.
Function names must be of the form after_worker_name()
.
-
nowcast.next_workers.
after_clear_checklist
(msg, config, checklist)[source]¶ Calculate the list of workers to launch after the clear_checklist worker ends.
- Parameters
msg (
nemo_nowcast.message.Message
) – Nowcast system message.- Returns
Worker(s) to launch next
- Return type
-
nowcast.next_workers.
after_download_psy4
(msg, config, checklist)[source]¶ Calculate the list of workers to launch after the download_psy4 worker ends.
- Parameters
msg (
nemo_nowcast.message.Message
) – Nowcast system message.- Returns
Worker(s) to launch next
- Return type
-
nowcast.next_workers.
after_download_weather
(msg, config, checklist)[source]¶ Calculate the list of workers to launch after the download_weather worker ends.
- Parameters
msg (
nemo_nowcast.message.Message
) – Nowcast system message.- Returns
Worker(s) to launch next
- Return type
-
nowcast.next_workers.
after_make_boundary_conditions
(msg, config, checklist)[source]¶ Calculate the list of workers to launch after the make_boundary_conditions worker ends.
- Parameters
msg (
nemo_nowcast.message.Message
) – Nowcast system message.- Returns
Worker(s) to launch next
- Return type
-
nowcast.next_workers.
after_make_plots
(msg, config, checklist)[source]¶ Calculate the list of workers to launch after the make_plots worker ends.
- Parameters
msg (
nemo_nowcast.message.Message
) – Nowcast system message.- Returns
Worker(s) to launch next
- Return type
-
nowcast.next_workers.
after_make_weather_forcing
(msg, config, checklist)[source]¶ Calculate the list of workers to launch after the make_weather_forcing worker ends.
- Parameters
msg (
nemo_nowcast.message.Message
) – Nowcast system message.- Returns
Worker(s) to launch next
- Return type
-
nowcast.next_workers.
after_rotate_logs
(msg, config, checklist)[source]¶ Calculate the list of workers to launch after the rotate_logs worker ends.
- Parameters
msg (
nemo_nowcast.message.Message
) – Nowcast system message.- Returns
Worker(s) to launch next
- Return type
-
nowcast.next_workers.
after_run_nemo
(msg, config, checklist)[source]¶ Calculate the list of workers to launch after the run_nemo worker ends.
- Parameters
msg (
nemo_nowcast.message.Message
) – Nowcast system message.- Returns
Worker(s) to launch next
- Return type
-
nowcast.next_workers.
after_watch_nemo
(msg, config, checklist)[source]¶ Calculate the list of workers to launch after the watch_nemo worker ends.
- Parameters
msg (
nemo_nowcast.message.Message
) – Nowcast system message.- Returns
Worker(s) to launch next
- Return type
Results Figures Modules¶
The modules in the nowcast.figures
namespace are used by the nowcast.workers.make_plots
worker to produce the figures that are published to the web from each run.
The figures are stored in the /data1/dlatornell/nowcast-sys/figures/
directory tree.
nowcast.figures.website_theme
Module¶
Colour, fonts, and utility functions that define the look and style of figures for the https://gomss.ocean.dal.ca/ web pages.
-
nowcast.figures.website_theme.
COLOURS
= {'axes': {'facecolor': '#dbdee1'}, 'axis': {'labels': 'black', 'spines': 'black', 'ticks': 'black'}, 'cbar': {'label': 'black', 'tick labels': 'black'}, 'coastline': 'black', 'contour lines': {'1000m isobath': 'white'}, 'figure': {'facecolor': 'white'}, 'land': '#8b7765', 'text': {'axis': 'black', 'figure title': 'black'}}¶ Colours of various figure elements; the dict key(s) should be descriptive enough to identify the element to which the colour applies.
-
nowcast.figures.website_theme.
FONTS
= {'axis': matplotlib.font_manager.FontProperties, 'axis small': matplotlib.font_manager.FontProperties, 'cbar': {'label': matplotlib.font_manager.FontProperties, 'tick labels': matplotlib.font_manager.FontProperties}, 'figure title': matplotlib.font_manager.FontProperties}¶ Font properties of various figure text elements; the top level dict keys should be descriptive enough to identify the element to which the font properties apply.
-
nowcast.figures.website_theme.
SITE_BACKGROUND_COLOUR
= 'white'¶ The salishsea.eos.ubc.ca/nemo/ pages background colour, from the https://bootswatch.com/superhero/ theme.
-
nowcast.figures.website_theme.
set_axis_colors
(ax)[source]¶ Set the colours of axis labels, ticks, and spines.
- Parameters
ax (
matplotlib.axes.Axes
) – Axes object to be formatted.
nowcast.figures
Figure Modules¶
nowcast.figures.day_avg_tracer
Module¶
Produce a figure that shows surface values of a tracer field for the full GoMSS model domain. The values are day averages. They are displayed as filled colour contours. The axes grid and tick labels are an angled lon/lat grid using a Lambert Conformal Conic map projection.
Testing notebook for this module is https://nbviewer.jupyter.org/urls/bitbucket.org/gomss-nowcast/gomss_nowcast/raw/default/notebooks/figures/TestDayAvgTracer.ipynb
Development notebook for this module is https://nbviewer.jupyter.org/urls/bitbucket.org/gomss-nowcast/gomss_nowcast/raw/default/notebooks/figures/DevelopDayAvgTracer.ipynb
-
nowcast.figures.day_avg_tracer.
make_figure
(results_archive, run_date, var, cmap, bathy, figsize=(16, 9), theme=<module 'nowcast.figures.website_theme' from '/home/docs/checkouts/readthedocs.org/user_builds/gomss-nowcast-system/checkouts/latest/nowcast/figures/website_theme.py'>)[source]¶ Plot colour contours of day averaged tracer variable surface values for the full GoMSS model domain on an angled lon/lat grid using a Lambert Conformal Conic map projection.
- Parameters
results_archive (
pathlib.Path
) – Path of directory tree in which NEMO model results are stored.run_date (
arrow.Arrow
) – Run date to produce the figure for.var (str) – Name of NEMO results variable to display in figure.
cmap (
matplotlib.colors.ListedColormap
) – Colour map to use for filled contours in figure.bathy (
xarray.Dataset
) – GoMSS NEMO model bathymetry.figsize (2-tuple) – Figure size (width, height) in inches.
theme – Module-like object that defines the style elements for the figure. See
nowcast.figures.website_theme
for an example.
- Returns