Skip to content

Commit

Permalink
Update floatoftheday.ipynb
Browse files Browse the repository at this point in the history
  • Loading branch information
gmaze committed Nov 10, 2023
1 parent 77ebe5a commit 995acab
Showing 1 changed file with 63 additions and 38 deletions.
101 changes: 63 additions & 38 deletions floatoftheday.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
"tags": []
},
"source": [
"# twitter python lib outdated with the new Twitter v2 API !\n",
"# Tweet Argo float of the day, v4.2\n",
"\n",
"# https://twitter.com/argobot84\n",
"https://twitter.com/argobot84\n",
"\n",
"# https://github.com/euroargodev/floatoftheday"
"https://github.com/euroargodev/floatoftheday"
]
},
{
Expand All @@ -28,16 +28,7 @@
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/gmaze/miniconda3/envs/argobot/lib/python3.8/site-packages/pyproj/__init__.py:89: UserWarning: pyproj unable to set database path.\n",
" _pyproj_global_context_initialize()\n"
]
}
],
"outputs": [],
"source": [
"import os\n",
"from pathlib import Path\n",
Expand Down Expand Up @@ -146,6 +137,7 @@
"ipykernel : 6.25.2 \n",
"ipywidgets : 8.1.1 \n",
"matplotlib : 3.4.3 \n",
"pyproj : 3.5.0 \n",
"seaborn : 0.12.2 \n",
"\n",
"INSTALLED VERSIONS: DEV\n",
Expand All @@ -165,9 +157,12 @@
"pytest_cov : - \n",
"pytest_env : - \n",
"pytest_localftpserver: - \n",
"pytest_reportlog: - \n",
"setuptools : 68.2.2 \n",
"sphinx : - \n"
"sphinx : - \n",
"\n",
"INSTALLED VERSIONS: PIP\n",
"-----------------------\n",
"pytest-reportlog: - \n"
]
}
],
Expand All @@ -183,6 +178,15 @@
"# Functions"
]
},
{
"cell_type": "markdown",
"metadata": {
"tags": []
},
"source": [
"## Loading data"
]
},
{
"cell_type": "code",
"execution_count": 3,
Expand Down Expand Up @@ -296,6 +300,15 @@
" return week_data, this_df, ds"
]
},
{
"cell_type": "markdown",
"metadata": {
"tags": []
},
"source": [
"## Plots"
]
},
{
"cell_type": "code",
"execution_count": 4,
Expand Down Expand Up @@ -522,6 +535,15 @@
" "
]
},
{
"cell_type": "markdown",
"metadata": {
"tags": []
},
"source": [
"## Tweet"
]
},
{
"cell_type": "code",
"execution_count": 5,
Expand Down Expand Up @@ -565,12 +587,11 @@
" \n",
" # when = pd.to_datetime(str(this_ds['TIME'].values[0])).strftime('%A %d of %B %Y, %H:%M:%S UTC')\n",
" # where = \"%0.3f%s, %0.3f%s\" % (np.abs(this_ds['LATITUDE']), this_ds.attrs['hemisphere'], np.abs(this_ds['LONGITUDE']), this_ds.attrs['quadrant'])\n",
" long_title = \"▶ Float %s, Cycle %i 🗓%s 🗺%s 📏%i measurements 🤖%s 🔬%s 💳%s\" % (\n",
" long_title = \"▶ Float %s, Cycle %i 🗓%s 🗺%s 📏%i measurements 🤖%s 💳%s\" % (\n",
" wmo, cyc,\n",
" when, where,\n",
" len(this_ds['N_LEVELS']),\n",
" \"%s float\" % this_ds.attrs['float_model'].split(\" \")[0],\n",
" this_ds.attrs['pi_name'].strip().title(),\n",
" \"%s\" % this_ds.attrs['float_model'].split(\" \")[0],\n",
" this_ds.attrs['project_name'].strip())\n",
"\n",
" # Could try to add a link to convert UTC to local, eg:\n",
Expand All @@ -579,8 +600,9 @@
"\n",
" caption = (f'Here is the Argo profile of the last 24 hours 🎉\\n'\n",
" f'{long_title}\\n'\n",
" f'#argofloat, #argofloats, '\n",
" f'https://fleetmonitoring.euro-argo.eu/float/{wmo} '\n",
" f'#argofloat')\n",
" )\n",
"\n",
" if len(caption) > 280:\n",
" caption = caption[0:280-10-1] + '\\u2026'\n",
Expand Down Expand Up @@ -633,8 +655,11 @@
"output_type": "stream",
"text": [
"Loading profile index ...\n",
"Loading profile: 2903693 147\n",
"Loading profile: 3902554 7\n",
"1/10: Succeeded in downloading this data !\n",
"1/10: An error happened when processing this data\n",
"Loading profile: 5906968 40\n",
"2/10: Succeeded in downloading this data !\n",
"Post-processing data...\n"
]
}
Expand Down Expand Up @@ -665,7 +690,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"27.992369993701004 21.191149620986607\n",
"27.94464383171635 20.493276089799224\n",
"['TEMP.png', 'PSAL.png', 'TS.png', 'MAP.png']\n"
]
}
Expand Down Expand Up @@ -743,33 +768,33 @@
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>334</th>\n",
" <td>jma/2903693/profiles/R2903693_147.nc</td>\n",
" <td>2023-10-02 05:59:51</td>\n",
" <td>32.491</td>\n",
" <td>157.927</td>\n",
" <th>388</th>\n",
" <td>kordi/5906968/profiles/R5906968_040.nc</td>\n",
" <td>2023-11-09 06:13:29</td>\n",
" <td>16.783</td>\n",
" <td>134.383</td>\n",
" <td>P</td>\n",
" <td>844</td>\n",
" <td>JA</td>\n",
" <td>2023-10-02 09:54:51</td>\n",
" <td>2903693</td>\n",
" <td>147</td>\n",
" <td>JMA, Japan</td>\n",
" <td>KO</td>\n",
" <td>2023-11-09 11:00:27</td>\n",
" <td>5906968</td>\n",
" <td>40</td>\n",
" <td>KORDI, Korea</td>\n",
" <td>Unknown</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" file date latitude \\\n",
"334 jma/2903693/profiles/R2903693_147.nc 2023-10-02 05:59:51 32.491 \n",
" file date latitude \\\n",
"388 kordi/5906968/profiles/R5906968_040.nc 2023-11-09 06:13:29 16.783 \n",
"\n",
" longitude ocean profiler_code institution_code date_update \\\n",
"334 157.927 P 844 JA 2023-10-02 09:54:51 \n",
"388 134.383 P 844 KO 2023-11-09 11:00:27 \n",
"\n",
" wmo cyc institution profiler \n",
"334 2903693 147 JMA, Japan Unknown "
" wmo cyc institution profiler \n",
"388 5906968 40 KORDI, Korea Unknown "
]
},
"execution_count": 8,
Expand Down Expand Up @@ -802,13 +827,13 @@
"name": "stdout",
"output_type": "stream",
"text": [
"https://twitter.com/user/status/1709188304522903960\n"
"https://twitter.com/user/status/1722892051472097488\n"
]
},
{
"data": {
"text/plain": [
"Response(data={'edit_history_tweet_ids': ['1709188304522903960'], 'id': '1709188304522903960', 'text': 'Here is the Argo profile of the last 24 hours 🎉\\n▶ Float 2903693, Cycle 147 🗓Monday 02 of October 2023, 05:59:51 UTC 🗺32.491N, 157.927E 📏86 measurements 🤖ARVOR float 🔬Jma 💳Routine-JMA\\nhttps://t.co/tivbrdsQB3 #argofloat https://t.co/VQI2YDLF7Z'}, includes={}, errors=[], meta={})"
"Response(data={'edit_history_tweet_ids': ['1722892051472097488'], 'id': '1722892051472097488', 'text': 'Here is the Argo profile of the last 24 hours 🎉\\n▶ Float 5906968, Cycle 40 🗓Thursday 09 of November 2023, 06:13:29 UTC 🗺16.783N, 134.383E 📏92 measurements 🤖ARVOR 💳Argo KIOST\\n#argofloat, #argofloats, https://t.co/5zBhIStr0n https://t.co/yQyobxDvVj'}, includes={}, errors=[], meta={})"
]
},
"execution_count": 9,
Expand Down

0 comments on commit 995acab

Please sign in to comment.