{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "b8829835-f27f-4787-9bda-620549f2dbe1", "metadata": {}, "outputs": [], "source": [ "## take a look at ages" ] }, { "cell_type": "code", "execution_count": 2, "id": "72d89ef6-7356-464d-9c8a-2eef732ea362", "metadata": {}, "outputs": [], "source": [ "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 3, "id": "dea8346a-aeb3-45bf-a3f5-f7b682cc1d03", "metadata": {}, "outputs": [], "source": [ "def check_nan(ds):\n", " for j, index in enumerate(ds.index):\n", " if ds.transport[j] != ds.transport[j]:\n", " print (index)" ] }, { "cell_type": "code", "execution_count": 4, "id": "2d596304-50e1-4d7a-b18e-f5a3bdd99e0e", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2015 23.260960949873397\n", "2016 23.975001880932254\n", "2017 24.207005729799395\n", "2018 23.2257903359523\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "/tmp/ipykernel_3252/3505476923.py:3: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`\n", " if ds.transport[j] != ds.transport[j]:\n", "/tmp/ipykernel_3252/3505476923.py:3: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`\n", " if ds.transport[j] != ds.transport[j]:\n", "/tmp/ipykernel_3252/3505476923.py:3: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`\n", " if ds.transport[j] != ds.transport[j]:\n", "/tmp/ipykernel_3252/3505476923.py:3: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`\n", " if ds.transport[j] != ds.transport[j]:\n" ] } ], "source": [ "Vic_to_PR_2015 = pd.read_csv('Vic_to_PR_2015_v3.csv', index_col=0, parse_dates=True)\n", "print ('2015', Vic_to_PR_2015.transport.mean()/1000.); check_nan(Vic_to_PR_2015)\n", "Vic_to_PR_2016 = pd.read_csv('Vic_to_PR_2016_v3.csv', index_col=0, parse_dates=True)\n", "print ('2016', Vic_to_PR_2016.transport.mean()/1000.); check_nan(Vic_to_PR_2016)\n", "Vic_to_PR_2017 = pd.read_csv('Vic_to_PR_2017_v3.csv', index_col=0, parse_dates=True)\n", "print ('2017', Vic_to_PR_2017.transport.mean()/1000.); check_nan(Vic_to_PR_2017)\n", "Vic_to_PR_2018 = pd.read_csv('Vic_to_PR_2018_v3.csv', index_col=0, parse_dates=True)\n", "print ('2018', Vic_to_PR_2018.transport.mean()/1000.); check_nan(Vic_to_PR_2018)" ] }, { "cell_type": "code", "execution_count": 5, "id": "499d110c-5a53-4f12-93a9-b502bcefcf2b", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2015 23.16950381813652\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "/tmp/ipykernel_3252/3505476923.py:3: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`\n", " if ds.transport[j] != ds.transport[j]:\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "2016 23.663626086798104\n", "2017 24.14207376302193\n", "2018 23.6275020323928\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "/tmp/ipykernel_3252/3505476923.py:3: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`\n", " if ds.transport[j] != ds.transport[j]:\n", "/tmp/ipykernel_3252/3505476923.py:3: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`\n", " if ds.transport[j] != ds.transport[j]:\n", "/tmp/ipykernel_3252/3505476923.py:3: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`\n", " if ds.transport[j] != ds.transport[j]:\n" ] } ], "source": [ "PR_from_Vic_2015 = pd.read_csv('PR_from_Vic_2015_v3.csv', index_col=0, parse_dates=True)\n", "print ('2015', PR_from_Vic_2015.transport.mean()/1000.); check_nan(PR_from_Vic_2015)\n", "PR_from_Vic_2016 = pd.read_csv('PR_from_Vic_2016_v3.csv', index_col=0, parse_dates=True)\n", "print ('2016', PR_from_Vic_2016.transport.mean()/1000.); check_nan(PR_from_Vic_2016)\n", "PR_from_Vic_2017 = pd.read_csv('PR_from_Vic_2017_v3.csv', index_col=0, parse_dates=True)\n", "print ('2017', PR_from_Vic_2017.transport.mean()/1000.); check_nan(PR_from_Vic_2017)\n", "PR_from_Vic_2018 = pd.read_csv('PR_from_Vic_2018_v3.csv', index_col=0, parse_dates=True)\n", "print ('2018', PR_from_Vic_2018.transport.mean()/1000.); check_nan(PR_from_Vic_2018)" ] }, { "cell_type": "code", "execution_count": 6, "id": "3e80efed-1ea4-419c-a7d0-fb5c4a0997c7", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2015 23.923387363466393\n", "2016 24.191890364144417\n", "2017 23.97470431375392\n", "2018 23.17832074037491\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "/tmp/ipykernel_3252/3505476923.py:3: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`\n", " if ds.transport[j] != ds.transport[j]:\n", "/tmp/ipykernel_3252/3505476923.py:3: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`\n", " if ds.transport[j] != ds.transport[j]:\n", "/tmp/ipykernel_3252/3505476923.py:3: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`\n", " if ds.transport[j] != ds.transport[j]:\n", "/tmp/ipykernel_3252/3505476923.py:3: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`\n", " if ds.transport[j] != ds.transport[j]:\n" ] } ], "source": [ "PR_to_Vic_2015 = pd.read_csv('PR_to_Vic_2015_v3.csv', index_col=0, parse_dates=True)\n", "print ('2015', PR_to_Vic_2015.transport.mean()/1000.); check_nan(PR_to_Vic_2015)\n", "PR_to_Vic_2016 = pd.read_csv('PR_to_Vic_2016_v3.csv', index_col=0, parse_dates=True)\n", "print ('2016', PR_to_Vic_2016.transport.mean()/1000.); check_nan(PR_to_Vic_2016)\n", "PR_to_Vic_2017 = pd.read_csv('PR_to_Vic_2017_v3.csv', index_col=0, parse_dates=True)\n", "print ('2017', PR_to_Vic_2017.transport.mean()/1000.); check_nan(PR_to_Vic_2017)\n", "PR_to_Vic_2018 = pd.read_csv('PR_to_Vic_2018_v3.csv', index_col=0, parse_dates=True)\n", "print ('2018', PR_to_Vic_2018.transport.mean()/1000.); check_nan(PR_to_Vic_2018)" ] }, { "cell_type": "code", "execution_count": 7, "id": "5405b70a-80e2-490c-aac9-bb3ea5b27af7", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2015 24.05030665710093\n", "2016 24.045999770340103\n", "2017 23.990312937788694\n", "2018 23.092685865657987\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "/tmp/ipykernel_3252/3505476923.py:3: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`\n", " if ds.transport[j] != ds.transport[j]:\n", "/tmp/ipykernel_3252/3505476923.py:3: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`\n", " if ds.transport[j] != ds.transport[j]:\n", "/tmp/ipykernel_3252/3505476923.py:3: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`\n", " if ds.transport[j] != ds.transport[j]:\n", "/tmp/ipykernel_3252/3505476923.py:3: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`\n", " if ds.transport[j] != ds.transport[j]:\n" ] } ], "source": [ "Vic_from_PR_2015 = pd.read_csv('Vic_from_PR_2015_v3.csv', index_col=0, parse_dates=True)\n", "print ('2015', Vic_from_PR_2015.transport.mean()/1000.); check_nan(Vic_from_PR_2015)\n", "Vic_from_PR_2016 = pd.read_csv('Vic_from_PR_2016_v3.csv', index_col=0, parse_dates=True)\n", "print ('2016', Vic_from_PR_2016.transport.mean()/1000.); check_nan(Vic_from_PR_2016)\n", "Vic_from_PR_2017 = pd.read_csv('Vic_from_PR_2017_v3.csv', index_col=0, parse_dates=True)\n", "print ('2017', Vic_from_PR_2017.transport.mean()/1000.); check_nan(Vic_from_PR_2017)\n", "Vic_from_PR_2018 = pd.read_csv('Vic_from_PR_2018_v3.csv', index_col=0, parse_dates=True)\n", "print ('2018', Vic_from_PR_2018.transport.mean()/1000.); check_nan(Vic_from_PR_2018)" ] }, { "cell_type": "code", "execution_count": 16, "id": "5b19a291-99cc-4a68-98e6-fc0330ea6203", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "13.566945961865464" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "aa = 0.25*(Vic_from_PR_2015.final_age.mean() + Vic_from_PR_2016.final_age.mean() + Vic_from_PR_2017.final_age.mean() + Vic_from_PR_2018.final_age.mean())\n", "aa" ] }, { "cell_type": "code", "execution_count": 19, "id": "429f3fd3-50b0-4eec-87a8-0bae8c86406e", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "16.867819232282763" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dd = 0.25*(Vic_to_PR_2015.final_age.mean() + Vic_to_PR_2016.final_age.mean() + Vic_to_PR_2017.final_age.mean() + Vic_to_PR_2018.final_age.mean())\n", "dd" ] }, { "cell_type": "code", "execution_count": 17, "id": "0e7f07dd-d9d3-49e3-9b28-562fa19b82b3", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "13.71986337750608" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ab = 0.25*(PR_to_Vic_2015.final_age.mean() + PR_to_Vic_2016.final_age.mean() + PR_to_Vic_2017.final_age.mean() + PR_to_Vic_2018.final_age.mean())\n", "ab" ] }, { "cell_type": "code", "execution_count": 20, "id": "19ad343e-76f0-4e55-b0b5-578327b1cf6f", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "16.829606137174334" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "db = 0.25*(PR_from_Vic_2015.final_age.mean() + PR_from_Vic_2016.final_age.mean() + PR_from_Vic_2017.final_age.mean() + PR_from_Vic_2018.final_age.mean())\n", "db" ] }, { "cell_type": "code", "execution_count": 18, "id": "41b0ed5e-ed0e-4d67-b950-20f3952e1c67", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "13.643404669685772" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(aa + ab)/2 " ] }, { "cell_type": "code", "execution_count": 21, "id": "dad781f5-688b-4ada-ab72-23f2728ac4c1", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
transportfinal_agefinal_depthfinal_saltfinal_tempfinal_loninit_depthinit_saltinit_tempinit_lat
2016-01-01 00:00:00+00:005291.49425121.208800-38.68156631.4926398.969030-123.347175-84.32777330.1154658.91021848.924583
2016-01-02 00:00:00+00:005550.01563920.577325-39.41006031.4005838.985300-123.355776-88.36749930.1302968.88616448.921065
2016-01-03 00:00:00+00:005660.88271621.633671-38.56143531.3663638.996675-123.353684-87.99760930.1165768.84380748.921006
2016-01-04 00:00:00+00:006210.44668920.362758-37.48460431.3080999.008349-123.356458-94.90332430.1818588.89793248.919276
2016-01-05 00:00:00+00:009561.45608418.178807-42.19186331.3010969.008894-123.360976-94.84799430.2302118.88579548.917318
.................................
2016-12-27 00:00:00+00:009239.32032717.864120-58.74961431.7718179.712236-123.360505-68.74682129.9760418.78692748.939701
2016-12-28 00:00:00+00:0013199.43971316.501642-57.67081831.8608889.585216-123.356184-73.06384830.1665778.81643348.945536
2016-12-29 00:00:00+00:0015173.52935916.303234-57.92583931.9143449.532530-123.354214-73.85514530.1002728.78572748.935865
2016-12-30 00:00:00+00:0016451.47642316.888965-59.06223631.9411529.512147-123.354540-74.87147230.0906658.78964348.929824
2016-12-31 00:00:00+00:0019745.11905817.259144-59.70641931.9257769.475800-123.354114-83.34938130.1501638.80437048.924302
\n", "

366 rows × 10 columns

\n", "
" ], "text/plain": [ " transport final_age final_depth final_salt \\\n", "2016-01-01 00:00:00+00:00 5291.494251 21.208800 -38.681566 31.492639 \n", "2016-01-02 00:00:00+00:00 5550.015639 20.577325 -39.410060 31.400583 \n", "2016-01-03 00:00:00+00:00 5660.882716 21.633671 -38.561435 31.366363 \n", "2016-01-04 00:00:00+00:00 6210.446689 20.362758 -37.484604 31.308099 \n", "2016-01-05 00:00:00+00:00 9561.456084 18.178807 -42.191863 31.301096 \n", "... ... ... ... ... \n", "2016-12-27 00:00:00+00:00 9239.320327 17.864120 -58.749614 31.771817 \n", "2016-12-28 00:00:00+00:00 13199.439713 16.501642 -57.670818 31.860888 \n", "2016-12-29 00:00:00+00:00 15173.529359 16.303234 -57.925839 31.914344 \n", "2016-12-30 00:00:00+00:00 16451.476423 16.888965 -59.062236 31.941152 \n", "2016-12-31 00:00:00+00:00 19745.119058 17.259144 -59.706419 31.925776 \n", "\n", " final_temp final_lon init_depth init_salt \\\n", "2016-01-01 00:00:00+00:00 8.969030 -123.347175 -84.327773 30.115465 \n", "2016-01-02 00:00:00+00:00 8.985300 -123.355776 -88.367499 30.130296 \n", "2016-01-03 00:00:00+00:00 8.996675 -123.353684 -87.997609 30.116576 \n", "2016-01-04 00:00:00+00:00 9.008349 -123.356458 -94.903324 30.181858 \n", "2016-01-05 00:00:00+00:00 9.008894 -123.360976 -94.847994 30.230211 \n", "... ... ... ... ... \n", "2016-12-27 00:00:00+00:00 9.712236 -123.360505 -68.746821 29.976041 \n", "2016-12-28 00:00:00+00:00 9.585216 -123.356184 -73.063848 30.166577 \n", "2016-12-29 00:00:00+00:00 9.532530 -123.354214 -73.855145 30.100272 \n", "2016-12-30 00:00:00+00:00 9.512147 -123.354540 -74.871472 30.090665 \n", "2016-12-31 00:00:00+00:00 9.475800 -123.354114 -83.349381 30.150163 \n", "\n", " init_temp init_lat \n", "2016-01-01 00:00:00+00:00 8.910218 48.924583 \n", "2016-01-02 00:00:00+00:00 8.886164 48.921065 \n", "2016-01-03 00:00:00+00:00 8.843807 48.921006 \n", "2016-01-04 00:00:00+00:00 8.897932 48.919276 \n", "2016-01-05 00:00:00+00:00 8.885795 48.917318 \n", "... ... ... \n", "2016-12-27 00:00:00+00:00 8.786927 48.939701 \n", "2016-12-28 00:00:00+00:00 8.816433 48.945536 \n", "2016-12-29 00:00:00+00:00 8.785727 48.935865 \n", "2016-12-30 00:00:00+00:00 8.789643 48.929824 \n", "2016-12-31 00:00:00+00:00 8.804370 48.924302 \n", "\n", "[366 rows x 10 columns]" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "bb564cd3-3b0a-4e43-ab8c-ede8acc34d2d", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "3.11 mocsy", "language": "python", "name": "py311_mocsy" }, "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.11.6" } }, "nbformat": 4, "nbformat_minor": 5 }