2020 Data Labs REU
Written by Sage Lichtenwalner, Rutgers University, June 8, 2020
This notebook is designed as a kickoff activity to our 3-day Intro to Oceanographic Data Processing in Python series. The commands here are simple and provided mostly without context (which will be discussed in later notebooks) in order to highlight some of the advantages of using Python in Research Computing.
The code from this example was adapted from A Quick Introduction to Python develoed as part of our 2019 Summer workshop series.
2+2
4
a = 42
a
42
b = 'Life, The Universe, and Everything'
b
'Life, The Universe, and Everything'
import pandas as pd
url = 'https://marine.rutgers.edu/~sage/OOI_Data_Workshops/CP02PMUO_R9_ar24011.csv'
data = pd.read_csv(url)
data
Depth | Pressure | Temperature | Salinity | Density | Fluorescence | Turbidity | Oxygen | |
---|---|---|---|---|---|---|---|---|
0 | 14 | 14.109 | 20.0267 | 34.7221 | 1521.47 | 0.0072 | 0.3726 | 34.7187 |
1 | 15 | 15.116 | 20.0913 | 34.7772 | 1521.73 | -0.0245 | 0.3700 | 34.7693 |
2 | 16 | 16.124 | 20.2141 | 34.8684 | 1522.19 | -0.0361 | 0.3785 | 34.8652 |
3 | 17 | 17.132 | 20.3139 | 34.9335 | 1522.55 | -0.0401 | 0.3759 | 34.9386 |
4 | 18 | 18.140 | 20.4459 | 35.0250 | 1523.03 | -0.0509 | 0.3744 | 35.0229 |
... | ... | ... | ... | ... | ... | ... | ... | ... |
866 | 6 | 6.046 | 19.9109 | 34.6342 | 1520.92 | -0.0185 | 0.3842 | 34.6310 |
867 | 5 | 5.039 | 19.9138 | 34.6359 | 1520.91 | -0.0323 | 0.3816 | 34.6319 |
868 | 4 | 4.031 | 19.9145 | 34.6371 | 1520.90 | -0.0236 | 0.3874 | 34.6333 |
869 | 3 | 3.023 | 19.9165 | 34.6385 | 1520.89 | -0.0218 | 0.3842 | 34.6347 |
870 | 2 | 2.015 | 19.9122 | 34.6354 | 1520.86 | 0.0187 | 0.4047 | 34.6308 |
871 rows × 8 columns
data.describe()
Depth | Pressure | Temperature | Salinity | Density | Fluorescence | Turbidity | Oxygen | |
---|---|---|---|---|---|---|---|---|
count | 871.000000 | 871.000000 | 871.000000 | 871.000000 | 871.000000 | 871.000000 | 871.000000 | 871.000000 |
mean | 225.208955 | 227.110232 | 11.493936 | 35.353968 | 1498.607773 | -0.259318 | 0.361451 | 35.350359 |
std | 125.862021 | 126.972414 | 3.870060 | 0.255037 | 11.098248 | 0.159814 | 0.027444 | 0.254881 |
min | 2.000000 | 2.015000 | 6.252900 | 34.634200 | 1483.100000 | -0.375900 | 0.328600 | 34.630800 |
25% | 116.500000 | 117.432000 | 7.907650 | 35.123850 | 1487.855000 | -0.335200 | 0.346150 | 35.120850 |
50% | 225.000000 | 226.861000 | 11.021400 | 35.288300 | 1497.670000 | -0.335000 | 0.352200 | 35.285600 |
75% | 334.000000 | 336.851000 | 13.775450 | 35.607250 | 1505.530000 | -0.296100 | 0.367750 | 35.603200 |
max | 443.000000 | 446.900000 | 20.648000 | 35.793200 | 1523.790000 | 0.327700 | 0.501700 | 35.790500 |
# Let's plot the depth column
data['Depth'].plot();
# Now let's plot temperature
data['Temperature'].plot();
# Temperature vs. Depth
ax = data.plot(x='Temperature',y='Depth');
ax.invert_yaxis(); # Flip the y-axis
data.describe().to_csv('ctd_summary.csv');