How to access CTD data: a short guide

In [1]:
from matplotlib import pyplot as plt
from salishsea_tools import loadDataFRP

%matplotlib inline

We will want to import loadDataFRP from salishsea_tools. Now, we can use loadDataFRP to get the relatively raw CTD data or we can use loadDataFRP_SSGrid to get the CTD data at the model grid resolution.

In [2]:
stationdata, casts = loadDataFRP.loadDataFRP_SSGrid()
(40, 898, 398) 415 337 1.0
(40, 898, 398) 415 337 2.0
(40, 898, 398) 442 259 3.0
(40, 898, 398) 438 268 4.0
/home/vdo/anaconda3/lib/python3.6/site-packages/numpy/ma/core.py:3883: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
  check = self.filled(0).__eq__(other)
(40, 898, 398) 434 278 5.0
(40, 898, 398) 432 281 6.0
(40, 898, 398) 430 285 7.0
(40, 898, 398) 428 289 8.0
(40, 898, 398) 427 291 9.0
(40, 898, 398) 412 291 10.0
(40, 898, 398) 443 258 11.0
(40, 898, 398) 438 268 12.0
(40, 898, 398) 434 278 13.0
(40, 898, 398) 432 281 14.1
(40, 898, 398) 432 281 14.2
(40, 898, 398) 432 287 15.0
(40, 898, 398) 432 292 16.0
(40, 898, 398) 427 291 17.0
(40, 898, 398) 415 337 18.0

stationdata has the information for each of the stations. stationdata.keys() will tell us what pieces of information it has.

In [3]:
stationdata.keys()
Out[3]:
Index(['Station', 'Date', 'Date_UTC', 'Time_UTC_hhmmss', 'Time_UTC_DecDay',
       'LatDecDeg', 'LonDecDeg', 'LatDecDeg_surface', 'LonDecDeg_surface',
       'LatDecDeg_bottom', 'LonDecDeg_bottom', 'LatDecDeg_surf2',
       'LonDecDeg_surf2', 'LatDecDeg_Niskin', 'LonDecDeg_Niskin',
       'LatDecDeg_end', 'LonDecDeg_end', 'Sounding', 'MaxWireOut_m',
       'waveHeightEst_m', 'cloudyPct', 'filename', 'time_PDT_hhmmss',
       'time_PDT_decDay', 'time_on_PDT_hhmmss', 'time_on_PDT_decDay',
       'time_surface_PDT_hhmmss', 'time_surface_PDT_decDay',
       'time_bottom_PDT_hhmmss', 'time_bottom_PDT_decDay',
       'time_surf2_PDT_hhmmss', 'time_Niskin_PDT_hhmmss',
       'time_off_PDT_hhmmss', 'SecchiDepth_m', 'BottleLetter', 'ALS_Turb_NTU',
       'ALS_TSS_mgL', 'sb19Turb_uncorrected', 'sb19Sal', 'sb25Sal',
       'ishift_sub19', 'pStart25', 'pEnd25'],
      dtype='object')

Choosing some pieces of information, let's quickly look at all the stations.

In [5]:
stationdata[['Station', 'Date_UTC', 'Time_UTC_hhmmss', 'LatDecDeg', 'LonDecDeg']]
Out[5]:
Station Date_UTC Time_UTC_hhmmss LatDecDeg LonDecDeg
0 1.0 20170410 17:54:17 49.148333 -123.040000
1 2.0 20170410 18:05:11 49.148333 -123.040000
2 3.0 20170410 19:44:22 49.099983 -123.526600
3 4.0 20170410 20:25:40 49.100383 -123.467017
4 5.0 20170410 21:05:12 49.100583 -123.400417
5 6.0 20170410 21:40:15 49.100500 -123.375500
6 7.0 20170410 21:58:48 49.100000 -123.350000
7 8.0 20170410 22:30:56 49.100333 -123.324667
8 9.0 20170410 22:45:20 49.101500 -123.309000
9 10.0 20170531 17:19:23 49.039500 -123.259650
10 11.0 20170531 18:13:05 49.100810 -123.533720
11 12.0 20170531 18:51:36 49.101080 -123.467220
12 13.0 20170531 19:24:38 49.100370 -123.400120
13 14.1 20170531 19:50:40 49.100850 -123.375670
14 14.2 20170531 19:53:25 49.102620 -123.377670
15 15.0 20170531 20:12:26 49.110550 -123.348520
16 16.0 20170531 20:41:47 49.120700 -123.318500
17 17.0 20170531 21:01:03 49.101680 -123.308830
18 18.0 20170531 22:05:25 49.148290 -123.039280

