{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "5471425c-9d28-4289-9867-65ad3a28a1c4",
   "metadata": {},
   "source": [
    "# Load AquapHOx-L data and recalculate dissolved oxygen with different salinity"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ed7d22ca-c931-49bc-8029-b109e63e9b32",
   "metadata": {},
   "outputs": [],
   "source": [
    "from pyrotoolbox import parse\n",
    "%matplotlib inline\n",
    "from pyrotoolbox.oxygen import hPa_to_mgL"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "a196924e-9cca-4c24-9df3-e33db92d9a38",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Load AquapHOx-L data\n",
    "df, m = parse('AphoxData/21270013.txt')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "3a661ab0-f0fd-4763-b8ed-5302e53fdfe3",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Convert hPa to mg/L for a salinity of 32 g/L"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "d38d9bc5-dfca-4408-9cba-dd1d7245321a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "date_time\n",
       "2024-07-04 11:21:14    7.796528\n",
       "2024-07-04 11:21:44    7.804866\n",
       "2024-07-04 11:22:14    7.803978\n",
       "2024-07-04 11:22:44    7.860132\n",
       "2024-07-04 11:23:14    7.687174\n",
       "                         ...   \n",
       "2024-07-04 19:33:44    7.388505\n",
       "2024-07-04 19:34:14    7.383316\n",
       "2024-07-04 19:34:44    7.377246\n",
       "2024-07-04 19:35:14    7.366197\n",
       "2024-07-04 19:35:44    7.359155\n",
       "Length: 990, dtype: float64"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hPa_to_mgL(df['oxygen_hPa'], df['sample_temperature'], 32)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "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.12.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
