{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"How to access CTD data: a short guide"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from matplotlib import pyplot as plt\n",
"from salishsea_tools import loadDataFRP\n",
"\n",
"%matplotlib inline"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"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. "
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(40, 898, 398) 415 337 1.0\n",
"(40, 898, 398) 415 337 2.0\n",
"(40, 898, 398) 442 259 3.0\n",
"(40, 898, 398) 438 268 4.0\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/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.\n",
" check = self.filled(0).__eq__(other)\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"(40, 898, 398) 434 278 5.0\n",
"(40, 898, 398) 432 281 6.0\n",
"(40, 898, 398) 430 285 7.0\n",
"(40, 898, 398) 428 289 8.0\n",
"(40, 898, 398) 427 291 9.0\n",
"(40, 898, 398) 412 291 10.0\n",
"(40, 898, 398) 443 258 11.0\n",
"(40, 898, 398) 438 268 12.0\n",
"(40, 898, 398) 434 278 13.0\n",
"(40, 898, 398) 432 281 14.1\n",
"(40, 898, 398) 432 281 14.2\n",
"(40, 898, 398) 432 287 15.0\n",
"(40, 898, 398) 432 292 16.0\n",
"(40, 898, 398) 427 291 17.0\n",
"(40, 898, 398) 415 337 18.0\n"
]
}
],
"source": [
"stationdata, casts = loadDataFRP.loadDataFRP_SSGrid()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"`stationdata` has the information for each of the stations. `stationdata.keys()` will tell us what pieces of information it has. "
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"Index(['Station', 'Date', 'Date_UTC', 'Time_UTC_hhmmss', 'Time_UTC_DecDay',\n",
" 'LatDecDeg', 'LonDecDeg', 'LatDecDeg_surface', 'LonDecDeg_surface',\n",
" 'LatDecDeg_bottom', 'LonDecDeg_bottom', 'LatDecDeg_surf2',\n",
" 'LonDecDeg_surf2', 'LatDecDeg_Niskin', 'LonDecDeg_Niskin',\n",
" 'LatDecDeg_end', 'LonDecDeg_end', 'Sounding', 'MaxWireOut_m',\n",
" 'waveHeightEst_m', 'cloudyPct', 'filename', 'time_PDT_hhmmss',\n",
" 'time_PDT_decDay', 'time_on_PDT_hhmmss', 'time_on_PDT_decDay',\n",
" 'time_surface_PDT_hhmmss', 'time_surface_PDT_decDay',\n",
" 'time_bottom_PDT_hhmmss', 'time_bottom_PDT_decDay',\n",
" 'time_surf2_PDT_hhmmss', 'time_Niskin_PDT_hhmmss',\n",
" 'time_off_PDT_hhmmss', 'SecchiDepth_m', 'BottleLetter', 'ALS_Turb_NTU',\n",
" 'ALS_TSS_mgL', 'sb19Turb_uncorrected', 'sb19Sal', 'sb25Sal',\n",
" 'ishift_sub19', 'pStart25', 'pEnd25'],\n",
" dtype='object')"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"stationdata.keys()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Choosing some pieces of information, let's quickly look at all the stations. "
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"
\n",
" \n",
" \n",
" | \n",
" Station | \n",
" Date_UTC | \n",
" Time_UTC_hhmmss | \n",
" LatDecDeg | \n",
" LonDecDeg | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 1.0 | \n",
" 20170410 | \n",
" 17:54:17 | \n",
" 49.148333 | \n",
" -123.040000 | \n",
"
\n",
" \n",
" 1 | \n",
" 2.0 | \n",
" 20170410 | \n",
" 18:05:11 | \n",
" 49.148333 | \n",
" -123.040000 | \n",
"
\n",
" \n",
" 2 | \n",
" 3.0 | \n",
" 20170410 | \n",
" 19:44:22 | \n",
" 49.099983 | \n",
" -123.526600 | \n",
"
\n",
" \n",
" 3 | \n",
" 4.0 | \n",
" 20170410 | \n",
" 20:25:40 | \n",
" 49.100383 | \n",
" -123.467017 | \n",
"
\n",
" \n",
" 4 | \n",
" 5.0 | \n",
" 20170410 | \n",
" 21:05:12 | \n",
" 49.100583 | \n",
" -123.400417 | \n",
"
\n",
" \n",
" 5 | \n",
" 6.0 | \n",
" 20170410 | \n",
" 21:40:15 | \n",
" 49.100500 | \n",
" -123.375500 | \n",
"
\n",
" \n",
" 6 | \n",
" 7.0 | \n",
" 20170410 | \n",
" 21:58:48 | \n",
" 49.100000 | \n",
" -123.350000 | \n",
"
\n",
" \n",
" 7 | \n",
" 8.0 | \n",
" 20170410 | \n",
" 22:30:56 | \n",
" 49.100333 | \n",
" -123.324667 | \n",
"
\n",
" \n",
" 8 | \n",
" 9.0 | \n",
" 20170410 | \n",
" 22:45:20 | \n",
" 49.101500 | \n",
" -123.309000 | \n",
"
\n",
" \n",
" 9 | \n",
" 10.0 | \n",
" 20170531 | \n",
" 17:19:23 | \n",
" 49.039500 | \n",
" -123.259650 | \n",
"
\n",
" \n",
" 10 | \n",
" 11.0 | \n",
" 20170531 | \n",
" 18:13:05 | \n",
" 49.100810 | \n",
" -123.533720 | \n",
"
\n",
" \n",
" 11 | \n",
" 12.0 | \n",
" 20170531 | \n",
" 18:51:36 | \n",
" 49.101080 | \n",
" -123.467220 | \n",
"
\n",
" \n",
" 12 | \n",
" 13.0 | \n",
" 20170531 | \n",
" 19:24:38 | \n",
" 49.100370 | \n",
" -123.400120 | \n",
"
\n",
" \n",
" 13 | \n",
" 14.1 | \n",
" 20170531 | \n",
" 19:50:40 | \n",
" 49.100850 | \n",
" -123.375670 | \n",
"
\n",
" \n",
" 14 | \n",
" 14.2 | \n",
" 20170531 | \n",
" 19:53:25 | \n",
" 49.102620 | \n",
" -123.377670 | \n",
"
\n",
" \n",
" 15 | \n",
" 15.0 | \n",
" 20170531 | \n",
" 20:12:26 | \n",
" 49.110550 | \n",
" -123.348520 | \n",
"
\n",
" \n",
" 16 | \n",
" 16.0 | \n",
" 20170531 | \n",
" 20:41:47 | \n",
" 49.120700 | \n",
" -123.318500 | \n",
"
\n",
" \n",
" 17 | \n",
" 17.0 | \n",
" 20170531 | \n",
" 21:01:03 | \n",
" 49.101680 | \n",
" -123.308830 | \n",
"
\n",
" \n",
" 18 | \n",
" 18.0 | \n",
" 20170531 | \n",
" 22:05:25 | \n",
" 49.148290 | \n",
" -123.039280 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Station Date_UTC Time_UTC_hhmmss LatDecDeg LonDecDeg\n",
"0 1.0 20170410 17:54:17 49.148333 -123.040000\n",
"1 2.0 20170410 18:05:11 49.148333 -123.040000\n",
"2 3.0 20170410 19:44:22 49.099983 -123.526600\n",
"3 4.0 20170410 20:25:40 49.100383 -123.467017\n",
"4 5.0 20170410 21:05:12 49.100583 -123.400417\n",
"5 6.0 20170410 21:40:15 49.100500 -123.375500\n",
"6 7.0 20170410 21:58:48 49.100000 -123.350000\n",
"7 8.0 20170410 22:30:56 49.100333 -123.324667\n",
"8 9.0 20170410 22:45:20 49.101500 -123.309000\n",
"9 10.0 20170531 17:19:23 49.039500 -123.259650\n",
"10 11.0 20170531 18:13:05 49.100810 -123.533720\n",
"11 12.0 20170531 18:51:36 49.101080 -123.467220\n",
"12 13.0 20170531 19:24:38 49.100370 -123.400120\n",
"13 14.1 20170531 19:50:40 49.100850 -123.375670\n",
"14 14.2 20170531 19:53:25 49.102620 -123.377670\n",
"15 15.0 20170531 20:12:26 49.110550 -123.348520\n",
"16 16.0 20170531 20:41:47 49.120700 -123.318500\n",
"17 17.0 20170531 21:01:03 49.101680 -123.308830\n",
"18 18.0 20170531 22:05:25 49.148290 -123.039280"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"stationdata[['Station', 'Date_UTC', 'Time_UTC_hhmmss', 'LatDecDeg', 'LonDecDeg']]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We can access one particular station by `stationdata.iloc[[index]]`. For example,"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Station | \n",
" Date | \n",
" Date_UTC | \n",
" Time_UTC_hhmmss | \n",
" Time_UTC_DecDay | \n",
" LatDecDeg | \n",
" LonDecDeg | \n",
" LatDecDeg_surface | \n",
" LonDecDeg_surface | \n",
" LatDecDeg_bottom | \n",
" ... | \n",
" SecchiDepth_m | \n",
" BottleLetter | \n",
" ALS_Turb_NTU | \n",
" ALS_TSS_mgL | \n",
" sb19Turb_uncorrected | \n",
" sb19Sal | \n",
" sb25Sal | \n",
" ishift_sub19 | \n",
" pStart25 | \n",
" pEnd25 | \n",
"
\n",
" \n",
" \n",
" \n",
" 10 | \n",
" 11.0 | \n",
" 20170531 | \n",
" 20170531 | \n",
" 18:13:05 | \n",
" 0.759086 | \n",
" 49.10081 | \n",
" -123.53372 | \n",
" 49.10819 | \n",
" -123.53583 | \n",
" 49.10492 | \n",
" ... | \n",
" 0.9 | \n",
" N | \n",
" 6.8 | \n",
" 29.5 | \n",
" 236.4195 | \n",
" 20.5111 | \n",
" 24.4447 | \n",
" 9 | \n",
" 503 | \n",
" 2351 | \n",
"
\n",
" \n",
"
\n",
"
1 rows × 43 columns
\n",
"
"
],
"text/plain": [
" Station Date Date_UTC Time_UTC_hhmmss Time_UTC_DecDay LatDecDeg \\\n",
"10 11.0 20170531 20170531 18:13:05 0.759086 49.10081 \n",
"\n",
" LonDecDeg LatDecDeg_surface LonDecDeg_surface LatDecDeg_bottom ... \\\n",
"10 -123.53372 49.10819 -123.53583 49.10492 ... \n",
"\n",
" SecchiDepth_m BottleLetter ALS_Turb_NTU ALS_TSS_mgL \\\n",
"10 0.9 N 6.8 29.5 \n",
"\n",
" sb19Turb_uncorrected sb19Sal sb25Sal ishift_sub19 pStart25 pEnd25 \n",
"10 236.4195 20.5111 24.4447 9 503 2351 \n",
"\n",
"[1 rows x 43 columns]"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"stationdata.iloc[[10]]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"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, "
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"
\n",
" \n",
" \n",
" | \n",
" depth_m | \n",
" indk | \n",
" gsw_ctA0 | \n",
" gsw_srA0 | \n",
" xmiss | \n",
" par | \n",
" wetStar | \n",
" sbeox0ML_L | \n",
" turb | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 0.500000 | \n",
" 0 | \n",
" NaN | \n",
" NaN | \n",
" 2.479504 | \n",
" 5.899257e+01 | \n",
" NaN | \n",
" NaN | \n",
" 22.766754 | \n",
"
\n",
" \n",
" 1 | \n",
" 1.500003 | \n",
" 1 | \n",
" 6.286730 | \n",
" 0.234429 | \n",
" 2.784258 | \n",
" 3.556208e+00 | \n",
" NaN | \n",
" NaN | \n",
" 22.485960 | \n",
"
\n",
" \n",
" 2 | \n",
" 2.500011 | \n",
" 2 | \n",
" 6.304116 | \n",
" 0.437654 | \n",
" 3.056195 | \n",
" 1.835949e-01 | \n",
" NaN | \n",
" NaN | \n",
" 22.454910 | \n",
"
\n",
" \n",
" 3 | \n",
" 3.500031 | \n",
" 3 | \n",
" 6.294724 | \n",
" 0.288937 | \n",
" 2.845398 | \n",
" 5.709572e-03 | \n",
" NaN | \n",
" NaN | \n",
" 22.429276 | \n",
"
\n",
" \n",
" 4 | \n",
" 4.500071 | \n",
" 4 | \n",
" 6.301723 | \n",
" 0.448622 | \n",
" 2.944253 | \n",
" 8.889421e-07 | \n",
" NaN | \n",
" NaN | \n",
" 23.102633 | \n",
"
\n",
" \n",
" 5 | \n",
" 5.500151 | \n",
" 5 | \n",
" 6.307425 | \n",
" 0.465020 | \n",
" 3.123734 | \n",
" 3.041954e-11 | \n",
" NaN | \n",
" NaN | \n",
" 22.661692 | \n",
"
\n",
" \n",
" 6 | \n",
" 6.500310 | \n",
" 6 | \n",
" 6.314102 | \n",
" 0.610037 | \n",
" 3.230192 | \n",
" 1.544406e-12 | \n",
" NaN | \n",
" NaN | \n",
" 22.583457 | \n",
"
\n",
" \n",
" 7 | \n",
" 7.500623 | \n",
" 7 | \n",
" 6.323051 | \n",
" 0.720218 | \n",
" 3.176288 | \n",
" 1.000001e-12 | \n",
" NaN | \n",
" NaN | \n",
" 22.406355 | \n",
"
\n",
" \n",
" 8 | \n",
" 8.501236 | \n",
" 8 | \n",
" 6.333207 | \n",
" 0.926944 | \n",
" 3.148754 | \n",
" 1.000000e-12 | \n",
" NaN | \n",
" NaN | \n",
" 21.858036 | \n",
"
\n",
" \n",
" 9 | \n",
" 9.502433 | \n",
" 9 | \n",
" 6.350083 | \n",
" 1.181544 | \n",
" 3.301614 | \n",
" 1.000000e-12 | \n",
" NaN | \n",
" NaN | \n",
" 21.875064 | \n",
"
\n",
" \n",
" 10 | \n",
" 10.504766 | \n",
" 10 | \n",
" 6.342900 | \n",
" 1.042017 | \n",
" 3.170348 | \n",
" NaN | \n",
" NaN | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" depth_m indk gsw_ctA0 gsw_srA0 xmiss par wetStar \\\n",
"0 0.500000 0 NaN NaN 2.479504 5.899257e+01 NaN \n",
"1 1.500003 1 6.286730 0.234429 2.784258 3.556208e+00 NaN \n",
"2 2.500011 2 6.304116 0.437654 3.056195 1.835949e-01 NaN \n",
"3 3.500031 3 6.294724 0.288937 2.845398 5.709572e-03 NaN \n",
"4 4.500071 4 6.301723 0.448622 2.944253 8.889421e-07 NaN \n",
"5 5.500151 5 6.307425 0.465020 3.123734 3.041954e-11 NaN \n",
"6 6.500310 6 6.314102 0.610037 3.230192 1.544406e-12 NaN \n",
"7 7.500623 7 6.323051 0.720218 3.176288 1.000001e-12 NaN \n",
"8 8.501236 8 6.333207 0.926944 3.148754 1.000000e-12 NaN \n",
"9 9.502433 9 6.350083 1.181544 3.301614 1.000000e-12 NaN \n",
"10 10.504766 10 6.342900 1.042017 3.170348 NaN NaN \n",
"\n",
" sbeox0ML_L turb \n",
"0 NaN 22.766754 \n",
"1 NaN 22.485960 \n",
"2 NaN 22.454910 \n",
"3 NaN 22.429276 \n",
"4 NaN 23.102633 \n",
"5 NaN 22.661692 \n",
"6 NaN 22.583457 \n",
"7 NaN 22.406355 \n",
"8 NaN 21.858036 \n",
"9 NaN 21.875064 \n",
"10 NaN NaN "
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"casts[1].dCast"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"(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. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Each cast dataframe contains the following columns:\n",
"\n",
"- prSM pressure (dbar)\n",
"- gsw_ctA0 conservative temperature (C)\n",
"- gsw_srA0 reference salinity (g/kg) \n",
"- xmiss beam transmission (%)\n",
"- par PAR/Irradiance \n",
"- wetStar fluorescence (mg/m^3)\n",
"- sbeox0ML_L oxygen (ml/l)\n",
"- turb NTU (corrected by comparison with bottle samples)\n",
"\n",
"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"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We can select indivial depths and columns similarly to how we access the information for `stationdata`."
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"
\n",
" \n",
" \n",
" | \n",
" depth_m | \n",
" indk | \n",
" gsw_ctA0 | \n",
" gsw_srA0 | \n",
" xmiss | \n",
" par | \n",
" wetStar | \n",
" sbeox0ML_L | \n",
" turb | \n",
"
\n",
" \n",
" \n",
" \n",
" 1 | \n",
" 1.500003 | \n",
" 1 | \n",
" 6.307806 | \n",
" 0.402395 | \n",
" 2.9404 | \n",
" 5.249396 | \n",
" NaN | \n",
" NaN | \n",
" 21.03284 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" depth_m indk gsw_ctA0 gsw_srA0 xmiss par wetStar sbeox0ML_L \\\n",
"1 1.500003 1 6.307806 0.402395 2.9404 5.249396 NaN NaN \n",
"\n",
" turb \n",
"1 21.03284 "
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"casts[1].uCast.iloc[[1]] #all the dat at depth = 1.5"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"0 NaN\n",
"1 6.307806\n",
"2 6.313334\n",
"3 6.318863\n",
"4 6.321535\n",
"5 6.324289\n",
"6 6.328064\n",
"7 6.336780\n",
"8 6.349846\n",
"9 6.357515\n",
"10 6.364559\n",
"Name: gsw_ctA0, dtype: float64"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"casts[1].uCast['gsw_ctA0'] #the temperature for all depths"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}