Walk through all full resolution BED events and collect first non-zero ROT_RATE value

Executing this Notebook requires a personal STOQS server. Follow the steps to build your own development system — this will take a few hours and depends on a good connection to the Internet. Once your server is up log into it (after a cd ~/Vagrants/stoqsvm) and activate your virtual environment with the usual commands:

vagrant ssh -- -X
cd /vagrant/dev/stoqsgit
source venv-stoqs/bin/activate

Connect to your Institution's STOQS database server using read-only credentials. (Note: firewalls typically limit unprivileged access to such resources.)

cd stoqs
ln -s mbari_campaigns.py campaigns.py
export DATABASE_URL=postgis://everyone:guest@kraken.shore.mbari.org:5433/stoqs

Launch Jupyter Notebook on your system with:

cd contrib/notebooks
../../manage.py shell_plus --notebook

navigate to this file and open it. You will then be able to execute the cells and experiment with this notebook.


For the CCE campaign print the second ROT_RATE value (first non-zero value from backward difference) for all full resoltion BED events

In [1]:
db = 'stoqs_cce2015'

print(f"{'Activity Name':32s} {'Initial ROT_RATE (deg/sec)':26s} {'Initial A (g)'}")
print('-' * 32, '-' * 26, '-' * 13)
for act in Activity.objects.using(db).filter(name__contains='full').order_by('startdate'):
    mps = (MeasuredParameter.objects.using(db)
                   .filter(measurement__instantpoint__activity=act)
                   .order_by('measurement__instantpoint__timevalue'))
    irr = mps.filter(parameter__name='ROT_RATE')
    ia = mps.filter(parameter__name='A')

    print(f'{act.name:32s} {irr[1].datavalue:26.2f} {ia[0].datavalue:13.3f}')
Activity Name                    Initial ROT_RATE (deg/sec) Initial A (g)
-------------------------------- -------------------------- -------------
40100037_full_traj.nc (stride=1)                     238.69         0.251
30200078_full_traj.nc (stride=1)                      39.00         0.167
60100068_full_traj.nc (stride=1)                     110.44         0.257
80200014_full_traj.nc (stride=1)                      68.25         0.046
90100156_full_traj.nc (stride=1)                     156.75         0.149
80200015_full_traj.nc (stride=1)                      73.52         0.182
80200016_full_traj.nc (stride=1)                      75.42         0.213
90100157_full_traj.nc (stride=1)                      40.25         0.221
80200017_full_traj.nc (stride=1)                     114.48         0.065
90100158_full_traj.nc (stride=1)                       8.39         0.052
80200019_full_traj.nc (stride=1)                      60.61         0.028
80200020_full_traj.nc (stride=1)                      46.94         0.026
90100159_full_traj.nc (stride=1)                      37.76         0.101
90100160_full_traj.nc (stride=1)                      72.61         0.042
90100161_full_traj.nc (stride=1)                      87.81         0.032
90100162_full_traj.nc (stride=1)                      57.53         0.063
90100164_full_traj.nc (stride=1)                      78.50         0.070
90100165_full_traj.nc (stride=1)                      31.30         0.100
90100196_full_traj.nc (stride=1)                     259.94         0.628
80200039_full_traj.nc (stride=1)                     304.39         1.002
B0100028_full_traj.nc (stride=1)                       6.35         0.251
30400034_full_traj.nc (stride=1)                       2.43         0.080
80200052_full_traj.nc (stride=1)                      98.02         0.088
In [ ]: