In [1]:
%pylab inline
Similarly to the "TideGauge class" and the "Drifter class", the "ADCP class" is a measurement-based object.
As any other library in Python, PySeidon has to be first imported before to be used. Here we will use an alternative import statement compared to the one previoulsy presented:
In [2]:
from pyseidon import *
Star here means all. Usually this form of statements would import the entire library. In the case of PySeidon, this statement will import the following object classes: FVCOM, Station, Validation, ADCP, Tidegauge and Drifter. Only the ADCP class will be tackle in this tutorial. However note should note that the architecture design and functioning between each classes are very similar.
Python is by definition an object oriented language...and so is matlab. PySeidon is based on this notion of object, so let us define our first "ADCP" object.
Exercise 1:
Answer:
In [5]:
ADCP?
According to the documentation, in order to define a ADCP object, the only required input is a *filename. This string input represents path to a file (e.g. testAdcp=ADCP('./path_to_matlab_file/filename') and whose file must be a matlab file (i.e. *.mat).
Note that, at the current stage, the package only handle fully processed ADCP matlab data previously quality-controlled as well as formatted through "EnsembleData_FlowFile" matlab script at the mo. All the tool necessary for this processing and quality-control can be found in ./pyseidon/utilities/BP_tools.py and save_FlowFile_BPFormat.py. Additionally, a template for the ADCP file is provided in the package under data4tutorial
Exercise 2:
Answer:
In [3]:
adcp=ADCP('./data4tutorial/adcp_GP_01aug2013.mat')
The ADCP object possesses 3 attributes and 3 methods. They would appear by typing adcp. 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 Station attributes are:
The Station methods & functions are:
Exercise 3:
Answer:
In [4]:
print "(lon, lat) coordinates: ("+str(adcp.Variables.lon)+", "+str(adcp.Variables.lat)+")"
vel = adcp.Utils.velo_norm()
fI, eI, pa, pav = adcp.Utils.ebb_flood_split()
adcp.Utils.speed_histogram(time_ind=fI)
dveldz = adcp.Utils.verti_shear(time_ind=eI)
harmo = adcp.Utils.Harmonic_analysis(elevation=False, velocity=True)
print harmo
velos = adcp.Utils.Harmonic_reconstruction(harmo)
Exercise 5:
Answer:
In [7]:
import numpy as np
da_vel = np.nanmean(vel,axis=1)
station.dump_profile_data(adcp.Variables.matlabTime[:], da_vel, title='flow_speed_time_series', xlabel='matlab time', ylabel='speed')
As beta tester, your first assignement is to report bugs...yet not everything is a bug. The first thing to check before to report a bug is to verify that your version of PySeidon is up-to-date. The best way to keep up with the package evolution is to git to clone the repository, use pull to update it and re-install it if needed.
The second thing to check before to report a bug is to verify that the bug is reproducible. When running into a bug, double check that your inputs fit the description of the documentation then turn the debug flag on (e.g. output = adcpobject.function(inputs, debug=True)) and submit the command again. If the error re-occurs then report it (i.e. copy entire error message + command and send it to package administrator)
Your second role as beta-tester is to submit suggestions and critics to the developpers regarding the functioning and functionality of the package. Beta testing phase is the best opportunity to steer a project towards the applications you would like to be tackled...