We can access one particular station by stationdata.iloc[[index]]. For example,

In [7]:
stationdata.iloc[[10]]
Out[7]:
Station Date Date_UTC Time_UTC_hhmmss Time_UTC_DecDay LatDecDeg LonDecDeg LatDecDeg_surface LonDecDeg_surface LatDecDeg_bottom ... SecchiDepth_m BottleLetter ALS_Turb_NTU ALS_TSS_mgL sb19Turb_uncorrected sb19Sal sb25Sal ishift_sub19 pStart25 pEnd25
10 11.0 20170531 20170531 18:13:05 0.759086 49.10081 -123.53372 49.10819 -123.53583 49.10492 ... 0.9 N 6.8 29.5 236.4195 20.5111 24.4447 9 503 2351

1 rows × 43 columns

The casts are seperated into down casts (dCast) and up casts (uCast) and also by their station number. For example, to get the down cast of Station 1,

In [8]:
casts[1].dCast
Out[8]:
depth_m indk gsw_ctA0 gsw_srA0 xmiss par wetStar sbeox0ML_L turb
0 0.500000 0 NaN NaN 2.479504 5.899257e+01 NaN NaN 22.766754
1 1.500003 1 6.286730 0.234429 2.784258 3.556208e+00 NaN NaN 22.485960
2 2.500011 2 6.304116 0.437654 3.056195 1.835949e-01 NaN NaN 22.454910
3 3.500031 3 6.294724 0.288937 2.845398 5.709572e-03 NaN NaN 22.429276
4 4.500071 4 6.301723 0.448622 2.944253 8.889421e-07 NaN NaN 23.102633
5 5.500151 5 6.307425 0.465020 3.123734 3.041954e-11 NaN NaN 22.661692
6 6.500310 6 6.314102 0.610037 3.230192 1.544406e-12 NaN NaN 22.583457
7 7.500623 7 6.323051 0.720218 3.176288 1.000001e-12 NaN NaN 22.406355
8 8.501236 8 6.333207 0.926944 3.148754 1.000000e-12 NaN NaN 21.858036
9 9.502433 9 6.350083 1.181544 3.301614 1.000000e-12 NaN NaN 21.875064
10 10.504766 10 6.342900 1.042017 3.170348 NaN NaN NaN NaN

(From Elise) Station 14 is separated into 14.1: downcasts and 14.2: upcast because the downcast and upcast passed through different sides of a turbidity front and therefore are associated with separate Secchi disk measurements. Therefore, casts[14.1].uCast and casts[14.2].dCast return pandas dataframes containing only NaN values.

Each cast dataframe contains the following columns:

  • prSM pressure (dbar)
  • gsw_ctA0 conservative temperature (C)
  • gsw_srA0 reference salinity (g/kg)
  • xmiss beam transmission (%)
  • par PAR/Irradiance
  • wetStar fluorescence (mg/m^3)
  • sbeox0ML_L oxygen (ml/l)
  • turb NTU (corrected by comparison with bottle samples)

Note: no salinity correction is currently available for this coastal region; the output of the TEOS10 absolute salinity field is identical to the reference salinity field

We can select indivial depths and columns similarly to how we access the information for stationdata.

In [9]:
casts[1].uCast.iloc[[1]] #all the dat at depth = 1.5
Out[9]:
depth_m indk gsw_ctA0 gsw_srA0 xmiss par wetStar sbeox0ML_L turb
1 1.500003 1 6.307806 0.402395 2.9404 5.249396 NaN NaN 21.03284
In [10]:
casts[1].uCast['gsw_ctA0'] #the temperature for all depths
Out[10]:
0          NaN
1     6.307806
2     6.313334
3     6.318863
4     6.321535
5     6.324289
6     6.328064
7     6.336780
8     6.349846
9     6.357515
10    6.364559
Name: gsw_ctA0, dtype: float64
In [ ]: