{ "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", " | transport | \n", "final_age | \n", "final_depth | \n", "final_salt | \n", "final_temp | \n", "final_lon | \n", "init_depth | \n", "init_salt | \n", "init_temp | \n", "init_lat | \n", "
---|---|---|---|---|---|---|---|---|---|---|
2016-01-01 00:00:00+00:00 | \n", "5291.494251 | \n", "21.208800 | \n", "-38.681566 | \n", "31.492639 | \n", "8.969030 | \n", "-123.347175 | \n", "-84.327773 | \n", "30.115465 | \n", "8.910218 | \n", "48.924583 | \n", "
2016-01-02 00:00:00+00:00 | \n", "5550.015639 | \n", "20.577325 | \n", "-39.410060 | \n", "31.400583 | \n", "8.985300 | \n", "-123.355776 | \n", "-88.367499 | \n", "30.130296 | \n", "8.886164 | \n", "48.921065 | \n", "
2016-01-03 00:00:00+00:00 | \n", "5660.882716 | \n", "21.633671 | \n", "-38.561435 | \n", "31.366363 | \n", "8.996675 | \n", "-123.353684 | \n", "-87.997609 | \n", "30.116576 | \n", "8.843807 | \n", "48.921006 | \n", "
2016-01-04 00:00:00+00:00 | \n", "6210.446689 | \n", "20.362758 | \n", "-37.484604 | \n", "31.308099 | \n", "9.008349 | \n", "-123.356458 | \n", "-94.903324 | \n", "30.181858 | \n", "8.897932 | \n", "48.919276 | \n", "
2016-01-05 00:00:00+00:00 | \n", "9561.456084 | \n", "18.178807 | \n", "-42.191863 | \n", "31.301096 | \n", "9.008894 | \n", "-123.360976 | \n", "-94.847994 | \n", "30.230211 | \n", "8.885795 | \n", "48.917318 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
2016-12-27 00:00:00+00:00 | \n", "9239.320327 | \n", "17.864120 | \n", "-58.749614 | \n", "31.771817 | \n", "9.712236 | \n", "-123.360505 | \n", "-68.746821 | \n", "29.976041 | \n", "8.786927 | \n", "48.939701 | \n", "
2016-12-28 00:00:00+00:00 | \n", "13199.439713 | \n", "16.501642 | \n", "-57.670818 | \n", "31.860888 | \n", "9.585216 | \n", "-123.356184 | \n", "-73.063848 | \n", "30.166577 | \n", "8.816433 | \n", "48.945536 | \n", "
2016-12-29 00:00:00+00:00 | \n", "15173.529359 | \n", "16.303234 | \n", "-57.925839 | \n", "31.914344 | \n", "9.532530 | \n", "-123.354214 | \n", "-73.855145 | \n", "30.100272 | \n", "8.785727 | \n", "48.935865 | \n", "
2016-12-30 00:00:00+00:00 | \n", "16451.476423 | \n", "16.888965 | \n", "-59.062236 | \n", "31.941152 | \n", "9.512147 | \n", "-123.354540 | \n", "-74.871472 | \n", "30.090665 | \n", "8.789643 | \n", "48.929824 | \n", "
2016-12-31 00:00:00+00:00 | \n", "19745.119058 | \n", "17.259144 | \n", "-59.706419 | \n", "31.925776 | \n", "9.475800 | \n", "-123.354114 | \n", "-83.349381 | \n", "30.150163 | \n", "8.804370 | \n", "48.924302 | \n", "
366 rows × 10 columns
\n", "