#!/usr/bin/env python # coding: utf-8 # # Test `wave_height_period` Figure Module # # Render figure object produced by the `nowcast.figures.wwatch3.wave_height_period` module. # Provides data for visual testing to confirm that refactoring has not adversely changed figure for web page. # # Set-up and function call replicates as nearly as possible what is done in the `nowcast.workers.make_plots` worker. # Notebooks like this should be developed in a # [Nowcast Figures Development Environment](https://salishsea-nowcast.readthedocs.io/en/latest/figures/fig_dev_env.html) # so that all of the necessary dependency packages are installed. # In[1]: import io from pathlib import Path import yaml from nowcast.figures.wwatch3 import wave_height_period # In[2]: get_ipython().run_line_magic('matplotlib', 'inline') # The bits of `config/nowcast.yaml` that are required: # In[3]: config = ''' figures: dataset URLs: wwatch3 fields: https://salishsea.eos.ubc.ca/erddap/griddap/ubcSSf2DWaveFields30mV17-02.nc?hs,fp ''' config = yaml.load(io.StringIO(config)) # The bits that the `make_figures` worker must provide: # In[4]: wwatch3_dataset_url = config['figures']['dataset URLs']['wwatch3 fields'] # In[9]: get_ipython().run_cell_magic('timeit', '-n1 -r1', "\nfrom importlib import reload\nreload(wave_height_period)\n\nbuoys = [\n 'Halibut Bank',\n 'Sentry Shoal',\n]\nfor buoy in buoys:\n fig = wave_height_period.make_figure(buoy, wwatch3_dataset_url)\n") # In[ ]: