Salish Sea Nowcast System Workers

Process Flow

_images/ProcessFlow.png

Work flow of preparation for and execution of the daily runs.

The green, pink, and blue boxes in the figure above are the workers described below.

The other workers are launched and coordinated by the Manager, another long-running process that keeps track of the state of the nowcast system. The workers and manager communicate by using the Messaging System to pass messages back and forth.

The messages are mediated by the Message Broker, a third long-running process that queues messages in both directions between the manager and the workers. That queuing improves the robustness of the system.

Please see NEMO Nowcast Framework Architecture for a more detailed description of the system architecture.

The process flow in the diagram above is somewhat idealized. For example:

  • The collect_weather worker is launched four times daily, to get the hour 00, 06, 12, and 18 UTC forecast products.

  • The make_runoff_file worker is only launched after the 06 forecast download finishes because the river runoff forcing is based on daily average discharge values and climatology.

  • The grib_to_netcdf worker is only launched after the 06 and 12 forecast downloads finish to prepare the atmospheric forcing files that will be used by the preliminary forecast run, and the nowcast and updated forecast runs. However, grib_to_netcdf uses results from several preceding forecast products downloads to do its job.

  • Etc.

To fully understand the flow and interactions of workers, please read the code in the nowcast.next_workers module.

Workers

collect_weather

SalishSeaCast worker that monitors a mirror of HRDPS files from the ECCC MSC datamart model_hrdps.west.grib2 service, and moves the expected files into our atmospheric forcing directory tree.

nowcast.workers.collect_weather.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.collect_weather --help

download_weather

SalishSeaCast worker that downloads the GRIB2 files from the 00, 06, 12, or 18 Environment and Climate Change Canada GEM 2.5km HRDPS operational model forecast.

nowcast.workers.download_weather.main()[source]

For command-line usage see:

python -m nowcast.workers.download_weather --help

crop_gribs

SalishSeaCast worker that loads ECCC MSC 2.5 km rotated lat-lon continental grid HRDPS GRIB2 files, crops them to the subdomain needed for SalishSeaCast NEMO forcing, and writes them to new GRIB2 files.

nowcast.workers.crop_gribs.main()[source]

For command-line usage see:

python -m nowcast.workers.crop_gribs --help

grib_to_netcdf

SalishSeaCast worker that generates weather forcing file from GRIB2 forecast files.

Collect weather forecast results from hourly GRIB2 files and produce day-long NEMO atmospheric forcing netCDF files.

nowcast.workers.grib_to_netcdf.main()[source]

For command-line usage see:

python -m nowcast.workers.grib_to_netcdf --help

collect_river_data

SalishSeaCast worker that collects river discharge observation data from an ECCC datamart CSV file mirror, or the USGS Water Service REST service, and appends a day-average discharge to a SOG-format forcing file.

nowcast.workers.collect_river_data.main()[source]

For command-line usage see:

python -m nowcast.workers.collect_river_data --help

make_runoff_file

SalishSeaCast runoff file generation worker.

Blend Environment Canada gauge data for the Fraser River at Hope with climatology for the Fraser downstream of Hope, and climatologies for all of the other modeled rivers to generate the runoff forcing file.

nowcast.workers.make_runoff_file.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.make_runoff_file --help

make_v202111_runoff_file

SalishSeaCast worker that calculates NEMO runoff forcing file from day-averaged river discharge observations (lagged by 1 day) from representative gauged rivers in all watersheds and fits developed by Susan Allen. Missing river discharge observations are handled by a scheme of persistence or scaling of a nearby gauged river, depending on time span of missing observations.

nowcast.workers.make_v202111_runoff_file.main()[source]

For command-line usage see:

python -m nowcast.workers.make_v202111_runoff_file --help

collect_NeahBay_ssh

SalishSeaCast worker that collects a file containing sea surface height observations and forecast values at Neah Bay from an HTTPS server and stores them locally for subsequent processing by another worker to produce a sea surface height boundary condition file.

nowcast.workers.collect_NeahBay_ssh.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.collect_NeahBay_ssh --help

make_ssh_files

SalishSeaCast worker that generates a sea surface height boundary conditions file from NOAA Neah Bay observation and forecast values.

nowcast.workers.make_ssh_files.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.make_ssh_file --help

download_live_ocean

SalishSeaCast worker that downloads a daily averaged file from the University of Washington Live Ocean model forecast product for a specified date. The file contains a hyperslab that covers the SalishSeaCast NEMO model western (Juan de Fuca) open boundary that is generated by UW running our salishsea_tools.UBC_subdomain module.

nowcast.workers.download_live_ocean.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.download_live_ocean -h

make_live_ocean_files

Salish Sea nowcast worker that produces hourly temperature and salinity boundary conditions files for the SalishSeaCast NEMO model western (Juan de Fuca) open boundary from the University of Washington Live Ocean model forecast product.

nowcast.workers.make_live_ocean_files.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.make_live_ocean_files -h

upload_forcing

SalishSeaCast worker that upload forcing files for NEMO runs.

# SPDX-License-Identifier: Apache-2.0

Upload the forcing files for a nowcast or forecast run to the HPC/cloud facility where the run will be executed.

nowcast.workers.upload_forcing.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.upload_forcing --help

run_NEMO

SalishSeaCast worker that prepares the YAML run description file and bash run script for a nowcast, nowcast-green, forecast or forecast2 run on the ONC cloud, and launches the run.

nowcast.workers.run_NEMO.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.run_NEMO --help

run_NEMO_agrif

SalishSeaCast worker that repares the YAML run description file and bash run script for a NEMO SMELT AGRIF run on an HPC cluster that uses the TORQUE/MOAB scheduler, and queues the run.

nowcast.workers.run_NEMO_agrif.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.run_NEMO_agrif --help

run_NEMO_hindcast

SalishSeaCast worker that prepares the YAML run description file and bash run script for a NEMO hindcast run on an HPC cluster that uses the SLURM scheduler, and queues the run.

nowcast.workers.run_NEMO_hindcast.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.run_NEMO_hindcast --help

watch_NEMO

SalishSeaCast worker that monitors and reports on the progress of a run on the ONC cloud computing facility or salish.

nowcast.workers.watch_NEMO.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.watch_NEMO --help

watch_NEMO_agrif

SalishSeaCast worker that monitors and reports on the progress of a NEMO AGRIF run on an HPC cluster that uses the TORQUE/MOAB scheduler.

nowcast.workers.watch_NEMO_agrif.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.watch_NEMO_agrif --help

watch_NEMO_hindcast

SalishSeaCast worker that monitors and reports on the progress of a NEMO hindcast run on an HPC cluster that uses the SLURM scheduler.

nowcast.workers.watch_NEMO_hindcast.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.watch_NEMO_hindcast --help

make_turbidity_file

SalishSeaCast worker that produces daily average Fraser River turbidity file from hourly real-time turbidity data collected from Environment and Climate Change Canada Fraser River water quality buoy.

nowcast.workers.make_turbidity_file.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.make_turbidity_file --help

make_fvcom_boundary

Salish Sea FVCOM Vancouver Harbour and Fraser River model worker that produces boundary condition files for the FVCOM model open boundary in the Strait of Georgia from the SalishSeaCast NEMO model results.

nowcast.workers.make_fvcom_boundary.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.make_fvcom_boundary --help

make_fvcom_rivers_forcing

SalishSeaCast FVCOM Vancouver Harbour and Fraser River model worker that produces river discharges forcing files for the FVCOM model from the SalishSeaCast NEMO model runoff forcing files.

nowcast.workers.make_fvcom_rivers_forcing.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.make_fvcom_rivers_forcing --help

make_fvcom_atmos_forcing

Salish Sea FVCOM Vancouver Harbour and Fraser River model worker that produces atmospheric forcing files for the FVCOM model from the ECCC HRDPS model product.

nowcast.workers.make_fvcom_atmos_forcing.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.make_fvcom_atmos_forcing --help

upload_fvcom_atmos_forcing

SalishSeaCast FVCOM Vancouver Harbour and Fraser River model worker that uploads atmospheric forcing files for the FVCOM model to the compute host.

nowcast.workers.upload_fvcom_atmos_forcing.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.upload_fvcom_atmos_forcing --help

run_fvcom

Salish Sea FVCOM Vancouver Harbour and Fraser River model worker that prepares the temporary run directory and bash run script for a nowcast or forecast run on the ONC cloud, and launches the run.

nowcast.workers.run_fvcom.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.run_fvcom --help

watch_fvcom

Salish Sea nowcast worker that monitors and reports on the progress of an FVCOM run on the ONC cloud computing facility.

nowcast.workers.watch_fvcom.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.watch_fvcom --help

make_ww3_wind_file

Salish Sea WaveWatch3 forecast worker that produces the hourly wind forcing file for a prelim-forecast or forecast run

nowcast.workers.make_ww3_wind_file.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.make_ww3_wind_file --help

make_ww3_current_file

Salish Sea WaveWatch3 forecast worker that produces the hourly ocean currents forcing file for a prelim-forecast or forecast run

nowcast.workers.make_ww3_current_file.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.make_ww3_current_file --help

run_ww3

SalishSeaCast WaveWatch3 nowcast/forecast worker that prepares the temporary run directory and bash run script for a prelim-forecast, nowcast or forecast run on the ONC cloud, and launches the run.

nowcast.workers.run_ww3.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.run_ww3 --help

watch_ww3

Salish Sea nowcast worker that monitors and reports on the progress of a WaveWatch3 run on the ONC cloud computing facility.

nowcast.workers.watch_ww3.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.watch_ww3 --help

download_results

SalishSeaCast worker that downloads the results files from a run on an HPC/cloud facility to archival storage.

make_averaged_dataset

SalishSeaCast worker that creates a down-sampled time-series dataset netCDF4 file from another model product file using the Reshapr API.

nowcast.workers.make_averaged_dataset.main()[source]

For command-line usage see:

python -m nowcast.workers.make_averaged_dataset --help

archive_tarball

SalishSeaCast worker that creates a tarball of a month’s run results and moves it to remote archival storage. Compression is not used for the tarball because the netCDF files that compose most of it are already highly compressed. A .index text file containing a list of the files in the tarball is also created and moved to the remote storage.

split_results

SalishSeaCast worker that splits downloaded results of multi-day runs (e.g. hindcast runs) into daily results directories. The results files are renamed so that they look like they came from a single day run so that ERDDAP will accept them. The run description files are left in the first run day’s directory. The restart file is moved to the last run day’s directory.

nowcast.workers.split_results.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.split_results --help

download_wwatch3_results

SalishSeaCast system worker that downloads the results files from a WaveWatch3 run on the cloud facility to archival storage.

download_fvcom_results

SalishSeaCast worker that downloads the results files from a FVCOM Vancouver Harbour and Fraser River (VHFR) model run on the cloud facility to archival storage.

nowcast.workers.download_fvcom_results.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.download_fvcom_results --help

get_onc_ctd

Salish Sea nowcast worker that downloads CTD temperature and salinity data for a specified UTC day from an ONC Strait of Georgia node.

The data are filtered to include only values for which qaqcFlag == 1 (meaning that all of ONC’s automated QA/QC tests were passed). After filtering the data are aggregated into 15 minute bins. The aggregation functions are mean, standard deviation, and sample count.

The data are stored as a netCDF-4/HDF5 file that is accessible via https://salishsea.eos.ubc.ca/erddap/tabledap/index.html?page=1&itemsPerPage=1000.

Development notebook: https://nbviewer.org/github/SalishSeaCast/analysis-doug/blob/main/notebooks/ONC-CTD-DataToERDDAP.ipynb

nowcast.workers.get_onc_ctd.main()[source]

For command-line usage see:

python -m nowcast.workers.get_onc_ctd -h

update_forecast_datasets

SalishSeaCast worker that builds a new directory of symlinks to model results files for the rolling forecast datasets and replaces the previous rolling forecast directory with the new one.

nowcast.workers.update_forecast_datasets.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.update_forecast_datasets -h

ping_erddap

SalishSeaCast worker that creates flag files to tell the ERDDAP server to reload datasets for which new results have been downloaded.

nowcast.workers.ping_erddap.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.ping_erddap --help

make_plots

SalishSeaCast worker that produces visualization images for the web site from run results.

nowcast.workers.make_plots.main()[source]

For command-line usage see:

python -m nowcast.workers.make_plots --help

make_surface_current_tiles

SalishSeaCast worker that produces tiles of surface current visualization images for the web site from run results.

The tile specifications and initial code implementation were provided by IOS.

nowcast.workers.make_surface_current_tiles.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.make_surface_current_tiles --help

make_feeds

SalishSeaCast worker that produces ATOM feeds from forecast and forecast2 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.

nemo_nowcast.workers.clear_checklist.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nemo_nowcast.workers.clear_checklist --help

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.

nemo_nowcast.workers.rotate_logs.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nemo_nowcast.workers.rotate_logs --help

Worker Utility Functions

nowcast.lib Module

SalishSeaCast utility functions for use by workers.

nowcast.lib.configure_logging(config, logger, debug, email=True)[source]

Set up logging configuration.

This function assumes that the logger object has been created in the module from which the function is called. That is typically done with a module-level commands like:

worker_name = lib.get_module_name()

logger = logging.getLogger(worker_name)
Parameters:
  • config (dict) – Configuration data structure.

  • logger (logging.Logger) – Logger to be configured.

  • debug (boolean) – Debug mode; log to console instead of to file.

  • email (boolean) – Configure SMTP logging handler; only effective when debug == False.

nowcast.lib.fix_perms(path, mode=436, grp_name=None)[source]

Try to set the permissions and group ownership of the file or directory at path.

The desired permissions are given by mode. If grp_name is given, set the directory’s gid to that associated with the grp_name.

In the event that the file or directory at path is owned by another user the gid or permissions changes fail silently because they are probably correct already.

Parameters:
  • path (pathlib.Path or str) – Path to fix the permissions of.

  • mode (int) – Permissions to set for the path.

  • grp_name (str) – Group name to change the path ownership to. Defaults to None meaning do nothing.

nowcast.lib.mkdir(path, logger, mode=509, grp_name=None, exist_ok=True)[source]

Create a directory at path with its permissions set to mode. If grp_name is given, set the directory’s gid to that associated with the grp_name. If path already exists and exist_ok is False, log an error messages and raise an exception.

In the event that the directory already exists at path but is owned by another user the gid or permissions changes fail silently because they are probably correct already.

Parameters:
  • path (pathlib.Path or str) – Path to create the directory at.

  • logger (logging.Logger) – Logger object.

  • mode (int) – Permissions to set for the directory.

  • grp_name (str) – Group name to change the directory’s ownership to. Defaults to None meaning that the directory’s group will be the same as its parent’s.

  • exist_ok (boolean) – Indicate whether to log and error message and raise an exception if path already exists. Defaults to True meaning that an existing path is accepted silently.

Raises:

lib.WorkerError if path already exists and exist_ok is False

nowcast.lib.run_in_subprocess(cmd, output_logger, error_logger)[source]

Run cmd in a subprocess and log its stdout to output_logger. Catch errors from the subprocess, log them to error_logger, and raise the exception for handling somewhere higher in the call stack.

Parameters:
  • cmd (list) – Command and its arguments/options to run in subprocess.

  • output_logger (logging.Logger() method) – Logger object to send command output to when command is successful.

  • error_logger (logging.Logger() method) – Logger object to send error message(s) to when command returns non-zero status code.

Raises:

nowcast.lib.WorkerError

Special Workers

launch_remote_worker

SalishSeaCast worker that launches a specified worker on a remote host.

This worker is for use when it is necessary to intervene after an automation failure. It does the job of `nemo_nowcast.worker.NextWorker.launch()` with a non-default `host` argument, avoiding the need to manually construct a complicated `ssh` command.

nowcast.workers.launch_remote_worker.main()[source]

Set up and run the worker.

For command-line usage see:

python -m nowcast.workers.launch_remote_worker --help

rotate_hindcast_logs

SalishSeaCast worker that rotates hindcast processing logs.

Call the doRollover() method on the logging.handlers.RotatingFileHandler handlers of the run_NEMO_hindcast logger.

This worker is intended to be launched from the command-line by the nowcast administrator as necessary for maintenance of the hindcast log files e.g. when a new hindcast is started, or when the logs from a running hindcast become annoying long.

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_archive_tarball(msg, config, checklist)[source]

Calculate the list of workers to launch after the archive_tarball worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

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.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_collect_NeahBay_ssh(msg, config, checklist)[source]

Calculate the list of workers to launch after the collect_NeahBay_ssh worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_collect_river_data(msg, config, checklist)[source]

Calculate the list of workers to launch after the collect_river_data worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_collect_weather(msg, config, checklist)[source]

Calculate the list of workers to launch after the collect_weather worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_crop_gribs(msg, config, checklist)[source]

Calculate the list of workers to launch after the crop_gribs worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_download_fvcom_results(msg, config, checklist)[source]

Calculate the list of workers to launch after the download_fvcom_results worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_download_live_ocean(msg, config, checklist)[source]

Calculate the list of workers to launch after the download_live_ocean worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_download_results(msg, config, checklist)[source]

Calculate the list of workers to launch after the download_results worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

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.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_download_wwatch3_results(msg, config, checklist)[source]

Calculate the list of workers to launch after the download_wwatch3_results worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_get_onc_ctd(msg, config, checklist)[source]

Calculate the list of workers to launch after the get_onc_ctd worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_get_onc_ferry(msg, config, checklist)[source]

Calculate the list of workers to launch after the get_onc_ferry worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_get_vfpa_hadcp(msg, config, checklist)[source]

Calculate the list of workers to launch after the after_get_vfpa_hadcp worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_grib_to_netcdf(msg, config, checklist)[source]

Calculate the list of workers to launch after the grib_to_netcdf worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_launch_remote_worker(msg, config, checklist)[source]

Calculate the list of workers to launch after the launch_remote_worker worker ends, but it is an empty list because launch_remote_worker is a maintenance tool that is outside the flow of automation.

Parameters:
  • msg (collections.namedtuple) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_make_CHS_currents_file(msg, config, checklist)[source]

Calculate the list of workers to launch after the make_CHS_currents_file worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_make_averaged_dataset(msg, config, checklist)[source]

Calculate the list of workers to launch after the make_averaged_dataset worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_make_feeds(msg, config, checklist)[source]

Calculate the list of workers to launch after the make_feeds worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

Calculate the list of workers to launch after the make_forcing_links worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_make_fvcom_atmos_forcing(msg, config, checklist)[source]

Calculate the list of workers to launch after the after_make_fvcom_atmos_forcing worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_make_fvcom_boundary(msg, config, checklist)[source]

Calculate the list of workers to launch after the after_make_fvcom_boundary worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_make_fvcom_rivers_forcing(msg, config, checklist)[source]

Calculate the list of workers to launch after the after_make_fvcom_rivers_forcing worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_make_live_ocean_files(msg, config, checklist)[source]

Calculate the list of workers to launch after the make_live_ocean_files worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

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.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_make_runoff_file(msg, config, checklist)[source]

Calculate the list of workers to launch after the make_runoff_file worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_make_ssh_files(msg, config, checklist)[source]

Calculate the list of workers to launch after the make_ssh_files worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_make_surface_current_tiles(msg, config, checklist)[source]

Calculate the list of workers to launch after the make_surface_current_tiles worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_make_turbidity_file(msg, config, checklist)[source]

Calculate the list of workers to launch after the make_turbidity_file worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_make_v202111_runoff_file(msg, config, checklist)[source]

Calculate the list of workers to launch after the make_v202111_runoff_file worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_make_ww3_current_file(msg, config, checklist)[source]

Calculate the list of workers to launch after the after_make_ww3_current_file worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_make_ww3_wind_file(msg, config, checklist)[source]

Calculate the list of workers to launch after the after_make_ww3_wind_file worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_ping_erddap(msg, config, checklist)[source]

Calculate the list of workers to launch after the ping_erddap worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_rotate_hindcast_logs(msg, config, checklist)[source]

Calculate the list of workers to launch after the rotate_hindcast_logs worker ends, but it is an empty list because rotate_hindcast_logs is a maintenance tool that is outside the flow of automation.

Parameters:
  • msg (collections.namedtuple) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_rotate_logs(msg, config, checklist)[source]

Calculate the list of workers to launch after the rotate_logs worker ends, but it is an empty list because rotate_logs is the last worker in the daily automation cycle.

Parameters:
  • msg (collections.namedtuple) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

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.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_run_NEMO_agrif(msg, config, checklist)[source]

Calculate the list of workers to launch after the run_NEMO_agrif worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_run_NEMO_hindcast(msg, config, checklist)[source]

Calculate the list of workers to launch after the run_NEMO_hindcast worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_run_fvcom(msg, config, checklist)[source]

Calculate the list of workers to launch after the after_run_fvcom worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_run_ww3(msg, config, checklist)[source]

Calculate the list of workers to launch after the after_run_ww3 worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_split_results(msg, config, checklist)[source]

Calculate the list of workers to launch after the split_results worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_update_forecast_datasets(msg, config, checklist)[source]

Calculate the list of workers to launch after the update_forecast_datasets worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_upload_forcing(msg, config, checklist)[source]

Calculate the list of workers to launch after the upload_forcing worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_upload_fvcom_atmos_forcing(msg, config, checklist)[source]

Calculate the list of workers to launch after the after_upload_fvcom_atmos_forcing worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

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.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_watch_NEMO_agrif(msg, config, checklist)[source]

Calculate the list of workers to launch after the watch_NEMO_agrif worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_watch_NEMO_hindcast(msg, config, checklist)[source]

Calculate the list of workers to launch after the watch_NEMO_handcast worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_watch_fvcom(msg, config, checklist)[source]

Calculate the list of workers to launch after the after_watch_fvcom worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

nowcast.next_workers.after_watch_ww3(msg, config, checklist)[source]

Calculate the list of workers to launch after the watch_ww3 worker ends.

Parameters:
  • msg (nemo_nowcast.message.Message) – Nowcast system message.

  • config (nemo_nowcast.config.Config) – dict-like object that holds the nowcast system configuration that is loaded from the system configuration file.

  • checklist (dict) – System checklist: data structure containing the present state of the nowcast system.

Returns:

Worker(s) to launch next

Return type:

list

Results Figures Modules

The modules in the nowcast.figures namespace are used by the make_plots worker to produce the figures that are published to the web from each run. The figures are also stored in the figures/ sub-directory of each run’s results directory.

nowcast.figures.shared Module

A collection of functions for use by multiple figure modules in the nowcast.figures namespaces.

Note

These functions are intended for use only by nowcast.figures modules. If you find that you want to use one of these functions outside of those namespaces please talk to the group about refactoring the function into the SalishSeaTools Package.

nowcast.figures.shared.correct_model_ssh(ssh_model, t_model, ttide)[source]

Adjust model sea surface height by correcting for error due to using only 8 tidal constituents.

Based on salishsea_tools.stormtools.correct_model(). Uses a tidal prediction with no shallow water minus a tidal prediction with 8 constituents.

Parameters:
  • ssh_model (numpy.ndarray) – Sea surface height model results.

  • t_model (numpy.ndarray) – Model datetime objects corresponding to ssh_model.

  • ttide (pandas.DataFrame) – Tidal predictions data structure with time, pred_all, pred_8, and pred_noshallow columns.

Returns:

Corrected model sea surface height.

Return type:

numpy.ndarray

nowcast.figures.shared.find_ssh_max(tide_gauge_stn, ssh_ts, ttide)[source]

Find the maximum corrected sea surface height at a tide gauge station, and the date/time at which it occurrs.

Parameters:
  • tide_gauge_stn (str) – Name of tide gauge station.

  • ssh_ts (collections.namedtuple) – Sea surface height time series. ssh attribute is a numpy.ndarray of sea surface height values. time attribute is a numpy.ndarray of datetime object.

  • ttide (pandas.DataFrame) – Tidal predictions data structure with time, pred_all, pred_8, and pred_noshallow columns.

nowcast.figures.shared.get_tides(stn_name, path='../../tidal_predictions/')[source]

Return the tidal predictions at the named tide gauge station station.

Parameters:
  • stn_name (str) – Name of the tide gauge station.

  • path (str) – Path to the directory containing the tidal prediction .csv files to use. Default value resolves to SalishSeaNowcast/tidal_predications/ for calls elsewhere in the :py:mod:`~SalishSeaNowcast.nowcast.figures namespace.

Returns:

Tidal predictions object with columns time, pred_all, pred_8.

Return type:

pandas.Dataframe

nowcast.figures.shared.interp_to_model_time(t_model, values, t_values)[source]

Interpolate a an array of values to model output times.

Strategy: Convert times to seconds past a reference value and use those as the independent variable in interpolation.

Parameters:
  • t_model (numpy.ndarray) – Model output times as datetime objects.

  • values (numpy.ndarray) – Values to be interpolated to model output times.

  • t_values (numpy.ndarray) – Times corresponding to values as datetime objects.

Returns:

Values interpolated to t_model times.

Return type:

numpy.ndarray

nowcast.figures.shared.interpolate_tracer_to_depths(tracer, tracer_depths, interp_depths, tracer_mask, w_depths)[source]

Calculate the interpolated value of tracer at interp_depths using linear interpolation.

Parameters:
  • tracer (numpy.ndarray) – Depth profile of a model tracer variable.

  • tracer_depths (numpy.ndarray) – Depths at which the model tracer variable has values.

  • interp_depths (numpy.ndarray or number) – Depth(s) at which to calculate the interpolated value of the model variable or data quantity.

  • tracer_mask (numpy.ndarray) – Mask to use obtain the water sections of tracer and tracer_depths; i.e. a 1D slice of tmask from the mesh mask.

  • w_depths (numpy.ndarray) – Mask to use for the depths. For model results it is best to use the a 1D slice of the appropriate mesh mask array; e.g. tmask for tracers. Masking the depths array increases the accuracy of the interpolation. If var_depth_mask is not provided the depths array is zero-masked.

Returns:

Value(s) of tracer linearly interpolated to interp_depths.

Return type:

numpy.ndarray or number

Raises:

ValueError if any of the values in interp_depths exceed the maximum model grid depth.

nowcast.figures.shared.localize_time(data_array, time_coord='time', local_datetime=None)[source]

Offset data_array times to account for local time zone difference from UTC and add tz_name attribute to data_array.

Note

This function is intended for use just before presentation/output of data_array. It is strongly recommended to do all date/time calculations in UTC to avoid time change issues.

Parameters:
  • data_array (xarray.DataArray or xarray.Dataset) – Data array or dataset object to adjust time values of.

  • time_coord (str) – Optional name of the time coordinate.

  • local_datetime (arrow.Arrow) – Optional timezone-aware local date/time to use as basis to calculate offset from UTC. The 1st element of data_array is used when local_datetime is None.

nowcast.figures.shared.plot_map(ax, coastline, lat_range=(47.5, 50.7), lon_range=(-126, -122), land_patch_min_area=0.001, theme=<module 'nowcast.figures.website_theme' from '/home/docs/checkouts/readthedocs.org/user_builds/salishsea-nowcast/checkouts/latest/nowcast/figures/website_theme.py'>)[source]

Plot a map of the Salish Sea region, including the options to add a coastline, colour of the land, and colour of the domain.

The map produced by this function is intended for use as the background for figures on which model results are plotted. It is rasterized to minimize the file size of the resulting rendered figure image, an important consideration for web site figure images.

Parameters:
  • ax (matplotlib.axes.Axes) – Axes object to plot the map on.

  • coastline (dict) – Pacific Northwest Coastline from matlab .mat file.

  • lat_range (2-tuple) – Latitude range to be plotted.

  • lon_range (2-tuple) – Longitude range to be plotted.

  • land_patch_min_area (float) – Minimum area of land patch to be plotted.

  • theme – Module-like object that defines the style elements for the figure. See nowcast.figures.website_theme for an example.

nowcast.figures.shared.plot_risk_level_marker(ax, tide_gauge_name, risk_level, marker, msize, alpha, theme)[source]

Draw a storm surge risk level marker at tide gauge location.

The axes is assumed to be using lon/lat scales.

Parameters:
  • ax (matplotlib.axes.Axes) – Axes object to draw the marker on.

  • tide_gauge_name (str) – Name of the tide gauge site at which to plot the marker.

  • risk_level (str) – Storm surge risk level identifier, perhaps from salishsea_tools.stormtools.storm_surge_risk_level(): None for no storm surge risk, moderate risk for water level between max tide level and the half-way threshold, and extreme risk for water level above the half-way threshold

  • marker (str) – Marker identifier from matplotlib.markers.

  • msize (float) – Marker size.

  • alpha (float) – Marker transparency.

  • theme – Module-like object that defines the style elements for the figure. See nowcast.figures.website_theme for an example.

nowcast.figures.shared.plot_wind_arrow(ax, lon, lat, u_wind, v_wind, theme, wind_arrow_scale_factor=0.1)[source]

Draw a wind arrow on an plot axes.

The axes is assumed to be using lon/lat scales.

This just a wrapper that applies particular formatting to the matplotlib.axes.arrow() method.

Parameters:
  • ax (matplotlib.axes.Axes) – Axes object to draw the arrow on.

  • lon (float) – Longitude of the arrow starting point.

  • lat (float) – Latitude of the arrow starting point.

  • u_wind (float) – Zonal (u) direction component of wind speed; value will be scaled to give longitude direction length of arrow.

  • v_wind (float) – Meridional (v) direction component of wind speed; value will be scaled to give latitude direction length of arrow.

  • wind_arrow_scale_factor (float) – Scale factor applied to wind speed components to convert them to lon/lat scale of plot; defaults to 0.1.

  • theme – Module-like object that defines the style elements for the figure. See nowcast.figures.website_theme for an example.

nowcast.figures.website_theme Module

Colour, fonts, and utility functions that define the look of figures for the https://salishsea.eos.ubc.ca/nemo/ web pages.

nowcast.figures.website_theme.COLOURS = {'axes': {'background': '#dbdee1'}, 'axes textbox': {'facecolor': 'white'}, 'axis': {'labels': 'white', 'spines': 'white', 'ticks': 'white'}, 'cbar': {'label': 'white', 'tick labels': 'white'}, 'contour lines': {'Baynes Sound entrance': 'black'}, 'dark land': '#8b7765', 'figure': {'facecolor': '#2B3E50'}, 'land': 'burlywood', 'marker': {'max ssh': {'edgecolor': 'black', 'facecolor': 'white'}, 'place': {'edgecolor': 'black', 'facecolor': 'white'}}, 'storm surge risk levels': {'extreme risk': 'red', 'moderate risk': 'Gold', None: 'green'}, 'text': {'axes annotation': 'black', 'axes title': 'white', 'axis': 'white', 'figure annotation': 'white', 'figure title': 'white', 'info box content': 'white', 'info box title': 'white', 'risk level label': 'white'}, 'time series': {'2nd Narrows model current direction': {'r12': 'purple', 'x2': 'blue'}, '2nd Narrows model current speed': {'r12': 'purple', 'x2': 'blue'}, '2nd Narrows observed current direction': 'green', '2nd Narrows observed current speed': 'green', 'Sand Heads HRDPS wind direction': 'blue', 'Sand Heads HRDPS wind speed': 'blue', 'Sand Heads observed wind direction': 'green', 'Sand Heads observed wind speed': 'green', 'VENUS CTD salinity': 'green', 'VENUS CTD temperature': 'green', 'VENUS node dev model salinity': 'magenta', 'VENUS node dev model temperature': 'magenta', 'VENUS node model salinity': 'blue', 'VENUS node model temperature': 'blue', 'ciliates': 'brown', 'datetime line': 'red', 'diatoms': 'brown', 'flagellates': 'darkgreen', 'mesozooplankton': 'brown', 'microzooplankton': 'darkgreen', 'nitrate': 'darkgreen', 'obs residual': 'green', 'obs wave height': 'green', 'obs wave period': 'green', 'salinity': 'blue', 'silicon': 'brown', 'ssh residual': 'blue', 'temperature': 'red', 'tidal prediction': 'black', 'tidal prediction vs model': 'purple', 'tide gauge obs': 'green', 'tide gauge ssh': 'MediumBlue', 'vhfr fvcom ssh': {'r12': 'purple', 'x2': 'magenta'}, 'wave height': 'blue', 'wave period': 'blue', 'z1_zooplankton': 'brown', 'z2_zooplankton': 'darkgreen'}, 'wind arrow': {'edgecolor': 'black', 'facecolor': 'DarkMagenta'}}

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 = {'axes annotation': <matplotlib.font_manager.FontProperties object>, 'axes title': <matplotlib.font_manager.FontProperties object>, 'axes title large': <matplotlib.font_manager.FontProperties object>, 'axis': <matplotlib.font_manager.FontProperties object>, 'axis small': <matplotlib.font_manager.FontProperties object>, 'figure annotation': <matplotlib.font_manager.FontProperties object>, 'figure annotation small': <matplotlib.font_manager.FontProperties object>, 'figure title': <matplotlib.font_manager.FontProperties object>, 'info box content': <matplotlib.font_manager.FontProperties object>, 'info box title': <matplotlib.font_manager.FontProperties object>, 'legend label': <matplotlib.font_manager.FontProperties object>, 'legend label large': <matplotlib.font_manager.FontProperties object>, 'legend label small': <matplotlib.font_manager.FontProperties object>, 'legend title': <matplotlib.font_manager.FontProperties object>, 'legend title small': <matplotlib.font_manager.FontProperties object>, 'location label large': <matplotlib.font_manager.FontProperties object>, 'location label small': <matplotlib.font_manager.FontProperties object>}

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 = '#2B3E50'

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.surface_current_domain Module

This standalone code produces the surface current tiled domain figure in both website themed and unthemed style and saves the figure files in ‘/SalishSeaCast/salishsea-site/salishsea_site/static/img/’.

The domain is divided into different tiles and needs to be re-run if the tile specification/coordinates are changed.

nowcast.figures.fvcom Figure Modules

nowcast.figures.fvcom.publish.tide_stn_water_level Module

Produce a figure that shows water levels at a tide gauge station calculated by the VHFR FVCOM and SalishSeaCast NEMO models, and predicted and observed water levels from the CHS https://ws-shc.qc.dfo-mpo.gc.ca/ water levels web service.

Testing notebook for this module is https://nbviewer.org/github/SalishSeaCast/SalishSeaNowcast/blob/main/notebooks/figures/fvcom/publish/TestTideStnWaterLevel.ipynb

Development notebook for this module is https://nbviewer.org/github/SalishSeaCast/SalishSeaNowcast/blob/main/notebooks/figures/fvcom/publish/DevelopTideStnWaterLevel.ipynb

nowcast.figures.fvcom.publish.tide_stn_water_level.make_figure(place, fvcom_ssh_datasets, nemo_ssh_dataset_url_tmpl, figsize=(16, 9), theme=<module 'nowcast.figures.website_theme' from '/home/docs/checkouts/readthedocs.org/user_builds/salishsea-nowcast/checkouts/latest/nowcast/figures/website_theme.py'>)[source]

Plot water levels calculated by the VHFR FVCOM and SalishSeaCast NEMO models, and predicted and observed water levels from the CHS https://ws-shc.qc.dfo-mpo.gc.ca/ water levels web service for the tide gauge station at place.

Parameters:
  • place (str) – Tide gauge station name; must be a key in salishsea_tools.places.PLACES.

  • fvcom_ssh_datasets (dict) – Dictionary of VHFR FVCOM model tide gauge station sea surface height time series of py:class:xarray.Dataset objects keyed by model model configuration (x2, r12).

  • nemo_ssh_dataset_url_tmpl (str) – ERDDAP URL template for SalishSeaCast NEMO model tide gauge station sea surface height time series dataset.

  • 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:

matplotlib.figure.Figure

nowcast.figures.fvcom.publish.second_narrows_current Module

Produce a figure that shows the sea water current at the 2nd Narrows Ironworkers Memorial Crossing bridge calculated by the VHFR FVCOM model, the observed current measured by a horizontal ADCP on the bridge piling.

Testing notebook for this module is https://nbviewer.org/github/SalishSeaCast/SalishSeaNowcast/blob/main/notebooks/figures/fvcom/publish/TestSecondNarrowsCurrent.ipynb

Development notebook for this module is https://nbviewer.org/github/SalishSeaCast/SalishSeaNowcast/blob/main/notebooks/figures/fvcom/publish/DevelopSecondNarrowsCurrent.ipynb

nowcast.figures.fvcom.publish.second_narrows_current.make_figure(place, fvcom_stns_datasets, obs_dataset, figsize=(16, 9), theme=<module 'nowcast.figures.website_theme' from '/home/docs/checkouts/readthedocs.org/user_builds/salishsea-nowcast/checkouts/latest/nowcast/figures/website_theme.py'>)[source]

Plot sea water current calculated by the VHFR FVCOM model, and the observed current measured by a horizontal ADCP on the 2nd Narrows Ironworkers Memorial Crossing bridge piling.

Parameters:
  • place (str) – Horizontal ADCP station name.

  • fvcom_stns_datasets (dict) – Dictionary of VHFR FVCOM model tide gauge station sea surface height time series of py:class:xarray.Dataset objects keyed by model model configuration (x2, r12).

  • obs_dataset ('py:class:xarray.Dataset`) – Observed horizontal ADCP station sea water current time series dataset.

  • 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:

matplotlib.figure.Figure

nowcast.figures.fvcom.research.surface_currents Module

Produce image-loop figures showing surface current vectors on a heatmap of speed for several regions of interest within the VHFR FVCOM model domain.

Testing notebook for this module is https://nbviewer.org/github/SalishSeaCast/SalishSeaNowcast/blob/main/notebooks/figures/fvcom/research/TestSurfaceCurrents.ipynb

nowcast.figures.fvcom.research.surface_currents.make_figure(place, time_index, fvcom_results_dataset, figsize=(16, 9), theme=<module 'nowcast.figures.website_theme' from '/home/docs/checkouts/readthedocs.org/user_builds/salishsea-nowcast/checkouts/latest/nowcast/figures/website_theme.py'>)[source]

Plot surface current vectors over a speed colormap for a sub-area of the VHFR FVCOM model.

Parameters:
  • place (str) – Name of domain sub-area

  • time_index (int) – index of dataset for which to plot data

  • fvcom_results_dataset – VHFR FVCOM model flow fields results dataset.

  • 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:

matplotlib.figure.Figure

nowcast.figures.fvcom.research.thalweg_transect Module

Produce image-loop figures showing vertical transects for variables from the VHFR FVCOM model domain along several thalweg transects.

Testing notebook for this module is https://nbviewer.org/github/SalishSeaCast/SalishSeaNowcast/blob/main/notebooks/figures/fvcom/research/TestThalwegTransect.ipynb

nowcast.figures.fvcom.research.thalweg_transect.make_figure(place, time_index, fvcom_results_dataset, varname, figsize=(16, 9), theme=<module 'nowcast.figures.website_theme' from '/home/docs/checkouts/readthedocs.org/user_builds/salishsea-nowcast/checkouts/latest/nowcast/figures/website_theme.py'>)[source]

Plot thalweg transects for model variables from the VHFR FVCOM model.

Parameters:
  • place (str) – Name of domain sub-area

  • time_index (int) – index of dataset for which to plot data

  • fvcom_results_dataset – VHFR FVCOM model flow fields results dataset.

  • varname (str) – standard fvcom variable or ‘normal velocity’ or ‘tangential velocity’; normal velocity is positive into the page tangential velocity is positive toward the right

  • 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:

matplotlib.figure.Figure

nowcast.figures.comparison Figure Modules

nowcast.figures.comparison.sandheads_winds Module

Produce a figure that shows the observed and model forcing wind speed and direction at Sand Heads during 24 hours of a nowcast run. Also show a map with the location of Sand Heads marked. Observations are from Environment and Climate Change Canada data: https://climate.weather.gc.ca/ Model forcing winds are from the Environment and Climate Change Canada HRDPS nested model. Text below the map acknowledges the sources of the observations and HRDPS product.

Testing notebook for this module is https://nbviewer.org/github/SalishSeaCast/SalishSeaNowcast/blob/main/notebooks/figures/comparison/TestSandHeadsWinds.ipynb

nowcast.figures.comparison.sandheads_winds.make_figure(hrdps_dataset_url, run_type, run_date, coastline, figsize=(16, 7), theme=<module 'nowcast.figures.website_theme' from '/home/docs/checkouts/readthedocs.org/user_builds/salishsea-nowcast/checkouts/latest/nowcast/figures/website_theme.py'>)[source]

Plot the time series observed and HRDPS model forcing wind speed and direction at Sand Heads.

Parameters:
  • hrdps_dataset_url (str) – ERDDAP dataset URL for the HRDPS product to be plotted.

  • run_type (str) – Type of run to produce figure for.

  • run_date (Arrow.arrow) – Date of the run to create the figure for.

  • coastline (mat.Dataset) – Coastline dataset.

  • 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:

matplotlib.figure.Figure

nowcast.figures.comparison.salinity_ferry_track Module

Produce a figure that compares salinity at 1.5m depth model results to salinity observations from the ONC instrument package aboard a BC Ferries vessel.

Testing notebook for this module is https://nbviewer.org/github/SalishSeaCast/SalishSeaNowcast/blob/main/notebooks/figures/comparison/TestSalinityFerryTrackModule.ipynb

nowcast.figures.comparison.salinity_ferry_track.make_figure(grid_T_hr, figsize=(20, 7.5), theme=<module 'nowcast.figures.website_theme' from '/home/docs/checkouts/readthedocs.org/user_builds/salishsea-nowcast/checkouts/latest/nowcast/figures/website_theme.py'>)[source]

Plot salinity comparison of 1.5m depth model results to salinity observations from the ONC instrument package aboard a BC Ferries vessel as well as ferry route with model salinity distribution.

Parameters:
  • grid_T_hr (netCDF4.Dataset) –

  • 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:

matplotlib.figure.Figure

nowcast.figures.publish Figure Modules

nowcast.figures.publish.compare_tide_prediction_max_ssh

Produce a figure that shows a map of the Salish Sea with coloured contours showing the sea surface height when it is at its maximum at a specified tide gauge station. The figure also shows ~7.5 day long time series graphs of:

  • Raw and corrected model water levels compared to the tidal prediction for the gauge location

  • Water level residuals (the difference between the corrected model results and the tidal predictions)

The tidal predictions are calculated by ttide (https://www.eoas.ubc.ca/~rich/#T_Tide). Those predictions use Canadian Hydrographic Service (CHS) tidal constituents and include all tide constituents. The corrected model results take into account the errors that result from using only 8 tidal constituents in the model calculations.

The figure is annotated with the calculated maximum sea surface height at the tide gauge location, the time at which it occurs, the ssh residual, and the wind speed and direction at that time.

Testing notebook for this module is https://nbviewer.org/github/SalishSeaCast/SalishSeaNowcast/blob/main/notebooks/figures/publish/TestCompareTidePredictionMaxSSH.ipynb

Development notebook for this module is https://nbviewer.org/github/SalishSeaCast/SalishSeaNowcast/blob/main/notebooks/figures/publish/DevelopCompareTidePredictionMaxSSH.ipynb

nowcast.figures.publish.compare_tide_prediction_max_ssh.make_figure(place, ssh_fcst_dataset_url_tmpl, tidal_predictions, forecast_hrs, weather_path, bathy, grid_T_hr_path, figsize=(20, 12), theme=<module 'nowcast.figures.website_theme' from '/home/docs/checkouts/readthedocs.org/user_builds/salishsea-nowcast/checkouts/latest/nowcast/figures/website_theme.py'>)[source]

Plot tidal prediction and models water level timeseries, storm surge residual timeseries, sea surface height contours on a Salish Sea map, and summary text for the tide gauge station at place.

Parameters:
  • place (str) – Tide gauge station name; must be a key in salishsea_tools.places.PLACES.

  • ssh_fcst_dataset_url_tmpl (str) – ERDDAP URL template for tide gauge station sea surface height forecast dataset time series.

  • tidal_predictions (pathlib.Path) – Path to directory of tidal prediction file.

  • forecast_hrs (int) – Number of hours in the water level dataset that constitute the forecast. Used control the portion of the dataset that is included in calculations like the maximum sea surface height, etc.

  • weather_path (pathlib.Path) – The directory where the weather forcing files are stored.

  • bathy (netCDF4.Dataset) – Model bathymetry.

  • grid_T_hr_path – Path and file name of hourly averaged tracer results dataset that includes calculated sea surface height.

  • 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:

matplotlib.figure.Figure

nowcast.figures.publish.pt_atkinson_tide Module

Produce a figure that shows the tidal cycle at Point Atkinson during a 4 week period centred around a model results period. The tidal cycle is based on predictions calculated by ttide (https://www.eoas.ubc.ca/~rich/#T_Tide). Those predictions use Canadian Hydrographic Service (CHS) tidal constituents and include all tide constituents. The figure also shows the time period of the model results around which it is centred. Text below the tidal cycle graph acknowledges the use of ttide.

Testing notebook for this module is https://nbviewer.org/github/SalishSeaCast/SalishSeaNowcast/blob/main/notebooks/figures/publish/TestPtAtkinsonTideModule.ipynb

nowcast.figures.publish.pt_atkinson_tide.make_figure(grid_T_hr, tidal_predictions, timezone, figsize=(20, 5), theme=<module 'nowcast.figures.website_theme' from '/home/docs/checkouts/readthedocs.org/user_builds/salishsea-nowcast/checkouts/latest/nowcast/figures/website_theme.py'>)[source]

Plot the tidal cycle at Point Atkinson during a 4 week period centred around the model results in grid_T with that period indicated on the graph.

Parameters:
  • grid_T_hr (netCDF4.Dataset) – Hourly tracer results dataset from NEMO.

  • tidal_predictions (str) – Path to directory of tidal prediction file.

  • timezone (str) – Timezone to use for display of model results.

  • 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:

matplotlib.figure.Figure

nowcast.figures.publish.storm_surge_alerts Module

Produce a figure that shows a map of the Salish Sea with markers indicating the risks of high water levels at the Point Atkinson, Victoria, Campbell River, Nanaimo, and Cherry Point tide gauge locations. The figure also shows wind vectors that indicate the average wind speed and direction averaged over the 4 hours preceding the maximum sea surface height at each location. Text below the map provides quantitative information about the maximum water level, when it occurs, and the 4 hr averaged wind speed, as well as acknowledgement of data sources.

Testing notebook for this module is https://nbviewer.org/github/SalishSeaCast/SalishSeaNowcast/blob/main/notebooks/figures/publish/TestStormSurgeAlertsModule.ipynb

nowcast.figures.publish.storm_surge_alerts.make_figure(grids_15m, weather_path, coastline, tidal_predictions, figsize=(18, 20), theme=<module 'nowcast.figures.website_theme' from '/home/docs/checkouts/readthedocs.org/user_builds/salishsea-nowcast/checkouts/latest/nowcast/figures/website_theme.py'>)[source]

Plot high water level risk indication markers and 4h average wind vectors on a Salish Sea map with summary text below.

Parameters:
  • grids_15m (dict) – Collection of 15 minute averaged sea surface height datasets at tide gauge locations, keyed by tide gauge station name.

  • weather_path (str) – The directory where the weather forcing files are stored.

  • coastline (mat.Dataset) – Coastline dataset.

  • tidal_predictions (str) – Path to directory of tidal prediction file.

  • 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:

matplotlib.figure.Figure

nowcast.figures.publish.storm_surge_alerts_thumbnail Module

Produce a figure that shows a map of the Salish Sea with markers indicating the risks of high water levels at the Point Atkinson, Victoria, Campbell River, Nanaimo, and Cherry Point tide gauge locations. The figure also shows wind vectors that indicate the average wind speed and direction averaged over the 4 hours preceding the maximum sea surface height at each location.

The figure is a thumbnail version of the figure produced by nowcast.figures.publish.storm_surge_alerts. It is intended primarily for use on the Salish Sea Storm Surge Information Portal page https://salishsea.eos.ubc.ca/storm-surge/.

Testing notebook for this module is https://nbviewer.org/github/SalishSeaCast/SalishSeaNowcast/blob/main/notebooks/figures/publish/TestStormSurgeAlertsThumbnailModule.ipynb

nowcast.figures.publish.storm_surge_alerts_thumbnail.make_figure(grids_15m, weather_path, coastline, tidal_predictions, figsize=(18, 20), theme=<module 'nowcast.figures.website_theme' from '/home/docs/checkouts/readthedocs.org/user_builds/salishsea-nowcast/checkouts/latest/nowcast/figures/website_theme.py'>)[source]

Plot high water level risk indication markers and 4h average wind vectors on a Salish Sea map.

Parameters:
  • grids_15m (dict) – Collection of 15m sea surface height datasets at tide gauge locations, keyed by tide gauge station name.

  • weather_path (str) – The directory where the weather forcing files are stored.

  • coastline (mat.Dataset) – Coastline dataset.

  • tidal_predictions (str) – Path to directory of tidal prediction file.

  • 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:

matplotlib.figure.Figure

nowcast.figures.publish.surface_current_tiles Module

Produce surface currents tile figures in both website themed and unthemed style.

nowcast.figures.publish.surface_current_tiles.make_figure(run_date, t_index, Uf, Vf, coordf, mesh_maskf, bathyf, tile_coords_dic, expansion_factor, theme=<module 'nowcast.figures.website_theme' from '/home/docs/checkouts/readthedocs.org/user_builds/salishsea-nowcast/checkouts/latest/nowcast/figures/website_theme.py'>)[source]

Create a list of surface current tile figures for a given time index t_index.

Parameters:
  • run_date (Arrow.arrow) – Date of the run to create the figure tiles for.

  • t_index (int) – time index

  • Uf (pathlib.Path) – Path to SalishSeaCast NEMO grid_U output file.

  • Vf (pathlib.Path) – Path to SalishSeaCast NEMO grid_V output file.

  • coordf (pathlib.Path) – Path to SalishSeaCast NEMO model coordinates file.

  • mesh_maskf (pathlib.Path) – Path to SalishSeaCast NEMO-generated mesh mask file.

  • bathyf (pathlib.Path) – Path to SalishSeaCast NEMO model bathymetry file.

  • tile_coords_dic (dict) – Dictionary containing tile coordinate definitions in longitude and latitude. See nowcast.figures.surface_current_domain.

  • expansion_factor (float) – Overlap fraction for tiles (typically between 0 and 0.25)

  • theme – Module-like object that defines the style elements for the figure. See nowcast.figures.website_theme for an example.

Returns:

list of matplotlib Figures and list of names for all figures

nowcast.figures.research Figure Modules

nowcast.figures.research.tracer_thalweg_and_surface Module

Produce a figure that shows 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.

Note

This module us no longer used in production but it preserved here because the figure development and testing docs and notebooks refer to it.

Testing notebook for this module is https://nbviewer.org/github/SalishSeaCast/SalishSeaNowcast/blob/main/notebooks/figures/research/TestTracerThalwegAndSurface.ipynb

Development notebook for this module is https://nbviewer.org/github/SalishSeaCast/SalishSeaNowcast/blob/main/notebooks/figures/research/DevelopTracerThalwegAndSurfaceModule.ipynb

nowcast.figures.research.tracer_thalweg_and_surface.make_figure(tracer_var, bathy, mesh_mask, cmap, depth_integrated, figsize=(16, 9), theme=<module 'nowcast.figures.website_theme' from '/home/docs/checkouts/readthedocs.org/user_builds/salishsea-nowcast/checkouts/latest/nowcast/figures/website_theme.py'>)[source]

Plot colour contours of tracer on a vertical slice along a section of the domain thalweg, and on the surface for the Strait of Georgia and Juan de Fuca Strait regions of the domain.

Parameters:
  • tracer_var (netCDF4.Variable) – Hourly average tracer results from NEMO run.

  • bathy (netCDF4.Dataset) – SalishSeaCast NEMO model bathymetry data.

  • mesh_mask (netCDF4.Dataset) – NEMO-generated mesh mask for run that produced tracer_var.

  • cmap (matplotlib.colors.LinearSegmentedColormap) – Colour map to use for tracer_var contour plots.

  • depth_integrated (boolean) – Integrate the tracer over the water column depth when True.

  • 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:

matplotlib.figure.Figure

nowcast.figures.research.time_series_plots Module

Produce 4 figures that show the time series of surface:

  • nitrate and diatom concentrations

  • mesozooplankton and microzooplankton concentrations

  • mesodinium rubrum and flagellates concentrations

  • temperature and salinity

over the last 2 months at a time series site.

Testing notebook for this module is https://nbviewer.org/github/SalishSeaCast/SalishSeaNowcast/blob/main/notebooks/figures/research/TestTimeSeriesPlots.ipynb

Development notebook for this module is https://nbviewer.org/github/SalishSeaCast/SalishSeaNowcast/blob/main/notebooks/figures/research/DevelopTimeSeriesPlots.ipynb

nowcast.figures.research.time_series_plots.make_figure(xr_dataset, left_variable, right_variable, place, figsize=(20, 8), theme=<module 'nowcast.figures.website_theme' from '/home/docs/checkouts/readthedocs.org/user_builds/salishsea-nowcast/checkouts/latest/nowcast/figures/website_theme.py'>)[source]
Parameters:
  • xr_dataset (xarray.core.dataset.Dataset) – Hourly average 3d biological fields and tracer fields from the gridapp datasets of the data server ERDAPP (https://salishsea.eos.ubc.ca/erddap/griddap/index.html?page=1&itemsPerPage=1000).

  • left_variable (xarray.Variable) – One of the data variables among ‘nitrate’, ‘mesozooplankton’, ‘microzooplankton’, ‘temperature’.

  • right_variable (xarray.Variable) – One of the data variables among ‘diatoms’, ‘microzooplankton’, ‘flagellates’, ‘salinity’.

  • place (str) – time series site.

  • 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:

matplotlib.figure.Figure

nowcast.figures.wwatch3 Figure Modules

nowcast.figures.wwatch3.wave_height_period Module

Produce a figure that shows significant wave height and dominant wave period at a wave buoy calculated by the SoG WaveWatch3(TM) model, and observed wave heights and dominant wave periods from the NOAA NDBC https://www.ndbc.noaa.gov/data/realtime2/ web service.

Testing notebook for this module is https://nbviewer.org/github/SalishSeaCast/SalishSeaNowcast/blob/main/notebooks/figures/wwatch3/TestWaveHeightPeriod.ipynb

Development notebook for this module is https://nbviewer.org/github/SalishSeaCast/SalishSeaNowcast/blob/main/notebooks/figures/wwatch3/DevelopWaveHeightPeriod.ipynb

nowcast.figures.wwatch3.wave_height_period.make_figure(buoy, wwatch3_dataset_url, figsize=(16, 9), theme=<module 'nowcast.figures.website_theme' from '/home/docs/checkouts/readthedocs.org/user_builds/salishsea-nowcast/checkouts/latest/nowcast/figures/website_theme.py'>)[source]

Plot significant wave height and dominant wave period calculated by the SoG WaveWatch3(TM) model, and observed wave heights and dominant wave periods from the NOAA NDBC https://www.ndbc.noaa.gov/data/realtime2/ web service for the wave buoy at buoy.

Parameters:
  • buoy (str) – Wave buoy name; must be a key in moad_tools.places.PLACES.

  • wwatch3_dataset_url (str) – ERDDAP URL for SalishSeaCast WaveWatch3(TM) NEMO model fields time series dataset.

  • 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:

matplotlib.figure.Figure