Populating the interactive namespace from numpy and matplotlib
"Validation class" is a hybrid class which requires both a numerical-model-based object (e.g. "FVCOM" or "Station" object) and at least one measurement-based object (e.g. "ADCP", "TideGauge" or "Drifter" object or a list of their combination). Its aim is to provide validation benchmarks in order to access the accuracy of a FVCOM simulation compared to matching measurements.
As any other library in Python, PySeidon-dvt has to be first imported before to be used. Here we will use an alternative import statement compared to the one previoulsy presented:
from pyseidon_dvt import *
/home/grumpynounours/anaconda/lib/python2.7/site-packages/IPython/html.py:14: ShimWarning: The `IPython.html` package has been deprecated. You should import from `notebook` instead. `IPython.html.widgets` has moved to `ipywidgets`. "`IPython.html.widgets` has moved to `ipywidgets`.", ShimWarning)
Star here means all. Usually this form of statements would import the entire library. In the case of PySeidon-dvt, this statement will import the following object classes: FVCOM, Station, Validation, ADCP, Tidegauge and Drifter. Only the Validation class will be tackle in this tutorial.
Python is by definition an object oriented language...and so is matlab. PySeidon-dvt is based on this notion of object, so let us define our first "Validation" object.
According to the documentation, in order to define a Validation object, the required inputs are:
drift = Drifter('./data4tutorial/drifter_GP_01aug2013.mat') adcp = ADCP('./data4tutorial/adcp_GP_01aug2013.mat') tg = TideGauge('./data4tutorial/tidegauge_GP_01aug2013.mat') station = Station('http://ecoii.acadiau.ca/thredds/dodsC/ecoii/test/Station3D_dngrid_BF_20130730_20130809.nc') fvcom = FVCOM('http://ecoii.acadiau.ca/thredds/dodsC/ecoii/test/FVCOM3D_dngrid_GP_20130801_20130802.nc') val1 = Validation(adcp, station, flow=10.0) val2 = Validation([adcp, drift, tg], fvcom, flow='daf') val3 = Validation(adcp, fvcom, flow=-5.0)
Retrieving data from /media/grumpynounours/Seagate Backup Plus Drive/FVCOM_simulations/sim_tuto/Station3D_dngrid_BF_20130730_20130809.nc ... Initialisation... Retrieving data from /media/grumpynounours/Seagate Backup Plus Drive/FVCOM_simulations/sim_tuto/FVCOM3D_dngrid_GP_20130801_20130802.nc ... Initialisation... Station site: GP_130730_TA
The Validation object possesses 2 attributes and 5 methods. They would appear by typing val1. Tab for instance.
An attribute is a quantity intrinsic to its object. A method is an intrinsic function which changes an attribute of its object. Contrarily a function will generate its own output:
The Validation attributes are:
The Validation methods & functions are:
val1.validate_data(plot=True, save_csv=True, filename='test1') val1.taylor_diagram() val1.validate_harmonics(filename='test2')
/home/grumpynounours/anaconda/lib/python2.7/site-packages/numpy/lib/nanfunctions.py:703: RuntimeWarning: Mean of empty slice warnings.warn("Mean of empty slice", RuntimeWarning) /home/grumpynounours/anaconda/lib/python2.7/site-packages/matplotlib/figure.py:397: UserWarning: matplotlib is currently using a non-GUI backend, so cannot show the figure "matplotlib is currently using a non-GUI backend, "