From b3356184e74ab332cf3aca69a65ba313c7590dfb Mon Sep 17 00:00:00 2001 From: turnerm Date: Mon, 22 Aug 2022 23:15:07 +0200 Subject: [PATCH 01/17] Download hindcasts --- .../hindcasts/download_ecmwf_hindcasts.ipynb | 396 ++++++++++++++++++ 1 file changed, 396 insertions(+) create mode 100644 analysis/hindcasts/download_ecmwf_hindcasts.ipynb diff --git a/analysis/hindcasts/download_ecmwf_hindcasts.ipynb b/analysis/hindcasts/download_ecmwf_hindcasts.ipynb new file mode 100644 index 0000000..0388b40 --- /dev/null +++ b/analysis/hindcasts/download_ecmwf_hindcasts.ipynb @@ -0,0 +1,396 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "47c17dcd-992a-40e6-9fb2-b5870a386561", + "metadata": {}, + "source": [ + "## Download ECMWF xml" + ] + }, + { + "cell_type": "code", + "execution_count": 113, + "id": "c686d0bd-5b1a-4df9-8a53-491f6452654e", + "metadata": {}, + "outputs": [], + "source": [ + "import sys, os\n", + "import requests\n", + "import getpass\n", + "from datetime import datetime\n", + "from pathlib import Path\n", + "import re\n", + "\n", + "import pandas as pd\n", + "import xml.etree.ElementTree as ET\n", + "from dateutil import rrule" + ] + }, + { + "cell_type": "code", + "execution_count": 85, + "id": "4049d1fa-7f65-41de-92d5-d29bc90c8bad", + "metadata": {}, + "outputs": [], + "source": [ + "save_dir = Path(\"/home/turnerm/sync/aa_repo_data/Data/public/exploration/phl/ecmwf_hindcast\")" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "3ed771f4-b602-4090-9f4e-b73ebbf412f8", + "metadata": {}, + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "email: monica.turner@un.org\n", + "password: mon246\n" + ] + } + ], + "source": [ + "email = input('email: ')\n", + "pswd = input('password: ')" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "bc5eec75-3ffd-4f3c-9541-ee0e17da0059", + "metadata": {}, + "outputs": [], + "source": [ + "values = {'email' : email, 'passwd' : pswd, 'action' : 'login'}\n", + "login_url = 'https://rda.ucar.edu/cgi-bin/login'" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "97cdf4df-0a65-4f09-91c0-5e2ee7e039fe", + "metadata": {}, + "outputs": [], + "source": [ + "ret = requests.post(login_url, data=values)\n", + "if ret.status_code != 200:\n", + " print('Bad Authentication')\n", + " print(ret.text)\n", + " exit(1)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1f931514-e7a2-4063-a9e6-38a3b55b5d9a", + "metadata": {}, + "outputs": [], + "source": [ + "dspath = 'https://rda.ucar.edu/data/ds330.3/'\n", + "date_list = rrule.rrule(rrule.HOURLY, dtstart=datetime(2006, 10, 1, 0, 0, 0), interval=12)\n", + "verbose = False\n", + "\n", + "for date in date_list:\n", + " ymd = date.strftime(\"%Y%m%d\")\n", + " ymdhms = date.strftime(\"%Y%m%d%H%M%S\")\n", + " server = \"test\" if date < datetime(2008, 8, 1) else \"prod\"\n", + " file = f'ecmf/{date.year}/{ymd}/z_tigge_c_ecmf_{ymdhms}_ifs_glob_{server}_all_glo.xml'\n", + " filename = dspath + file\n", + " outfile = save_dir / \"xml\" / os.path.basename(filename)\n", + " # Don't download if exists already\n", + " if outfile.exists():\n", + " if verbose:\n", + " print(f'{file} already exists')\n", + " continue\n", + " req = requests.get(filename, cookies = ret.cookies, allow_redirects=True)\n", + " if req.status_code != 200:\n", + " if verbose:\n", + " print(f'{file} invalid URL')\n", + " continue\n", + " if verbose:\n", + " print(f'{file} downloading')\n", + " open(outfile, 'wb').write(req.content)\n" + ] + }, + { + "cell_type": "markdown", + "id": "f0daafc8-56ab-4af3-b2d6-048f6224450f", + "metadata": { + "tags": [] + }, + "source": [ + "## Get typhoon names" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "id": "433c65c3-30c7-4668-be8e-7ba7ebb5083b", + "metadata": {}, + "outputs": [], + "source": [ + "filename = \"../../IBF-Typhoon-model/data/wind_data/input/typhoon_events.csv\"\n", + "df_typhoons = pd.read_csv(filename)\n", + "df_typhoons.columns = [\"local\", \"international\", \"year\"]\n", + "for cname in [\"local\", \"international\"]:\n", + " df_typhoons[cname] = df_typhoons[cname].str.lower()" + ] + }, + { + "cell_type": "markdown", + "id": "a13a63a1-e9b4-4c04-a528-e666d207e3b1", + "metadata": {}, + "source": [ + "## Convert to CSV" + ] + }, + { + "cell_type": "code", + "execution_count": 112, + "id": "5f04a32e-a0d2-4402-b3f3-44f64d3a1556", + "metadata": { + "tags": [] + }, + "outputs": [ + { + "ename": "KeyboardInterrupt", + "evalue": "", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", + "Input \u001b[0;32mIn [112]\u001b[0m, in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 2\u001b[0m filename_list \u001b[38;5;241m=\u001b[39m \u001b[38;5;28msorted\u001b[39m(\u001b[38;5;28mlist\u001b[39m(Path(save_dir \u001b[38;5;241m/\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mxml\u001b[39m\u001b[38;5;124m\"\u001b[39m)\u001b[38;5;241m.\u001b[39mglob(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m*.xml\u001b[39m\u001b[38;5;124m'\u001b[39m)))\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m filename \u001b[38;5;129;01min\u001b[39;00m filename_list:\n\u001b[0;32m----> 4\u001b[0m \u001b[43mxml2csv\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfilename\u001b[49m\u001b[43m)\u001b[49m\n", + "Input \u001b[0;32mIn [111]\u001b[0m, in \u001b[0;36mxml2csv\u001b[0;34m(filename)\u001b[0m\n\u001b[1;32m 42\u001b[0m \u001b[38;5;66;03m# Save to CSV\u001b[39;00m\n\u001b[1;32m 43\u001b[0m outfile \u001b[38;5;241m=\u001b[39m save_dir \u001b[38;5;241m/\u001b[39m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcsv/\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mcyclone_name\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m_all.csv\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m---> 44\u001b[0m \u001b[43mpd\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mDataFrame\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtem_dic1\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mindex\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241m.\u001b[39mto_csv(outfile, mode\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124ma\u001b[39m\u001b[38;5;124m'\u001b[39m, header\u001b[38;5;241m=\u001b[39m\u001b[38;5;129;01mnot\u001b[39;00m os\u001b[38;5;241m.\u001b[39mpath\u001b[38;5;241m.\u001b[39mexists(outfile), index\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m)\n", + "File \u001b[0;32m~/sync/Typhoon-Impact-based-forecasting-model/venv/lib/python3.8/site-packages/pandas/core/frame.py:614\u001b[0m, in \u001b[0;36mDataFrame.__init__\u001b[0;34m(self, data, index, columns, dtype, copy)\u001b[0m\n\u001b[1;32m 608\u001b[0m mgr \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_init_mgr(\n\u001b[1;32m 609\u001b[0m data, axes\u001b[38;5;241m=\u001b[39m{\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mindex\u001b[39m\u001b[38;5;124m\"\u001b[39m: index, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcolumns\u001b[39m\u001b[38;5;124m\"\u001b[39m: columns}, dtype\u001b[38;5;241m=\u001b[39mdtype, copy\u001b[38;5;241m=\u001b[39mcopy\n\u001b[1;32m 610\u001b[0m )\n\u001b[1;32m 612\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(data, \u001b[38;5;28mdict\u001b[39m):\n\u001b[1;32m 613\u001b[0m \u001b[38;5;66;03m# GH#38939 de facto copy defaults to False only in non-dict cases\u001b[39;00m\n\u001b[0;32m--> 614\u001b[0m mgr \u001b[38;5;241m=\u001b[39m \u001b[43mdict_to_mgr\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdata\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mindex\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcolumns\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdtype\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdtype\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcopy\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcopy\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtyp\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmanager\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 615\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(data, ma\u001b[38;5;241m.\u001b[39mMaskedArray):\n\u001b[1;32m 616\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mnumpy\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mma\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mmrecords\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mmrecords\u001b[39;00m\n", + "File \u001b[0;32m~/sync/Typhoon-Impact-based-forecasting-model/venv/lib/python3.8/site-packages/pandas/core/internals/construction.py:449\u001b[0m, in \u001b[0;36mdict_to_mgr\u001b[0;34m(data, index, columns, dtype, typ, copy)\u001b[0m\n\u001b[1;32m 446\u001b[0m \u001b[38;5;66;03m# GH#24096 need copy to be deep for datetime64tz case\u001b[39;00m\n\u001b[1;32m 447\u001b[0m \u001b[38;5;66;03m# TODO: See if we can avoid these copies\u001b[39;00m\n\u001b[1;32m 448\u001b[0m arrays \u001b[38;5;241m=\u001b[39m [arr \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(arr, Index) \u001b[38;5;28;01melse\u001b[39;00m arr\u001b[38;5;241m.\u001b[39m_data \u001b[38;5;28;01mfor\u001b[39;00m arr \u001b[38;5;129;01min\u001b[39;00m arrays]\n\u001b[0;32m--> 449\u001b[0m arrays \u001b[38;5;241m=\u001b[39m [\n\u001b[1;32m 450\u001b[0m arr \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m is_datetime64tz_dtype(arr) \u001b[38;5;28;01melse\u001b[39;00m arr\u001b[38;5;241m.\u001b[39mcopy() \u001b[38;5;28;01mfor\u001b[39;00m arr \u001b[38;5;129;01min\u001b[39;00m arrays\n\u001b[1;32m 451\u001b[0m ]\n\u001b[1;32m 453\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m copy:\n\u001b[1;32m 454\u001b[0m \u001b[38;5;66;03m# arrays_to_mgr (via form_blocks) won't make copies for EAs\u001b[39;00m\n\u001b[1;32m 455\u001b[0m \u001b[38;5;66;03m# dtype attr check to exclude EADtype-castable strs\u001b[39;00m\n\u001b[1;32m 456\u001b[0m arrays \u001b[38;5;241m=\u001b[39m [\n\u001b[1;32m 457\u001b[0m x\n\u001b[1;32m 458\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mhasattr\u001b[39m(x, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdtype\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(x\u001b[38;5;241m.\u001b[39mdtype, ExtensionDtype)\n\u001b[1;32m 459\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m x\u001b[38;5;241m.\u001b[39mcopy()\n\u001b[1;32m 460\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m x \u001b[38;5;129;01min\u001b[39;00m arrays\n\u001b[1;32m 461\u001b[0m ]\n", + "File \u001b[0;32m~/sync/Typhoon-Impact-based-forecasting-model/venv/lib/python3.8/site-packages/pandas/core/internals/construction.py:450\u001b[0m, in \u001b[0;36m\u001b[0;34m(.0)\u001b[0m\n\u001b[1;32m 446\u001b[0m \u001b[38;5;66;03m# GH#24096 need copy to be deep for datetime64tz case\u001b[39;00m\n\u001b[1;32m 447\u001b[0m \u001b[38;5;66;03m# TODO: See if we can avoid these copies\u001b[39;00m\n\u001b[1;32m 448\u001b[0m arrays \u001b[38;5;241m=\u001b[39m [arr \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(arr, Index) \u001b[38;5;28;01melse\u001b[39;00m arr\u001b[38;5;241m.\u001b[39m_data \u001b[38;5;28;01mfor\u001b[39;00m arr \u001b[38;5;129;01min\u001b[39;00m arrays]\n\u001b[1;32m 449\u001b[0m arrays \u001b[38;5;241m=\u001b[39m [\n\u001b[0;32m--> 450\u001b[0m arr \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[43mis_datetime64tz_dtype\u001b[49m\u001b[43m(\u001b[49m\u001b[43marr\u001b[49m\u001b[43m)\u001b[49m \u001b[38;5;28;01melse\u001b[39;00m arr\u001b[38;5;241m.\u001b[39mcopy() \u001b[38;5;28;01mfor\u001b[39;00m arr \u001b[38;5;129;01min\u001b[39;00m arrays\n\u001b[1;32m 451\u001b[0m ]\n\u001b[1;32m 453\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m copy:\n\u001b[1;32m 454\u001b[0m \u001b[38;5;66;03m# arrays_to_mgr (via form_blocks) won't make copies for EAs\u001b[39;00m\n\u001b[1;32m 455\u001b[0m \u001b[38;5;66;03m# dtype attr check to exclude EADtype-castable strs\u001b[39;00m\n\u001b[1;32m 456\u001b[0m arrays \u001b[38;5;241m=\u001b[39m [\n\u001b[1;32m 457\u001b[0m x\n\u001b[1;32m 458\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mhasattr\u001b[39m(x, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdtype\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(x\u001b[38;5;241m.\u001b[39mdtype, ExtensionDtype)\n\u001b[1;32m 459\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m x\u001b[38;5;241m.\u001b[39mcopy()\n\u001b[1;32m 460\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m x \u001b[38;5;129;01min\u001b[39;00m arrays\n\u001b[1;32m 461\u001b[0m ]\n", + "File \u001b[0;32m~/sync/Typhoon-Impact-based-forecasting-model/venv/lib/python3.8/site-packages/pandas/core/dtypes/common.py:385\u001b[0m, in \u001b[0;36mis_datetime64tz_dtype\u001b[0;34m(arr_or_dtype)\u001b[0m\n\u001b[1;32m 383\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m arr_or_dtype \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 384\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[0;32m--> 385\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mDatetimeTZDtype\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mis_dtype\u001b[49m\u001b[43m(\u001b[49m\u001b[43marr_or_dtype\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/sync/Typhoon-Impact-based-forecasting-model/venv/lib/python3.8/site-packages/pandas/core/dtypes/base.py:289\u001b[0m, in \u001b[0;36mExtensionDtype.is_dtype\u001b[0;34m(cls, dtype)\u001b[0m\n\u001b[1;32m 265\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 266\u001b[0m \u001b[38;5;124;03mCheck if we match 'dtype'.\u001b[39;00m\n\u001b[1;32m 267\u001b[0m \n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 285\u001b[0m \u001b[38;5;124;03m conditions is true for ``dtype.dtype``.\u001b[39;00m\n\u001b[1;32m 286\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 287\u001b[0m dtype \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mgetattr\u001b[39m(dtype, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdtype\u001b[39m\u001b[38;5;124m\"\u001b[39m, dtype)\n\u001b[0;32m--> 289\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28;43misinstance\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mdtype\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m(\u001b[49m\u001b[43mABCSeries\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mABCIndex\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mABCDataFrame\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdtype\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m:\n\u001b[1;32m 290\u001b[0m \u001b[38;5;66;03m# https://github.com/pandas-dev/pandas/issues/22960\u001b[39;00m\n\u001b[1;32m 291\u001b[0m \u001b[38;5;66;03m# avoid passing data to `construct_from_string`. This could\u001b[39;00m\n\u001b[1;32m 292\u001b[0m \u001b[38;5;66;03m# cause a FutureWarning from numpy about failing elementwise\u001b[39;00m\n\u001b[1;32m 293\u001b[0m \u001b[38;5;66;03m# comparison from, e.g., comparing DataFrame == 'category'.\u001b[39;00m\n\u001b[1;32m 294\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[1;32m 295\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m dtype \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n", + "File \u001b[0;32m~/sync/Typhoon-Impact-based-forecasting-model/venv/lib/python3.8/site-packages/pandas/core/dtypes/generic.py:43\u001b[0m, in \u001b[0;36mcreate_pandas_abc_type.._check\u001b[0;34m(cls, inst)\u001b[0m\n\u001b[1;32m 39\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcreate_pandas_abc_type\u001b[39m(name, attr, comp):\n\u001b[1;32m 40\u001b[0m \n\u001b[1;32m 41\u001b[0m \u001b[38;5;66;03m# https://github.com/python/mypy/issues/1006\u001b[39;00m\n\u001b[1;32m 42\u001b[0m \u001b[38;5;66;03m# error: 'classmethod' used with a non-method\u001b[39;00m\n\u001b[0;32m---> 43\u001b[0m \u001b[38;5;129m@classmethod\u001b[39m \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 44\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_check\u001b[39m(\u001b[38;5;28mcls\u001b[39m, inst) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;28mbool\u001b[39m:\n\u001b[1;32m 45\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mgetattr\u001b[39m(inst, attr, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m_typ\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;129;01min\u001b[39;00m comp\n\u001b[1;32m 47\u001b[0m dct \u001b[38;5;241m=\u001b[39m {\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m__instancecheck__\u001b[39m\u001b[38;5;124m\"\u001b[39m: _check, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m__subclasscheck__\u001b[39m\u001b[38;5;124m\"\u001b[39m: _check}\n", + "\u001b[0;31mKeyboardInterrupt\u001b[0m: " + ] + } + ], + "source": [ + "# Get list of filenames\n", + "filename_list = sorted(list(Path(save_dir / \"xml\").glob('*.xml')))\n", + "for filename in filename_list:\n", + " xml2csv(filename)" + ] + }, + { + "cell_type": "code", + "execution_count": 111, + "id": "58f882ba-15d3-4aff-a549-9b2d31441b94", + "metadata": {}, + "outputs": [], + "source": [ + "def xml2csv(filename):\n", + " #print(f\"{filename}\")\n", + " tree = ET.parse(filename)\n", + " root = tree.getroot()\n", + " try:\n", + " model_name=root.find('header/generatingApplication/model/name').text \n", + " except AttributeError:\n", + " model_name = ''\n", + "\n", + " prod_center=root.find('header/productionCenter').text\n", + " baseTime=root.find('header/baseTime').text\n", + "\n", + " ## Create one dictonary for each time point, and append it to a list\n", + " for members in root.findall('data'):\n", + " mtype=members.get('type')\n", + " if mtype not in ['forecast', 'ensembleForecast']:\n", + " continue\n", + " for members2 in members.findall('disturbance'):\n", + " cyclone_name = [name.text.lower().strip() for name in members2.findall('cycloneName')]\n", + " if not cyclone_name:\n", + " continue\n", + " cyclone_name = cyclone_name[0].lower()\n", + " if cyclone_name not in list(df_typhoons[\"international\"]):\n", + " continue\n", + " # print(f\"Found typhoon {cyclone_name}\")\n", + " for members3 in members2.findall('fix'):\n", + " tem_dic = {}\n", + " tem_dic['mtype']=[mtype]\n", + " tem_dic['product']=[re.sub('\\s+',' ',prod_center).strip().lower()]\n", + " tem_dic['cyc_number'] = [name.text for name in members2.findall('cycloneNumber')]\n", + " tem_dic['ensemble']=[members.get('member')]\n", + " tem_dic['speed'] = [name.text for name in members3.findall('cycloneData/maximumWind/speed')]\n", + " tem_dic['pressure'] = [name.text for name in members3.findall('cycloneData/minimumPressure/pressure')]\n", + " time = [name.text for name in members3.findall('validTime')]\n", + " tem_dic['time'] = ['/'.join(time[0].split('T')[0].split('-'))+', '+time[0].split('T')[1][:-1]]\n", + " tem_dic['lat'] = [name.text for name in members3.findall('latitude')]\n", + " tem_dic['lon']= [name.text for name in members3.findall('longitude')] \n", + " tem_dic['lead_time']=[members3.get('hour')]\n", + " tem_dic['forecast_time'] = ['/'.join(baseTime.split('T')[0].split('-'))+', '+baseTime.split('T')[1][:-1]]\n", + " tem_dic1 = dict( [(k,''.join(str(e).lower().strip() for e in v)) for k,v in tem_dic.items()])\n", + " # Save to CSV\n", + " outfile = save_dir / f\"csv/{cyclone_name}_all.csv\"\n", + " pd.DataFrame(tem_dic1, index=[0]).to_csv(outfile, mode='a', header=not os.path.exists(outfile), index=False)\n", + " " + ] + }, + { + "cell_type": "markdown", + "id": "93bb0820-ca17-4d56-aab8-3adaf813ff5f", + "metadata": {}, + "source": [ + "## AKI CSVs" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a25a3746-3d84-4bd9-8c9f-ed6d3102040f", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "a8b92a22-ac21-4214-bb70-291077f2eb66", + "metadata": {}, + "outputs": [], + "source": [ + "import pandas as pd\n", + "import xarray as xr" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "0a3b08fb-3054-47f5-879a-ecc403e22356", + "metadata": {}, + "outputs": [], + "source": [ + "data_dir = \"/home/turnerm/sync/aa_repo_data/Data/public/exploration/phl/ecmwf_forecast/CSVS2\"" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "1959216f-13e6-42b1-adb3-fb33f85bd076", + "metadata": {}, + "outputs": [], + "source": [ + "typhoon_name = \"rai\"\n", + "df = pd.read_csv(f\"{data_dir}/{typhoon_name}_all.csv\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "88cb811d-5ef5-4a92-a5ad-5c72d3cb29e8", + "metadata": {}, + "outputs": [], + "source": [ + "track = xr.Dataset(\n", + " data_vars={\n", + " \"time_step\": (\"time\", np.full_like(df.forecast_time, 3, dtype=float)),\n", + " \"max_sustained_wind\": (\n", + " \"time\", df.cyc_speed, # conversion from kn to meter/s\n", + " ),\n", + " #\"environmental_pressure\": (\n", + " # \"time\",\n", + " # [1010]*len(dta_dict['SID']),\n", + " #),\n", + " #\"central_pressure\": (\"time\", dta_dict['USA_PRES']),\n", + " \"lat\": (\"time\", df.lat),\n", + " \"lon\": (\"time\", df.lon),\n", + " #\"radius_max_wind\": (\"time\",dta_dict['USA_RMW']),\n", + " #\"radius_oci\": (\"time\", [np.nan]*len(dta_dict['USA_RMW'])),\n", + " \"basin\": (\"time\", ['WP']*len(df)),\n", + "\n", + "\n", + " },\n", + " coords={\"time\": pd.date_range(\"1980-01-01\", periods=len(dta_dict['SID']), freq=\"3H\"),},\n", + " attrs={\n", + " \"max_sustained_wind_unit\": \"m/s\",\n", + " \"central_pressure_unit\": \"mb\",\n", + " \"name\": typhoon,\n", + " \"sid\": typhoon, # +str(forcast_df.ensemble_number),\n", + " \"orig_event_flag\": True,\n", + " \"data_provider\": 'ibtracs_usa',\n", + " \"id_no\": typhoon,\n", + " \"basin\": 'wp',\n", + " \"category\": dta_dict['Catagory'][0], \n", + "\n", + " },\n", + ")\n", + "track = track.set_coords([\"lat\", \"lon\"])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f788ce75-0684-4a3d-9aa2-e7ac161a29ce", + "metadata": {}, + "outputs": [], + "source": [ + "\n", + " dta_dict=data.query('SID==@typhoon').to_dict('list') \n", + " track = xr.Dataset(\n", + " data_vars={\n", + " \"time_step\": (\"time\", np.full_like(dta_dict['Timestep'], 3, dtype=float)),\n", + " \"max_sustained_wind\": (\n", + " \"time\", dta_dict['USA_WIND'], # conversion from kn to meter/s\n", + " ),\n", + " \"environmental_pressure\": (\n", + " \"time\",\n", + " [1010]*len(dta_dict['SID']),\n", + " ),\n", + " \"central_pressure\": (\"time\", dta_dict['USA_PRES']),\n", + " \"lat\": (\"time\", dta_dict['LAT']),\n", + " \"lon\": (\"time\", dta_dict['LON']),\n", + " \"radius_max_wind\": (\"time\",dta_dict['USA_RMW']),\n", + " \"radius_oci\": (\"time\", [np.nan]*len(dta_dict['USA_RMW'])),\n", + " \"basin\": (\"time\", ['WP']*len(dta_dict['USA_RMW'])),\n", + "\n", + "\n", + " },\n", + " coords={\"time\": pd.date_range(\"1980-01-01\", periods=len(dta_dict['SID']), freq=\"3H\"),},\n", + " attrs={\n", + " \"max_sustained_wind_unit\": \"m/s\",\n", + " \"central_pressure_unit\": \"mb\",\n", + " \"name\": typhoon,\n", + " \"sid\": typhoon, # +str(forcast_df.ensemble_number),\n", + " \"orig_event_flag\": True,\n", + " \"data_provider\": 'ibtracs_usa',\n", + " \"id_no\": typhoon,\n", + " \"basin\": 'wp',\n", + " \"category\": dta_dict['Catagory'][0], \n", + "\n", + " },\n", + " )\n", + " track = track.set_coords([\"lat\", \"lon\"])\n", + " return track" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "typhoon", + "language": "python", + "name": "typhoon" + }, + "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.8.10" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From 3d6a1bc4820ac2969ff0b05e03375ea28d258292 Mon Sep 17 00:00:00 2001 From: turnerm Date: Mon, 22 Aug 2022 23:32:29 +0200 Subject: [PATCH 02/17] Switching to scripts --- analysis/hindcasts/01_download_hindcasts.py | 49 ++++++ analysis/hindcasts/02_convert_to_csv.py | 69 ++++++++ .../hindcasts/download_ecmwf_hindcasts.ipynb | 150 +++++------------- 3 files changed, 154 insertions(+), 114 deletions(-) create mode 100644 analysis/hindcasts/01_download_hindcasts.py create mode 100644 analysis/hindcasts/02_convert_to_csv.py diff --git a/analysis/hindcasts/01_download_hindcasts.py b/analysis/hindcasts/01_download_hindcasts.py new file mode 100644 index 0000000..3bcdb0d --- /dev/null +++ b/analysis/hindcasts/01_download_hindcasts.py @@ -0,0 +1,49 @@ +import os +import requests +from datetime import datetime +from pathlib import Path + +from dateutil import rrule + + +save_dir = Path("/home/turnerm/sync/aa_repo_data/Data/public/exploration/phl/ecmwf_hindcast") + +email = input('email: ') +pswd = input('password: ') + +values = {'email' : email, 'passwd' : pswd, 'action' : 'login'} +login_url = 'https://rda.ucar.edu/cgi-bin/login' + +ret = requests.post(login_url, data=values) +if ret.status_code != 200: + print('Bad Authentication') + print(ret.text) + exit(1) + +start_date = datetime(2006, 10, 1, 0, 0, 0) +start_date = datetime(2012, 9, 1, 0, 0, 0) +dspath = 'https://rda.ucar.edu/data/ds330.3/' +date_list = rrule.rrule(rrule.HOURLY, dtstart=start_date, interval=12) +verbose = True + + +for date in date_list: + ymd = date.strftime("%Y%m%d") + ymdhms = date.strftime("%Y%m%d%H%M%S") + server = "test" if date < datetime(2008, 8, 1) else "prod" + file = f'ecmf/{date.year}/{ymd}/z_tigge_c_ecmf_{ymdhms}_ifs_glob_{server}_all_glo.xml' + filename = dspath + file + outfile = save_dir / "xml" / os.path.basename(filename) + # Don't download if exists already + if outfile.exists(): + if verbose: + print(f'{file} already exists') + continue + req = requests.get(filename, cookies = ret.cookies, allow_redirects=True) + if req.status_code != 200: + if verbose: + print(f'{file} invalid URL') + continue + if verbose: + print(f'{file} downloading') + open(outfile, 'wb').write(req.content) diff --git a/analysis/hindcasts/02_convert_to_csv.py b/analysis/hindcasts/02_convert_to_csv.py new file mode 100644 index 0000000..469ee0a --- /dev/null +++ b/analysis/hindcasts/02_convert_to_csv.py @@ -0,0 +1,69 @@ +import sys, os +import requests +import getpass +from datetime import datetime +from pathlib import Path +import re + +import pandas as pd +import xml.etree.ElementTree as ET +from dateutil import rrule + +save_dir = Path("/home/turnerm/sync/aa_repo_data/Data/public/exploration/phl/ecmwf_hindcast") + +filename = "../../IBF-Typhoon-model/data/wind_data/input/typhoon_events.csv" +df_typhoons = pd.read_csv(filename) +df_typhoons.columns = ["local", "international", "year"] +for cname in ["local", "international"]: + df_typhoons[cname] = df_typhoons[cname].str.lower() + + +def xml2csv(filename): + print(f"{filename}") + tree = ET.parse(filename) + root = tree.getroot() + try: + model_name=root.find('header/generatingApplication/model/name').text + except AttributeError: + model_name = '' + + prod_center=root.find('header/productionCenter').text + baseTime=root.find('header/baseTime').text + + ## Create one dictonary for each time point, and append it to a list + for members in root.findall('data'): + mtype=members.get('type') + if mtype not in ['forecast', 'ensembleForecast']: + continue + for members2 in members.findall('disturbance'): + cyclone_name = [name.text.lower().strip() for name in members2.findall('cycloneName')] + if not cyclone_name: + continue + cyclone_name = cyclone_name[0].lower() + if cyclone_name not in list(df_typhoons["international"]): + continue + print(f"Found typhoon {cyclone_name}") + for members3 in members2.findall('fix'): + tem_dic = {} + tem_dic['mtype']=[mtype] + tem_dic['product']=[re.sub('\s+',' ',prod_center).strip().lower()] + tem_dic['cyc_number'] = [name.text for name in members2.findall('cycloneNumber')] + tem_dic['ensemble']=[members.get('member')] + tem_dic['speed'] = [name.text for name in members3.findall('cycloneData/maximumWind/speed')] + tem_dic['pressure'] = [name.text for name in members3.findall('cycloneData/minimumPressure/pressure')] + time = [name.text for name in members3.findall('validTime')] + tem_dic['time'] = ['/'.join(time[0].split('T')[0].split('-'))+', '+time[0].split('T')[1][:-1]] + tem_dic['lat'] = [name.text for name in members3.findall('latitude')] + tem_dic['lon']= [name.text for name in members3.findall('longitude')] + tem_dic['lead_time']=[members3.get('hour')] + tem_dic['forecast_time'] = ['/'.join(baseTime.split('T')[0].split('-'))+', '+baseTime.split('T')[1][:-1]] + tem_dic1 = dict( [(k,''.join(str(e).lower().strip() for e in v)) for k,v in tem_dic.items()]) + # Save to CSV + outfile = save_dir / f"csv/{cyclone_name}_all.csv" + pd.DataFrame(tem_dic1, index=[0]).to_csv(outfile, mode='a', header=not os.path.exists(outfile), index=False) + + +# Get list of filenames +filename_list = sorted(list(Path(save_dir / "xml").glob('*.xml'))) +for filename in filename_list: + xml2csv(filename) diff --git a/analysis/hindcasts/download_ecmwf_hindcasts.ipynb b/analysis/hindcasts/download_ecmwf_hindcasts.ipynb index 0388b40..2d1232f 100644 --- a/analysis/hindcasts/download_ecmwf_hindcasts.ipynb +++ b/analysis/hindcasts/download_ecmwf_hindcasts.ipynb @@ -10,7 +10,7 @@ }, { "cell_type": "code", - "execution_count": 113, + "execution_count": 115, "id": "c686d0bd-5b1a-4df9-8a53-491f6452654e", "metadata": {}, "outputs": [], @@ -29,7 +29,7 @@ }, { "cell_type": "code", - "execution_count": 85, + "execution_count": 116, "id": "4049d1fa-7f65-41de-92d5-d29bc90c8bad", "metadata": {}, "outputs": [], @@ -37,84 +37,6 @@ "save_dir = Path(\"/home/turnerm/sync/aa_repo_data/Data/public/exploration/phl/ecmwf_hindcast\")" ] }, - { - "cell_type": "code", - "execution_count": 3, - "id": "3ed771f4-b602-4090-9f4e-b73ebbf412f8", - "metadata": {}, - "outputs": [ - { - "name": "stdin", - "output_type": "stream", - "text": [ - "email: monica.turner@un.org\n", - "password: mon246\n" - ] - } - ], - "source": [ - "email = input('email: ')\n", - "pswd = input('password: ')" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "id": "bc5eec75-3ffd-4f3c-9541-ee0e17da0059", - "metadata": {}, - "outputs": [], - "source": [ - "values = {'email' : email, 'passwd' : pswd, 'action' : 'login'}\n", - "login_url = 'https://rda.ucar.edu/cgi-bin/login'" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "97cdf4df-0a65-4f09-91c0-5e2ee7e039fe", - "metadata": {}, - "outputs": [], - "source": [ - "ret = requests.post(login_url, data=values)\n", - "if ret.status_code != 200:\n", - " print('Bad Authentication')\n", - " print(ret.text)\n", - " exit(1)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1f931514-e7a2-4063-a9e6-38a3b55b5d9a", - "metadata": {}, - "outputs": [], - "source": [ - "dspath = 'https://rda.ucar.edu/data/ds330.3/'\n", - "date_list = rrule.rrule(rrule.HOURLY, dtstart=datetime(2006, 10, 1, 0, 0, 0), interval=12)\n", - "verbose = False\n", - "\n", - "for date in date_list:\n", - " ymd = date.strftime(\"%Y%m%d\")\n", - " ymdhms = date.strftime(\"%Y%m%d%H%M%S\")\n", - " server = \"test\" if date < datetime(2008, 8, 1) else \"prod\"\n", - " file = f'ecmf/{date.year}/{ymd}/z_tigge_c_ecmf_{ymdhms}_ifs_glob_{server}_all_glo.xml'\n", - " filename = dspath + file\n", - " outfile = save_dir / \"xml\" / os.path.basename(filename)\n", - " # Don't download if exists already\n", - " if outfile.exists():\n", - " if verbose:\n", - " print(f'{file} already exists')\n", - " continue\n", - " req = requests.get(filename, cookies = ret.cookies, allow_redirects=True)\n", - " if req.status_code != 200:\n", - " if verbose:\n", - " print(f'{file} invalid URL')\n", - " continue\n", - " if verbose:\n", - " print(f'{file} downloading')\n", - " open(outfile, 'wb').write(req.content)\n" - ] - }, { "cell_type": "markdown", "id": "f0daafc8-56ab-4af3-b2d6-048f6224450f", @@ -147,40 +69,6 @@ "## Convert to CSV" ] }, - { - "cell_type": "code", - "execution_count": 112, - "id": "5f04a32e-a0d2-4402-b3f3-44f64d3a1556", - "metadata": { - "tags": [] - }, - "outputs": [ - { - "ename": "KeyboardInterrupt", - "evalue": "", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", - "Input \u001b[0;32mIn [112]\u001b[0m, in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 2\u001b[0m filename_list \u001b[38;5;241m=\u001b[39m \u001b[38;5;28msorted\u001b[39m(\u001b[38;5;28mlist\u001b[39m(Path(save_dir \u001b[38;5;241m/\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mxml\u001b[39m\u001b[38;5;124m\"\u001b[39m)\u001b[38;5;241m.\u001b[39mglob(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m*.xml\u001b[39m\u001b[38;5;124m'\u001b[39m)))\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m filename \u001b[38;5;129;01min\u001b[39;00m filename_list:\n\u001b[0;32m----> 4\u001b[0m \u001b[43mxml2csv\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfilename\u001b[49m\u001b[43m)\u001b[49m\n", - "Input \u001b[0;32mIn [111]\u001b[0m, in \u001b[0;36mxml2csv\u001b[0;34m(filename)\u001b[0m\n\u001b[1;32m 42\u001b[0m \u001b[38;5;66;03m# Save to CSV\u001b[39;00m\n\u001b[1;32m 43\u001b[0m outfile \u001b[38;5;241m=\u001b[39m save_dir \u001b[38;5;241m/\u001b[39m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcsv/\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mcyclone_name\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m_all.csv\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m---> 44\u001b[0m \u001b[43mpd\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mDataFrame\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtem_dic1\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mindex\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241m.\u001b[39mto_csv(outfile, mode\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124ma\u001b[39m\u001b[38;5;124m'\u001b[39m, header\u001b[38;5;241m=\u001b[39m\u001b[38;5;129;01mnot\u001b[39;00m os\u001b[38;5;241m.\u001b[39mpath\u001b[38;5;241m.\u001b[39mexists(outfile), index\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m)\n", - "File \u001b[0;32m~/sync/Typhoon-Impact-based-forecasting-model/venv/lib/python3.8/site-packages/pandas/core/frame.py:614\u001b[0m, in \u001b[0;36mDataFrame.__init__\u001b[0;34m(self, data, index, columns, dtype, copy)\u001b[0m\n\u001b[1;32m 608\u001b[0m mgr \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_init_mgr(\n\u001b[1;32m 609\u001b[0m data, axes\u001b[38;5;241m=\u001b[39m{\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mindex\u001b[39m\u001b[38;5;124m\"\u001b[39m: index, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcolumns\u001b[39m\u001b[38;5;124m\"\u001b[39m: columns}, dtype\u001b[38;5;241m=\u001b[39mdtype, copy\u001b[38;5;241m=\u001b[39mcopy\n\u001b[1;32m 610\u001b[0m )\n\u001b[1;32m 612\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(data, \u001b[38;5;28mdict\u001b[39m):\n\u001b[1;32m 613\u001b[0m \u001b[38;5;66;03m# GH#38939 de facto copy defaults to False only in non-dict cases\u001b[39;00m\n\u001b[0;32m--> 614\u001b[0m mgr \u001b[38;5;241m=\u001b[39m \u001b[43mdict_to_mgr\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdata\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mindex\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcolumns\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdtype\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdtype\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcopy\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcopy\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtyp\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmanager\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 615\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(data, ma\u001b[38;5;241m.\u001b[39mMaskedArray):\n\u001b[1;32m 616\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mnumpy\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mma\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mmrecords\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mmrecords\u001b[39;00m\n", - "File \u001b[0;32m~/sync/Typhoon-Impact-based-forecasting-model/venv/lib/python3.8/site-packages/pandas/core/internals/construction.py:449\u001b[0m, in \u001b[0;36mdict_to_mgr\u001b[0;34m(data, index, columns, dtype, typ, copy)\u001b[0m\n\u001b[1;32m 446\u001b[0m \u001b[38;5;66;03m# GH#24096 need copy to be deep for datetime64tz case\u001b[39;00m\n\u001b[1;32m 447\u001b[0m \u001b[38;5;66;03m# TODO: See if we can avoid these copies\u001b[39;00m\n\u001b[1;32m 448\u001b[0m arrays \u001b[38;5;241m=\u001b[39m [arr \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(arr, Index) \u001b[38;5;28;01melse\u001b[39;00m arr\u001b[38;5;241m.\u001b[39m_data \u001b[38;5;28;01mfor\u001b[39;00m arr \u001b[38;5;129;01min\u001b[39;00m arrays]\n\u001b[0;32m--> 449\u001b[0m arrays \u001b[38;5;241m=\u001b[39m [\n\u001b[1;32m 450\u001b[0m arr \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m is_datetime64tz_dtype(arr) \u001b[38;5;28;01melse\u001b[39;00m arr\u001b[38;5;241m.\u001b[39mcopy() \u001b[38;5;28;01mfor\u001b[39;00m arr \u001b[38;5;129;01min\u001b[39;00m arrays\n\u001b[1;32m 451\u001b[0m ]\n\u001b[1;32m 453\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m copy:\n\u001b[1;32m 454\u001b[0m \u001b[38;5;66;03m# arrays_to_mgr (via form_blocks) won't make copies for EAs\u001b[39;00m\n\u001b[1;32m 455\u001b[0m \u001b[38;5;66;03m# dtype attr check to exclude EADtype-castable strs\u001b[39;00m\n\u001b[1;32m 456\u001b[0m arrays \u001b[38;5;241m=\u001b[39m [\n\u001b[1;32m 457\u001b[0m x\n\u001b[1;32m 458\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mhasattr\u001b[39m(x, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdtype\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(x\u001b[38;5;241m.\u001b[39mdtype, ExtensionDtype)\n\u001b[1;32m 459\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m x\u001b[38;5;241m.\u001b[39mcopy()\n\u001b[1;32m 460\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m x \u001b[38;5;129;01min\u001b[39;00m arrays\n\u001b[1;32m 461\u001b[0m ]\n", - "File \u001b[0;32m~/sync/Typhoon-Impact-based-forecasting-model/venv/lib/python3.8/site-packages/pandas/core/internals/construction.py:450\u001b[0m, in \u001b[0;36m\u001b[0;34m(.0)\u001b[0m\n\u001b[1;32m 446\u001b[0m \u001b[38;5;66;03m# GH#24096 need copy to be deep for datetime64tz case\u001b[39;00m\n\u001b[1;32m 447\u001b[0m \u001b[38;5;66;03m# TODO: See if we can avoid these copies\u001b[39;00m\n\u001b[1;32m 448\u001b[0m arrays \u001b[38;5;241m=\u001b[39m [arr \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(arr, Index) \u001b[38;5;28;01melse\u001b[39;00m arr\u001b[38;5;241m.\u001b[39m_data \u001b[38;5;28;01mfor\u001b[39;00m arr \u001b[38;5;129;01min\u001b[39;00m arrays]\n\u001b[1;32m 449\u001b[0m arrays \u001b[38;5;241m=\u001b[39m [\n\u001b[0;32m--> 450\u001b[0m arr \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[43mis_datetime64tz_dtype\u001b[49m\u001b[43m(\u001b[49m\u001b[43marr\u001b[49m\u001b[43m)\u001b[49m \u001b[38;5;28;01melse\u001b[39;00m arr\u001b[38;5;241m.\u001b[39mcopy() \u001b[38;5;28;01mfor\u001b[39;00m arr \u001b[38;5;129;01min\u001b[39;00m arrays\n\u001b[1;32m 451\u001b[0m ]\n\u001b[1;32m 453\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m copy:\n\u001b[1;32m 454\u001b[0m \u001b[38;5;66;03m# arrays_to_mgr (via form_blocks) won't make copies for EAs\u001b[39;00m\n\u001b[1;32m 455\u001b[0m \u001b[38;5;66;03m# dtype attr check to exclude EADtype-castable strs\u001b[39;00m\n\u001b[1;32m 456\u001b[0m arrays \u001b[38;5;241m=\u001b[39m [\n\u001b[1;32m 457\u001b[0m x\n\u001b[1;32m 458\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mhasattr\u001b[39m(x, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdtype\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(x\u001b[38;5;241m.\u001b[39mdtype, ExtensionDtype)\n\u001b[1;32m 459\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m x\u001b[38;5;241m.\u001b[39mcopy()\n\u001b[1;32m 460\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m x \u001b[38;5;129;01min\u001b[39;00m arrays\n\u001b[1;32m 461\u001b[0m ]\n", - "File \u001b[0;32m~/sync/Typhoon-Impact-based-forecasting-model/venv/lib/python3.8/site-packages/pandas/core/dtypes/common.py:385\u001b[0m, in \u001b[0;36mis_datetime64tz_dtype\u001b[0;34m(arr_or_dtype)\u001b[0m\n\u001b[1;32m 383\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m arr_or_dtype \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 384\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[0;32m--> 385\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mDatetimeTZDtype\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mis_dtype\u001b[49m\u001b[43m(\u001b[49m\u001b[43marr_or_dtype\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/sync/Typhoon-Impact-based-forecasting-model/venv/lib/python3.8/site-packages/pandas/core/dtypes/base.py:289\u001b[0m, in \u001b[0;36mExtensionDtype.is_dtype\u001b[0;34m(cls, dtype)\u001b[0m\n\u001b[1;32m 265\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 266\u001b[0m \u001b[38;5;124;03mCheck if we match 'dtype'.\u001b[39;00m\n\u001b[1;32m 267\u001b[0m \n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 285\u001b[0m \u001b[38;5;124;03m conditions is true for ``dtype.dtype``.\u001b[39;00m\n\u001b[1;32m 286\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 287\u001b[0m dtype \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mgetattr\u001b[39m(dtype, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdtype\u001b[39m\u001b[38;5;124m\"\u001b[39m, dtype)\n\u001b[0;32m--> 289\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28;43misinstance\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mdtype\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m(\u001b[49m\u001b[43mABCSeries\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mABCIndex\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mABCDataFrame\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdtype\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m:\n\u001b[1;32m 290\u001b[0m \u001b[38;5;66;03m# https://github.com/pandas-dev/pandas/issues/22960\u001b[39;00m\n\u001b[1;32m 291\u001b[0m \u001b[38;5;66;03m# avoid passing data to `construct_from_string`. This could\u001b[39;00m\n\u001b[1;32m 292\u001b[0m \u001b[38;5;66;03m# cause a FutureWarning from numpy about failing elementwise\u001b[39;00m\n\u001b[1;32m 293\u001b[0m \u001b[38;5;66;03m# comparison from, e.g., comparing DataFrame == 'category'.\u001b[39;00m\n\u001b[1;32m 294\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[1;32m 295\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m dtype \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n", - "File \u001b[0;32m~/sync/Typhoon-Impact-based-forecasting-model/venv/lib/python3.8/site-packages/pandas/core/dtypes/generic.py:43\u001b[0m, in \u001b[0;36mcreate_pandas_abc_type.._check\u001b[0;34m(cls, inst)\u001b[0m\n\u001b[1;32m 39\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcreate_pandas_abc_type\u001b[39m(name, attr, comp):\n\u001b[1;32m 40\u001b[0m \n\u001b[1;32m 41\u001b[0m \u001b[38;5;66;03m# https://github.com/python/mypy/issues/1006\u001b[39;00m\n\u001b[1;32m 42\u001b[0m \u001b[38;5;66;03m# error: 'classmethod' used with a non-method\u001b[39;00m\n\u001b[0;32m---> 43\u001b[0m \u001b[38;5;129m@classmethod\u001b[39m \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 44\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_check\u001b[39m(\u001b[38;5;28mcls\u001b[39m, inst) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;28mbool\u001b[39m:\n\u001b[1;32m 45\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mgetattr\u001b[39m(inst, attr, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m_typ\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;129;01min\u001b[39;00m comp\n\u001b[1;32m 47\u001b[0m dct \u001b[38;5;241m=\u001b[39m {\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m__instancecheck__\u001b[39m\u001b[38;5;124m\"\u001b[39m: _check, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m__subclasscheck__\u001b[39m\u001b[38;5;124m\"\u001b[39m: _check}\n", - "\u001b[0;31mKeyboardInterrupt\u001b[0m: " - ] - } - ], - "source": [ - "# Get list of filenames\n", - "filename_list = sorted(list(Path(save_dir / \"xml\").glob('*.xml')))\n", - "for filename in filename_list:\n", - " xml2csv(filename)" - ] - }, { "cell_type": "code", "execution_count": 111, @@ -234,6 +122,40 @@ " " ] }, + { + "cell_type": "code", + "execution_count": 112, + "id": "5f04a32e-a0d2-4402-b3f3-44f64d3a1556", + "metadata": { + "tags": [] + }, + "outputs": [ + { + "ename": "KeyboardInterrupt", + "evalue": "", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", + "Input \u001b[0;32mIn [112]\u001b[0m, in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 2\u001b[0m filename_list \u001b[38;5;241m=\u001b[39m \u001b[38;5;28msorted\u001b[39m(\u001b[38;5;28mlist\u001b[39m(Path(save_dir \u001b[38;5;241m/\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mxml\u001b[39m\u001b[38;5;124m\"\u001b[39m)\u001b[38;5;241m.\u001b[39mglob(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m*.xml\u001b[39m\u001b[38;5;124m'\u001b[39m)))\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m filename \u001b[38;5;129;01min\u001b[39;00m filename_list:\n\u001b[0;32m----> 4\u001b[0m \u001b[43mxml2csv\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfilename\u001b[49m\u001b[43m)\u001b[49m\n", + "Input \u001b[0;32mIn [111]\u001b[0m, in \u001b[0;36mxml2csv\u001b[0;34m(filename)\u001b[0m\n\u001b[1;32m 42\u001b[0m \u001b[38;5;66;03m# Save to CSV\u001b[39;00m\n\u001b[1;32m 43\u001b[0m outfile \u001b[38;5;241m=\u001b[39m save_dir \u001b[38;5;241m/\u001b[39m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcsv/\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mcyclone_name\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m_all.csv\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m---> 44\u001b[0m \u001b[43mpd\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mDataFrame\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtem_dic1\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mindex\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241m.\u001b[39mto_csv(outfile, mode\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124ma\u001b[39m\u001b[38;5;124m'\u001b[39m, header\u001b[38;5;241m=\u001b[39m\u001b[38;5;129;01mnot\u001b[39;00m os\u001b[38;5;241m.\u001b[39mpath\u001b[38;5;241m.\u001b[39mexists(outfile), index\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m)\n", + "File \u001b[0;32m~/sync/Typhoon-Impact-based-forecasting-model/venv/lib/python3.8/site-packages/pandas/core/frame.py:614\u001b[0m, in \u001b[0;36mDataFrame.__init__\u001b[0;34m(self, data, index, columns, dtype, copy)\u001b[0m\n\u001b[1;32m 608\u001b[0m mgr \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_init_mgr(\n\u001b[1;32m 609\u001b[0m data, axes\u001b[38;5;241m=\u001b[39m{\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mindex\u001b[39m\u001b[38;5;124m\"\u001b[39m: index, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcolumns\u001b[39m\u001b[38;5;124m\"\u001b[39m: columns}, dtype\u001b[38;5;241m=\u001b[39mdtype, copy\u001b[38;5;241m=\u001b[39mcopy\n\u001b[1;32m 610\u001b[0m )\n\u001b[1;32m 612\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(data, \u001b[38;5;28mdict\u001b[39m):\n\u001b[1;32m 613\u001b[0m \u001b[38;5;66;03m# GH#38939 de facto copy defaults to False only in non-dict cases\u001b[39;00m\n\u001b[0;32m--> 614\u001b[0m mgr \u001b[38;5;241m=\u001b[39m \u001b[43mdict_to_mgr\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdata\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mindex\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcolumns\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdtype\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdtype\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcopy\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcopy\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtyp\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmanager\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 615\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(data, ma\u001b[38;5;241m.\u001b[39mMaskedArray):\n\u001b[1;32m 616\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mnumpy\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mma\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mmrecords\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mmrecords\u001b[39;00m\n", + "File \u001b[0;32m~/sync/Typhoon-Impact-based-forecasting-model/venv/lib/python3.8/site-packages/pandas/core/internals/construction.py:449\u001b[0m, in \u001b[0;36mdict_to_mgr\u001b[0;34m(data, index, columns, dtype, typ, copy)\u001b[0m\n\u001b[1;32m 446\u001b[0m \u001b[38;5;66;03m# GH#24096 need copy to be deep for datetime64tz case\u001b[39;00m\n\u001b[1;32m 447\u001b[0m \u001b[38;5;66;03m# TODO: See if we can avoid these copies\u001b[39;00m\n\u001b[1;32m 448\u001b[0m arrays \u001b[38;5;241m=\u001b[39m [arr \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(arr, Index) \u001b[38;5;28;01melse\u001b[39;00m arr\u001b[38;5;241m.\u001b[39m_data \u001b[38;5;28;01mfor\u001b[39;00m arr \u001b[38;5;129;01min\u001b[39;00m arrays]\n\u001b[0;32m--> 449\u001b[0m arrays \u001b[38;5;241m=\u001b[39m [\n\u001b[1;32m 450\u001b[0m arr \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m is_datetime64tz_dtype(arr) \u001b[38;5;28;01melse\u001b[39;00m arr\u001b[38;5;241m.\u001b[39mcopy() \u001b[38;5;28;01mfor\u001b[39;00m arr \u001b[38;5;129;01min\u001b[39;00m arrays\n\u001b[1;32m 451\u001b[0m ]\n\u001b[1;32m 453\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m copy:\n\u001b[1;32m 454\u001b[0m \u001b[38;5;66;03m# arrays_to_mgr (via form_blocks) won't make copies for EAs\u001b[39;00m\n\u001b[1;32m 455\u001b[0m \u001b[38;5;66;03m# dtype attr check to exclude EADtype-castable strs\u001b[39;00m\n\u001b[1;32m 456\u001b[0m arrays \u001b[38;5;241m=\u001b[39m [\n\u001b[1;32m 457\u001b[0m x\n\u001b[1;32m 458\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mhasattr\u001b[39m(x, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdtype\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(x\u001b[38;5;241m.\u001b[39mdtype, ExtensionDtype)\n\u001b[1;32m 459\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m x\u001b[38;5;241m.\u001b[39mcopy()\n\u001b[1;32m 460\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m x \u001b[38;5;129;01min\u001b[39;00m arrays\n\u001b[1;32m 461\u001b[0m ]\n", + "File \u001b[0;32m~/sync/Typhoon-Impact-based-forecasting-model/venv/lib/python3.8/site-packages/pandas/core/internals/construction.py:450\u001b[0m, in \u001b[0;36m\u001b[0;34m(.0)\u001b[0m\n\u001b[1;32m 446\u001b[0m \u001b[38;5;66;03m# GH#24096 need copy to be deep for datetime64tz case\u001b[39;00m\n\u001b[1;32m 447\u001b[0m \u001b[38;5;66;03m# TODO: See if we can avoid these copies\u001b[39;00m\n\u001b[1;32m 448\u001b[0m arrays \u001b[38;5;241m=\u001b[39m [arr \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(arr, Index) \u001b[38;5;28;01melse\u001b[39;00m arr\u001b[38;5;241m.\u001b[39m_data \u001b[38;5;28;01mfor\u001b[39;00m arr \u001b[38;5;129;01min\u001b[39;00m arrays]\n\u001b[1;32m 449\u001b[0m arrays \u001b[38;5;241m=\u001b[39m [\n\u001b[0;32m--> 450\u001b[0m arr \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[43mis_datetime64tz_dtype\u001b[49m\u001b[43m(\u001b[49m\u001b[43marr\u001b[49m\u001b[43m)\u001b[49m \u001b[38;5;28;01melse\u001b[39;00m arr\u001b[38;5;241m.\u001b[39mcopy() \u001b[38;5;28;01mfor\u001b[39;00m arr \u001b[38;5;129;01min\u001b[39;00m arrays\n\u001b[1;32m 451\u001b[0m ]\n\u001b[1;32m 453\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m copy:\n\u001b[1;32m 454\u001b[0m \u001b[38;5;66;03m# arrays_to_mgr (via form_blocks) won't make copies for EAs\u001b[39;00m\n\u001b[1;32m 455\u001b[0m \u001b[38;5;66;03m# dtype attr check to exclude EADtype-castable strs\u001b[39;00m\n\u001b[1;32m 456\u001b[0m arrays \u001b[38;5;241m=\u001b[39m [\n\u001b[1;32m 457\u001b[0m x\n\u001b[1;32m 458\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mhasattr\u001b[39m(x, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdtype\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(x\u001b[38;5;241m.\u001b[39mdtype, ExtensionDtype)\n\u001b[1;32m 459\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m x\u001b[38;5;241m.\u001b[39mcopy()\n\u001b[1;32m 460\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m x \u001b[38;5;129;01min\u001b[39;00m arrays\n\u001b[1;32m 461\u001b[0m ]\n", + "File \u001b[0;32m~/sync/Typhoon-Impact-based-forecasting-model/venv/lib/python3.8/site-packages/pandas/core/dtypes/common.py:385\u001b[0m, in \u001b[0;36mis_datetime64tz_dtype\u001b[0;34m(arr_or_dtype)\u001b[0m\n\u001b[1;32m 383\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m arr_or_dtype \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 384\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[0;32m--> 385\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mDatetimeTZDtype\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mis_dtype\u001b[49m\u001b[43m(\u001b[49m\u001b[43marr_or_dtype\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/sync/Typhoon-Impact-based-forecasting-model/venv/lib/python3.8/site-packages/pandas/core/dtypes/base.py:289\u001b[0m, in \u001b[0;36mExtensionDtype.is_dtype\u001b[0;34m(cls, dtype)\u001b[0m\n\u001b[1;32m 265\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 266\u001b[0m \u001b[38;5;124;03mCheck if we match 'dtype'.\u001b[39;00m\n\u001b[1;32m 267\u001b[0m \n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 285\u001b[0m \u001b[38;5;124;03m conditions is true for ``dtype.dtype``.\u001b[39;00m\n\u001b[1;32m 286\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 287\u001b[0m dtype \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mgetattr\u001b[39m(dtype, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdtype\u001b[39m\u001b[38;5;124m\"\u001b[39m, dtype)\n\u001b[0;32m--> 289\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28;43misinstance\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mdtype\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m(\u001b[49m\u001b[43mABCSeries\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mABCIndex\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mABCDataFrame\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdtype\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m:\n\u001b[1;32m 290\u001b[0m \u001b[38;5;66;03m# https://github.com/pandas-dev/pandas/issues/22960\u001b[39;00m\n\u001b[1;32m 291\u001b[0m \u001b[38;5;66;03m# avoid passing data to `construct_from_string`. This could\u001b[39;00m\n\u001b[1;32m 292\u001b[0m \u001b[38;5;66;03m# cause a FutureWarning from numpy about failing elementwise\u001b[39;00m\n\u001b[1;32m 293\u001b[0m \u001b[38;5;66;03m# comparison from, e.g., comparing DataFrame == 'category'.\u001b[39;00m\n\u001b[1;32m 294\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[1;32m 295\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m dtype \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n", + "File \u001b[0;32m~/sync/Typhoon-Impact-based-forecasting-model/venv/lib/python3.8/site-packages/pandas/core/dtypes/generic.py:43\u001b[0m, in \u001b[0;36mcreate_pandas_abc_type.._check\u001b[0;34m(cls, inst)\u001b[0m\n\u001b[1;32m 39\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcreate_pandas_abc_type\u001b[39m(name, attr, comp):\n\u001b[1;32m 40\u001b[0m \n\u001b[1;32m 41\u001b[0m \u001b[38;5;66;03m# https://github.com/python/mypy/issues/1006\u001b[39;00m\n\u001b[1;32m 42\u001b[0m \u001b[38;5;66;03m# error: 'classmethod' used with a non-method\u001b[39;00m\n\u001b[0;32m---> 43\u001b[0m \u001b[38;5;129m@classmethod\u001b[39m \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 44\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_check\u001b[39m(\u001b[38;5;28mcls\u001b[39m, inst) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;28mbool\u001b[39m:\n\u001b[1;32m 45\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mgetattr\u001b[39m(inst, attr, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m_typ\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;129;01min\u001b[39;00m comp\n\u001b[1;32m 47\u001b[0m dct \u001b[38;5;241m=\u001b[39m {\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m__instancecheck__\u001b[39m\u001b[38;5;124m\"\u001b[39m: _check, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m__subclasscheck__\u001b[39m\u001b[38;5;124m\"\u001b[39m: _check}\n", + "\u001b[0;31mKeyboardInterrupt\u001b[0m: " + ] + } + ], + "source": [ + "# Get list of filenames\n", + "filename_list = sorted(list(Path(save_dir / \"xml\").glob('*.xml')))\n", + "for filename in filename_list:\n", + " xml2csv(filename)" + ] + }, { "cell_type": "markdown", "id": "93bb0820-ca17-4d56-aab8-3adaf813ff5f", From daba8a419ee1365ed3de2d5e5c9b5952b083de2f Mon Sep 17 00:00:00 2001 From: turnerm Date: Tue, 23 Aug 2022 15:31:12 +0200 Subject: [PATCH 03/17] Added to operational model --- .../src/typhoonmodel/pipeline.py | 16 +- .../utility_fun/forecast_process.py | 67 ++-- .../utility_fun/read_in_hindcast.py | 48 +++ analysis/hindcasts/01_download_hindcasts.py | 2 +- .../hindcasts/download_ecmwf_hindcasts.ipynb | 361 ++++++++---------- 5 files changed, 263 insertions(+), 231 deletions(-) create mode 100644 IBF-Typhoon-model/src/typhoonmodel/utility_fun/read_in_hindcast.py diff --git a/IBF-Typhoon-model/src/typhoonmodel/pipeline.py b/IBF-Typhoon-model/src/typhoonmodel/pipeline.py index 2ffb156..59d6111 100644 --- a/IBF-Typhoon-model/src/typhoonmodel/pipeline.py +++ b/IBF-Typhoon-model/src/typhoonmodel/pipeline.py @@ -21,11 +21,16 @@ @click.command() @click.option('--path', default='./', help='main directory') @click.option('--remote_directory', default=None, - help='remote directory for ECMWF forecast data, format: YYYYMMDDhhmmss') + help='remote directory for ECMWF forecast data, format: YYYYMMDDhhmmss. In the case of hindcasts,' + 'the target timestamp of the forecast run.') +@click.option('--use-hindcast', is_flag=True, help='Use hindcast instead of latest ECMWF. Need to specify' + 'local directory and use remote directory for timestamp') +@click.option('--local-directory', default=None, + help='local directory containing with ECMWF hindcasts') @click.option('--typhoonname', default=None, help='name for active typhoon') @click.option('--no-azure', is_flag=True, help="Don't push to Azure lake") @click.option('--debug', is_flag=True, help='setting for DEBUG option') -def main(path, remote_directory, typhoonname, no_azure, debug): +def main(path, remote_directory, use_hindcast, local_directory, typhoonname, no_azure, debug): initialize.setup_cartopy() start_time = datetime.now() print('---------------------AUTOMATION SCRIPT STARTED---------------------------------') @@ -37,7 +42,12 @@ def main(path, remote_directory, typhoonname, no_azure, debug): typhoonname = 'MEGI' remote_dir = '20220412000000' logger.info(f"DEBUGGING piepline for typhoon {typhoonname}") - Forecast(path, remote_dir, typhoonname, countryCodeISO3='PHP', admin_level=3, no_azure=no_azure) + if use_hindcast: + if not remote_directory or not local_directory or not typhoonname: + logger.error("If you want to use a hindcast, you need to specify remote directory" + "(for the forecast timestamp), a local directory, and the typhoon name") + Forecast(path, remote_dir, typhoonname, countryCodeISO3='PHP', admin_level=3, no_azure=no_azure, + use_hindcast=use_hindcast, local_directory=local_directory) print('---------------------AUTOMATION SCRIPT FINISHED---------------------------------') print(str(datetime.now())) diff --git a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/forecast_process.py b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/forecast_process.py index d7076a9..75a9b1e 100644 --- a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/forecast_process.py +++ b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/forecast_process.py @@ -21,7 +21,7 @@ from climada.hazard.tc_tracks_forecast import TCForecast from typhoonmodel.utility_fun.settings import get_settings from typhoonmodel.utility_fun import track_data_clean, Check_for_active_typhoon, Sendemail, \ - ucl_data, plot_intensity, initialize + ucl_data, plot_intensity, initialize, read_in_hindcast if platform == "linux" or platform == "linux2": #check if running on linux or windows os from typhoonmodel.utility_fun import Rainfall_data @@ -33,7 +33,8 @@ class Forecast: - def __init__(self,main_path, remote_dir,typhoonname, countryCodeISO3, admin_level, no_azure): + def __init__(self,main_path, remote_dir,typhoonname, countryCodeISO3, admin_level, no_azure, + use_hindcast, local_directory): self.TyphoonName = typhoonname self.admin_level = admin_level #self.db = DatabaseManager(leadTimeLabel, countryCodeISO3,admin_level) @@ -116,29 +117,31 @@ def __init__(self,main_path, remote_dir,typhoonname, countryCodeISO3, admin_leve self.df_admin=df_admin # Sometimes the ECMWF ftp server complains about too many requests # This code allows several retries with some sleep time in between - n_tries = 0 - while True: - try: - logger.info("Downloading ECMWF typhoon tracks") - bufr_files = TCForecast.fetch_bufr_ftp(remote_dir=self.remote_dir) - fcast = TCForecast() - fcast.fetch_ecmwf(files=bufr_files) - except ftplib.all_errors as e: - n_tries += 1 - if n_tries >= self.ECMWF_MAX_TRIES: - logger.error(f' Data downloading from ECMWF failed: {e}, ' - f'reached limit of {self.ECMWF_MAX_TRIES} tries, exiting') - sys.exit() - logger.error(f' Data downloading from ECMWF failed: {e}, retrying after {self.ECMWF_SLEEP} s') - time.sleep(self.ECMWF_SLEEP) - continue - break + if use_hindcast: + fcast_data = read_in_hindcast.read_in_hindcast(typhoonname, remote_dir, local_directory) + else: + n_tries = 0 + while True: + try: + logger.info("Downloading ECMWF typhoon tracks") + bufr_files = TCForecast.fetch_bufr_ftp(remote_dir=self.remote_dir) + fcast = TCForecast() + fcast.fetch_ecmwf(files=bufr_files) + except ftplib.all_errors as e: + n_tries += 1 + if n_tries >= self.ECMWF_MAX_TRIES: + logger.error(f' Data downloading from ECMWF failed: {e}, ' + f'reached limit of {self.ECMWF_MAX_TRIES} tries, exiting') + sys.exit() + logger.error(f' Data downloading from ECMWF failed: {e}, retrying after {self.ECMWF_SLEEP} s') + time.sleep(self.ECMWF_SLEEP) + continue + break + fcast_data = [track_data_clean.track_data_clean(tr) for tr in fcast.data if (tr.time.size>1 and tr.name in Activetyphoon)] #%% filter data downloaded in the above step for active typhoons in PAR # filter tracks with name of current typhoons and drop tracks with only one timestep - fcast_data = [track_data_clean.track_data_clean(tr) for tr in fcast.data if (tr.time.size>1 and tr.name in Activetyphoon)] self.fcast_data=fcast_data - fcast.data =fcast_data # [tr for tr in fcast.data if tr.name in Activetyphoon] self.data_filenames_list={} self.image_filenames_list={} self.typhhon_wind_data={} @@ -160,8 +163,8 @@ def __init__(self,main_path, remote_dir,typhoonname, countryCodeISO3, admin_leve #typhoons='SURIGAE' # to run it manually for any typhoon # select windspeed for HRS model - fcast.data=[tr for tr in fcast.data if tr.name==typhoons] - tr_HRS=[tr for tr in fcast.data if (tr.is_ensemble=='False')] + fcast_data=[tr for tr in fcast_data if tr.name==typhoons] + tr_HRS=[tr for tr in fcast_data if (tr.is_ensemble=='False')] if tr_HRS !=[]: HRS_SPEED=(tr_HRS[0].max_sustained_wind.values/0.84).tolist() ############# 0.84 is conversion factor for ECMWF 10MIN TO 1MIN AVERAGE @@ -177,18 +180,18 @@ def __init__(self,main_path, remote_dir,typhoonname, countryCodeISO3, admin_leve #line_='Rainfall,'+'%sRainfall/' % Input_folder +','+ typhoons + ',' + date_dir #StormName # fname.write(line_+'\n') # Adjust track time step - data_forced=[tr.where(tr.time <= max(tr_HRS[0].time.values),drop=True) for tr in fcast.data] + data_forced=[tr.where(tr.time <= max(tr_HRS[0].time.values),drop=True) for tr in fcast_data] # data_forced = [track_data_clean.track_data_force_HRS(tr,HRS_SPEED) for tr in data_forced] # forced with HRS windspeed - #data_forced= [track_data_clean.track_data_clean(tr) for tr in fcast.data] # taking speed of ENS + #data_forced= [track_data_clean.track_data_clean(tr) for tr in fcast_data] # taking speed of ENS # interpolate to 3h steps from the original 6h - #fcast.equal_timestep(3) + #fcast_equal_timestep(3) else: - len_ar=np.min([ len(var.lat.values) for var in fcast.data ]) - lat_ = np.ma.mean( [ var.lat.values[:len_ar] for var in fcast.data ], axis=0 ) - lon_ = np.ma.mean( [ var.lon.values[:len_ar] for var in fcast.data ], axis=0 ) - YYYYMMDDHH =pd.date_range(fcast.data[0].time.values[0], periods=len_ar, freq="H") - vmax_ = np.ma.mean( [ var.max_sustained_wind.values[:len_ar] for var in fcast.data ], axis=0 ) + len_ar=np.min([ len(var.lat.values) for var in fcast_data ]) + lat_ = np.ma.mean( [ var.lat.values[:len_ar] for var in fcast_data ], axis=0 ) + lon_ = np.ma.mean( [ var.lon.values[:len_ar] for var in fcast_data ], axis=0 ) + YYYYMMDDHH =pd.date_range(fcast_data[0].time.values[0], periods=len_ar, freq="H") + vmax_ = np.ma.mean( [ var.max_sustained_wind.values[:len_ar] for var in fcast_data ], axis=0 ) d = {'YYYYMMDDHH':YYYYMMDDHH, "VMAX":vmax_, "LAT": lat_, @@ -202,7 +205,7 @@ def __init__(self,main_path, remote_dir,typhoonname, countryCodeISO3, admin_leve line_='ecmwf,'+'%secmwf_hrs_track.csv' % self.Input_folder+ ',' +typhoons+','+ self.date_dir #StormName # #line_='Rainfall,'+'%sRainfall/' % Input_folder +','+ typhoons + ',' + date_dir #StormName # fname.write(line_+'\n') - data_forced=fcast.data + data_forced=fcast_data landfall_location_={} check_flag=0 for row,data in hrs_track_data.iterrows(): diff --git a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/read_in_hindcast.py b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/read_in_hindcast.py new file mode 100644 index 0000000..a97c4c6 --- /dev/null +++ b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/read_in_hindcast.py @@ -0,0 +1,48 @@ +from datetime import datetime +from pathlib import Path + +import xarray as xr +import pandas as pd + +def read_in_hindcast(typhoon_name: str, remote_dir: str, local_directory: str): + # Read in the hindcast csv + print(remote_dir) + filename = Path(local_directory) / f"{typhoon_name}_all.csv" + forecast_time = datetime.strptime(remote_dir, "%Y%m%d%H%M%S") + + df = pd.read_csv(filename) + for cname in ["time", "forecast_time"]: + df[cname] = pd.to_datetime(df[cname]) + df = df[df["mtype"] == "ensembleforecast"] + df = df[df["forecast_time"] == forecast_time] + + # Format into a list of tracks + tracks = [] + for ensemble, group in df.groupby("ensemble"): + + time_step = (group["time"].values[1] - group["time"].values[0]).astype('timedelta64[h]') + time_step = pd.to_timedelta(time_step).total_seconds() / 3600 + + coords = dict( + time=(["time"], group["time"]), + ) + data_vars=dict( + max_sustained_wind=(["time"], group['speed']), + central_pressure=(["time"], group['pressure']), + lat=(["time"], group["lat"]), + lon=(["time"], group["lon"]), + time_step=(["time"], [time_step] * len(group)) + ) + attrs=dict( + max_sustained_wind_unit="m/s", + central_pressure_unit="mb", + name=typhoon_name.upper(), + data_provider="ECMWF", + ensemble_number=ensemble, + is_ensemble=True, + forecast_time=forecast_time, + basin="W - North West Pacific" + ) + ds = xr.Dataset(data_vars=data_vars, coords=coords, attrs=attrs).set_coords(["lat", "lon"]) + tracks.append(ds) + return tracks diff --git a/analysis/hindcasts/01_download_hindcasts.py b/analysis/hindcasts/01_download_hindcasts.py index 3bcdb0d..36d2f1b 100644 --- a/analysis/hindcasts/01_download_hindcasts.py +++ b/analysis/hindcasts/01_download_hindcasts.py @@ -21,7 +21,7 @@ exit(1) start_date = datetime(2006, 10, 1, 0, 0, 0) -start_date = datetime(2012, 9, 1, 0, 0, 0) +start_date = datetime(2020, 9, 7, 0, 0, 0) dspath = 'https://rda.ucar.edu/data/ds330.3/' date_list = rrule.rrule(rrule.HOURLY, dtstart=start_date, interval=12) verbose = True diff --git a/analysis/hindcasts/download_ecmwf_hindcasts.ipynb b/analysis/hindcasts/download_ecmwf_hindcasts.ipynb index 2d1232f..9acf805 100644 --- a/analysis/hindcasts/download_ecmwf_hindcasts.ipynb +++ b/analysis/hindcasts/download_ecmwf_hindcasts.ipynb @@ -10,26 +10,22 @@ }, { "cell_type": "code", - "execution_count": 115, + "execution_count": 24, "id": "c686d0bd-5b1a-4df9-8a53-491f6452654e", "metadata": {}, "outputs": [], "source": [ - "import sys, os\n", - "import requests\n", - "import getpass\n", - "from datetime import datetime\n", "from pathlib import Path\n", - "import re\n", + "from datetime import datetime, timedelta\n", "\n", "import pandas as pd\n", - "import xml.etree.ElementTree as ET\n", - "from dateutil import rrule" + "import xarray as xr\n", + "import numpy as np" ] }, { "cell_type": "code", - "execution_count": 116, + "execution_count": 15, "id": "4049d1fa-7f65-41de-92d5-d29bc90c8bad", "metadata": {}, "outputs": [], @@ -49,7 +45,7 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 16, "id": "433c65c3-30c7-4668-be8e-7ba7ebb5083b", "metadata": {}, "outputs": [], @@ -58,240 +54,215 @@ "df_typhoons = pd.read_csv(filename)\n", "df_typhoons.columns = [\"local\", \"international\", \"year\"]\n", "for cname in [\"local\", \"international\"]:\n", - " df_typhoons[cname] = df_typhoons[cname].str.lower()" + " df_typhoons[cname] = df_typhoons[cname].str.lower()\n", + "df_typhoons = df_typhoons.sort_values(by=[\"year\", \"international\"])" ] }, { "cell_type": "markdown", - "id": "a13a63a1-e9b4-4c04-a528-e666d207e3b1", + "id": "4bcd0dca-396f-43b4-8451-90b15ef794fc", "metadata": {}, "source": [ - "## Convert to CSV" + "## Test with Durian" ] }, { "cell_type": "code", - "execution_count": 111, - "id": "58f882ba-15d3-4aff-a549-9b2d31441b94", + "execution_count": 17, + "outputs": [], + "source": [ + "# Select a typhoon and a target date\n", + "typhoon_name = \"durian\"\n", + "landfall_date = datetime(2006, 11, 30, 12)" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "cf3feb29-f8f9-4176-b3ec-44ebd4f0b9d9", "metadata": {}, "outputs": [], "source": [ - "def xml2csv(filename):\n", - " #print(f\"{filename}\")\n", - " tree = ET.parse(filename)\n", - " root = tree.getroot()\n", - " try:\n", - " model_name=root.find('header/generatingApplication/model/name').text \n", - " except AttributeError:\n", - " model_name = ''\n", - "\n", - " prod_center=root.find('header/productionCenter').text\n", - " baseTime=root.find('header/baseTime').text\n", + "filename = save_dir / f\"csv/{typhoon_name}_all.csv\"\n", + "forecast_date = landfall_date - timedelta(days=3)\n", "\n", - " ## Create one dictonary for each time point, and append it to a list\n", - " for members in root.findall('data'):\n", - " mtype=members.get('type')\n", - " if mtype not in ['forecast', 'ensembleForecast']:\n", - " continue\n", - " for members2 in members.findall('disturbance'):\n", - " cyclone_name = [name.text.lower().strip() for name in members2.findall('cycloneName')]\n", - " if not cyclone_name:\n", - " continue\n", - " cyclone_name = cyclone_name[0].lower()\n", - " if cyclone_name not in list(df_typhoons[\"international\"]):\n", - " continue\n", - " # print(f\"Found typhoon {cyclone_name}\")\n", - " for members3 in members2.findall('fix'):\n", - " tem_dic = {}\n", - " tem_dic['mtype']=[mtype]\n", - " tem_dic['product']=[re.sub('\\s+',' ',prod_center).strip().lower()]\n", - " tem_dic['cyc_number'] = [name.text for name in members2.findall('cycloneNumber')]\n", - " tem_dic['ensemble']=[members.get('member')]\n", - " tem_dic['speed'] = [name.text for name in members3.findall('cycloneData/maximumWind/speed')]\n", - " tem_dic['pressure'] = [name.text for name in members3.findall('cycloneData/minimumPressure/pressure')]\n", - " time = [name.text for name in members3.findall('validTime')]\n", - " tem_dic['time'] = ['/'.join(time[0].split('T')[0].split('-'))+', '+time[0].split('T')[1][:-1]]\n", - " tem_dic['lat'] = [name.text for name in members3.findall('latitude')]\n", - " tem_dic['lon']= [name.text for name in members3.findall('longitude')] \n", - " tem_dic['lead_time']=[members3.get('hour')]\n", - " tem_dic['forecast_time'] = ['/'.join(baseTime.split('T')[0].split('-'))+', '+baseTime.split('T')[1][:-1]]\n", - " tem_dic1 = dict( [(k,''.join(str(e).lower().strip() for e in v)) for k,v in tem_dic.items()])\n", - " # Save to CSV\n", - " outfile = save_dir / f\"csv/{cyclone_name}_all.csv\"\n", - " pd.DataFrame(tem_dic1, index=[0]).to_csv(outfile, mode='a', header=not os.path.exists(outfile), index=False)\n", - " " + "df = pd.read_csv(filename)\n", + "for cname in [\"time\", \"forecast_time\"]:\n", + " df[cname] = pd.to_datetime(df[cname])\n", + "df = df[df[\"mtype\"] == \"ensembleforecast\"]\n", + "df = df[df[\"forecast_time\"] == forecast_date]" ] }, { "cell_type": "code", - "execution_count": 112, - "id": "5f04a32e-a0d2-4402-b3f3-44f64d3a1556", - "metadata": { - "tags": [] - }, + "execution_count": 29, "outputs": [ { - "ename": "KeyboardInterrupt", - "evalue": "", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", - "Input \u001b[0;32mIn [112]\u001b[0m, in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 2\u001b[0m filename_list \u001b[38;5;241m=\u001b[39m \u001b[38;5;28msorted\u001b[39m(\u001b[38;5;28mlist\u001b[39m(Path(save_dir \u001b[38;5;241m/\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mxml\u001b[39m\u001b[38;5;124m\"\u001b[39m)\u001b[38;5;241m.\u001b[39mglob(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m*.xml\u001b[39m\u001b[38;5;124m'\u001b[39m)))\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m filename \u001b[38;5;129;01min\u001b[39;00m filename_list:\n\u001b[0;32m----> 4\u001b[0m \u001b[43mxml2csv\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfilename\u001b[49m\u001b[43m)\u001b[49m\n", - "Input \u001b[0;32mIn [111]\u001b[0m, in \u001b[0;36mxml2csv\u001b[0;34m(filename)\u001b[0m\n\u001b[1;32m 42\u001b[0m \u001b[38;5;66;03m# Save to CSV\u001b[39;00m\n\u001b[1;32m 43\u001b[0m outfile \u001b[38;5;241m=\u001b[39m save_dir \u001b[38;5;241m/\u001b[39m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcsv/\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mcyclone_name\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m_all.csv\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m---> 44\u001b[0m \u001b[43mpd\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mDataFrame\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtem_dic1\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mindex\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241m.\u001b[39mto_csv(outfile, mode\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124ma\u001b[39m\u001b[38;5;124m'\u001b[39m, header\u001b[38;5;241m=\u001b[39m\u001b[38;5;129;01mnot\u001b[39;00m os\u001b[38;5;241m.\u001b[39mpath\u001b[38;5;241m.\u001b[39mexists(outfile), index\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m)\n", - "File \u001b[0;32m~/sync/Typhoon-Impact-based-forecasting-model/venv/lib/python3.8/site-packages/pandas/core/frame.py:614\u001b[0m, in \u001b[0;36mDataFrame.__init__\u001b[0;34m(self, data, index, columns, dtype, copy)\u001b[0m\n\u001b[1;32m 608\u001b[0m mgr \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_init_mgr(\n\u001b[1;32m 609\u001b[0m data, axes\u001b[38;5;241m=\u001b[39m{\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mindex\u001b[39m\u001b[38;5;124m\"\u001b[39m: index, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcolumns\u001b[39m\u001b[38;5;124m\"\u001b[39m: columns}, dtype\u001b[38;5;241m=\u001b[39mdtype, copy\u001b[38;5;241m=\u001b[39mcopy\n\u001b[1;32m 610\u001b[0m )\n\u001b[1;32m 612\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(data, \u001b[38;5;28mdict\u001b[39m):\n\u001b[1;32m 613\u001b[0m \u001b[38;5;66;03m# GH#38939 de facto copy defaults to False only in non-dict cases\u001b[39;00m\n\u001b[0;32m--> 614\u001b[0m mgr \u001b[38;5;241m=\u001b[39m \u001b[43mdict_to_mgr\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdata\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mindex\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcolumns\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdtype\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdtype\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcopy\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcopy\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtyp\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmanager\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 615\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(data, ma\u001b[38;5;241m.\u001b[39mMaskedArray):\n\u001b[1;32m 616\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mnumpy\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mma\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mmrecords\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mmrecords\u001b[39;00m\n", - "File \u001b[0;32m~/sync/Typhoon-Impact-based-forecasting-model/venv/lib/python3.8/site-packages/pandas/core/internals/construction.py:449\u001b[0m, in \u001b[0;36mdict_to_mgr\u001b[0;34m(data, index, columns, dtype, typ, copy)\u001b[0m\n\u001b[1;32m 446\u001b[0m \u001b[38;5;66;03m# GH#24096 need copy to be deep for datetime64tz case\u001b[39;00m\n\u001b[1;32m 447\u001b[0m \u001b[38;5;66;03m# TODO: See if we can avoid these copies\u001b[39;00m\n\u001b[1;32m 448\u001b[0m arrays \u001b[38;5;241m=\u001b[39m [arr \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(arr, Index) \u001b[38;5;28;01melse\u001b[39;00m arr\u001b[38;5;241m.\u001b[39m_data \u001b[38;5;28;01mfor\u001b[39;00m arr \u001b[38;5;129;01min\u001b[39;00m arrays]\n\u001b[0;32m--> 449\u001b[0m arrays \u001b[38;5;241m=\u001b[39m [\n\u001b[1;32m 450\u001b[0m arr \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m is_datetime64tz_dtype(arr) \u001b[38;5;28;01melse\u001b[39;00m arr\u001b[38;5;241m.\u001b[39mcopy() \u001b[38;5;28;01mfor\u001b[39;00m arr \u001b[38;5;129;01min\u001b[39;00m arrays\n\u001b[1;32m 451\u001b[0m ]\n\u001b[1;32m 453\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m copy:\n\u001b[1;32m 454\u001b[0m \u001b[38;5;66;03m# arrays_to_mgr (via form_blocks) won't make copies for EAs\u001b[39;00m\n\u001b[1;32m 455\u001b[0m \u001b[38;5;66;03m# dtype attr check to exclude EADtype-castable strs\u001b[39;00m\n\u001b[1;32m 456\u001b[0m arrays \u001b[38;5;241m=\u001b[39m [\n\u001b[1;32m 457\u001b[0m x\n\u001b[1;32m 458\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mhasattr\u001b[39m(x, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdtype\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(x\u001b[38;5;241m.\u001b[39mdtype, ExtensionDtype)\n\u001b[1;32m 459\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m x\u001b[38;5;241m.\u001b[39mcopy()\n\u001b[1;32m 460\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m x \u001b[38;5;129;01min\u001b[39;00m arrays\n\u001b[1;32m 461\u001b[0m ]\n", - "File \u001b[0;32m~/sync/Typhoon-Impact-based-forecasting-model/venv/lib/python3.8/site-packages/pandas/core/internals/construction.py:450\u001b[0m, in \u001b[0;36m\u001b[0;34m(.0)\u001b[0m\n\u001b[1;32m 446\u001b[0m \u001b[38;5;66;03m# GH#24096 need copy to be deep for datetime64tz case\u001b[39;00m\n\u001b[1;32m 447\u001b[0m \u001b[38;5;66;03m# TODO: See if we can avoid these copies\u001b[39;00m\n\u001b[1;32m 448\u001b[0m arrays \u001b[38;5;241m=\u001b[39m [arr \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(arr, Index) \u001b[38;5;28;01melse\u001b[39;00m arr\u001b[38;5;241m.\u001b[39m_data \u001b[38;5;28;01mfor\u001b[39;00m arr \u001b[38;5;129;01min\u001b[39;00m arrays]\n\u001b[1;32m 449\u001b[0m arrays \u001b[38;5;241m=\u001b[39m [\n\u001b[0;32m--> 450\u001b[0m arr \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[43mis_datetime64tz_dtype\u001b[49m\u001b[43m(\u001b[49m\u001b[43marr\u001b[49m\u001b[43m)\u001b[49m \u001b[38;5;28;01melse\u001b[39;00m arr\u001b[38;5;241m.\u001b[39mcopy() \u001b[38;5;28;01mfor\u001b[39;00m arr \u001b[38;5;129;01min\u001b[39;00m arrays\n\u001b[1;32m 451\u001b[0m ]\n\u001b[1;32m 453\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m copy:\n\u001b[1;32m 454\u001b[0m \u001b[38;5;66;03m# arrays_to_mgr (via form_blocks) won't make copies for EAs\u001b[39;00m\n\u001b[1;32m 455\u001b[0m \u001b[38;5;66;03m# dtype attr check to exclude EADtype-castable strs\u001b[39;00m\n\u001b[1;32m 456\u001b[0m arrays \u001b[38;5;241m=\u001b[39m [\n\u001b[1;32m 457\u001b[0m x\n\u001b[1;32m 458\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mhasattr\u001b[39m(x, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdtype\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(x\u001b[38;5;241m.\u001b[39mdtype, ExtensionDtype)\n\u001b[1;32m 459\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m x\u001b[38;5;241m.\u001b[39mcopy()\n\u001b[1;32m 460\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m x \u001b[38;5;129;01min\u001b[39;00m arrays\n\u001b[1;32m 461\u001b[0m ]\n", - "File \u001b[0;32m~/sync/Typhoon-Impact-based-forecasting-model/venv/lib/python3.8/site-packages/pandas/core/dtypes/common.py:385\u001b[0m, in \u001b[0;36mis_datetime64tz_dtype\u001b[0;34m(arr_or_dtype)\u001b[0m\n\u001b[1;32m 383\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m arr_or_dtype \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 384\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[0;32m--> 385\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mDatetimeTZDtype\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mis_dtype\u001b[49m\u001b[43m(\u001b[49m\u001b[43marr_or_dtype\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/sync/Typhoon-Impact-based-forecasting-model/venv/lib/python3.8/site-packages/pandas/core/dtypes/base.py:289\u001b[0m, in \u001b[0;36mExtensionDtype.is_dtype\u001b[0;34m(cls, dtype)\u001b[0m\n\u001b[1;32m 265\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 266\u001b[0m \u001b[38;5;124;03mCheck if we match 'dtype'.\u001b[39;00m\n\u001b[1;32m 267\u001b[0m \n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 285\u001b[0m \u001b[38;5;124;03m conditions is true for ``dtype.dtype``.\u001b[39;00m\n\u001b[1;32m 286\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 287\u001b[0m dtype \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mgetattr\u001b[39m(dtype, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdtype\u001b[39m\u001b[38;5;124m\"\u001b[39m, dtype)\n\u001b[0;32m--> 289\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28;43misinstance\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mdtype\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m(\u001b[49m\u001b[43mABCSeries\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mABCIndex\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mABCDataFrame\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdtype\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m:\n\u001b[1;32m 290\u001b[0m \u001b[38;5;66;03m# https://github.com/pandas-dev/pandas/issues/22960\u001b[39;00m\n\u001b[1;32m 291\u001b[0m \u001b[38;5;66;03m# avoid passing data to `construct_from_string`. This could\u001b[39;00m\n\u001b[1;32m 292\u001b[0m \u001b[38;5;66;03m# cause a FutureWarning from numpy about failing elementwise\u001b[39;00m\n\u001b[1;32m 293\u001b[0m \u001b[38;5;66;03m# comparison from, e.g., comparing DataFrame == 'category'.\u001b[39;00m\n\u001b[1;32m 294\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[1;32m 295\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m dtype \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n", - "File \u001b[0;32m~/sync/Typhoon-Impact-based-forecasting-model/venv/lib/python3.8/site-packages/pandas/core/dtypes/generic.py:43\u001b[0m, in \u001b[0;36mcreate_pandas_abc_type.._check\u001b[0;34m(cls, inst)\u001b[0m\n\u001b[1;32m 39\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcreate_pandas_abc_type\u001b[39m(name, attr, comp):\n\u001b[1;32m 40\u001b[0m \n\u001b[1;32m 41\u001b[0m \u001b[38;5;66;03m# https://github.com/python/mypy/issues/1006\u001b[39;00m\n\u001b[1;32m 42\u001b[0m \u001b[38;5;66;03m# error: 'classmethod' used with a non-method\u001b[39;00m\n\u001b[0;32m---> 43\u001b[0m \u001b[38;5;129m@classmethod\u001b[39m \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 44\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_check\u001b[39m(\u001b[38;5;28mcls\u001b[39m, inst) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;28mbool\u001b[39m:\n\u001b[1;32m 45\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mgetattr\u001b[39m(inst, attr, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m_typ\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;129;01min\u001b[39;00m comp\n\u001b[1;32m 47\u001b[0m dct \u001b[38;5;241m=\u001b[39m {\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m__instancecheck__\u001b[39m\u001b[38;5;124m\"\u001b[39m: _check, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m__subclasscheck__\u001b[39m\u001b[38;5;124m\"\u001b[39m: _check}\n", - "\u001b[0;31mKeyboardInterrupt\u001b[0m: " - ] + "data": { + "text/plain": " mtype product cyc_number ensemble speed pressure \\\n1185 ensembleforecast ecmwf 25 0 13.3 1004.8 \n1186 ensembleforecast ecmwf 25 0 13.6 1005.5 \n1187 ensembleforecast ecmwf 25 0 13.5 1005.3 \n1188 ensembleforecast ecmwf 25 0 13.6 1005.1 \n1189 ensembleforecast ecmwf 25 0 21.3 1000.0 \n... ... ... ... ... ... ... \n1741 ensembleforecast ecmwf 25 50 20.0 999.8 \n1742 ensembleforecast ecmwf 25 50 28.3 992.1 \n1743 ensembleforecast ecmwf 25 50 36.7 984.1 \n1744 ensembleforecast ecmwf 25 50 32.7 983.0 \n1745 ensembleforecast ecmwf 25 50 39.5 976.3 \n\n time lat lon lead_time forecast_time \n1185 2006-11-27 12:00:00 9.8 136.8 0 2006-11-27 12:00:00 \n1186 2006-11-28 00:00:00 10.4 134.2 12 2006-11-27 12:00:00 \n1187 2006-11-28 12:00:00 11.3 130.6 24 2006-11-27 12:00:00 \n1188 2006-11-29 00:00:00 12.6 128.5 36 2006-11-27 12:00:00 \n1189 2006-11-29 12:00:00 13.0 126.0 48 2006-11-27 12:00:00 \n... ... ... ... ... ... \n1741 2006-11-30 12:00:00 12.3 122.0 72 2006-11-27 12:00:00 \n1742 2006-12-01 00:00:00 12.3 119.9 84 2006-11-27 12:00:00 \n1743 2006-12-01 12:00:00 13.0 117.9 96 2006-11-27 12:00:00 \n1744 2006-12-02 00:00:00 13.0 115.8 108 2006-11-27 12:00:00 \n1745 2006-12-02 12:00:00 12.7 114.0 120 2006-11-27 12:00:00 \n\n[561 rows x 11 columns]", + "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 \n \n \n \n \n \n \n \n \n \n \n \n
mtypeproductcyc_numberensemblespeedpressuretimelatlonlead_timeforecast_time
1185ensembleforecastecmwf25013.31004.82006-11-27 12:00:009.8136.802006-11-27 12:00:00
1186ensembleforecastecmwf25013.61005.52006-11-28 00:00:0010.4134.2122006-11-27 12:00:00
1187ensembleforecastecmwf25013.51005.32006-11-28 12:00:0011.3130.6242006-11-27 12:00:00
1188ensembleforecastecmwf25013.61005.12006-11-29 00:00:0012.6128.5362006-11-27 12:00:00
1189ensembleforecastecmwf25021.31000.02006-11-29 12:00:0013.0126.0482006-11-27 12:00:00
....................................
1741ensembleforecastecmwf255020.0999.82006-11-30 12:00:0012.3122.0722006-11-27 12:00:00
1742ensembleforecastecmwf255028.3992.12006-12-01 00:00:0012.3119.9842006-11-27 12:00:00
1743ensembleforecastecmwf255036.7984.12006-12-01 12:00:0013.0117.9962006-11-27 12:00:00
1744ensembleforecastecmwf255032.7983.02006-12-02 00:00:0013.0115.81082006-11-27 12:00:00
1745ensembleforecastecmwf255039.5976.32006-12-02 12:00:0012.7114.01202006-11-27 12:00:00
\n

561 rows × 11 columns

\n
" + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ - "# Get list of filenames\n", - "filename_list = sorted(list(Path(save_dir / \"xml\").glob('*.xml')))\n", - "for filename in filename_list:\n", - " xml2csv(filename)" - ] - }, - { - "cell_type": "markdown", - "id": "93bb0820-ca17-4d56-aab8-3adaf813ff5f", - "metadata": {}, - "source": [ - "## AKI CSVs" - ] + "df" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } }, { "cell_type": "code", "execution_count": null, - "id": "a25a3746-3d84-4bd9-8c9f-ed6d3102040f", - "metadata": {}, "outputs": [], - "source": [] + "source": [], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } }, { "cell_type": "code", - "execution_count": 3, - "id": "a8b92a22-ac21-4214-bb70-291077f2eb66", - "metadata": {}, + "execution_count": 76, "outputs": [], "source": [ - "import pandas as pd\n", - "import xarray as xr" - ] + "track_data = []\n", + "\n", + "for ensemble, group in df.groupby(\"ensemble\"):\n", + "\n", + " time_step = (group[\"time\"].values[1] - group[\"time\"].values[0]).astype('timedelta64[h]')\n", + " time_step = pd.to_timedelta(time_step).total_seconds() / 3600\n", + "\n", + " coords = dict(\n", + " time=([\"time\"], group[\"time\"]),\n", + " )\n", + " data_vars=dict(\n", + " max_sustained_wind=([\"time\"], group['speed']),\n", + " central_pressure=([\"time\"], group['pressure']),\n", + " lat=([\"time\"], group[\"lat\"]),\n", + " lon=([\"time\"], group[\"lon\"]),\n", + " time_step=([\"time\"], [time_step] * len(group))\n", + " )\n", + " attrs=dict(\n", + " max_sustained_wind_unit=\"m/s\",\n", + " central_pressure_unit=\"mb\",\n", + " name=typhoon_name.upper(),\n", + " data_provider=\"ECMWF\",\n", + " ensemble_number=ensemble,\n", + " is_ensemble=True,\n", + " forecast_time=forecast_date,\n", + " basin=\"W - North West Pacific\"\n", + " )\n", + "\n", + " ds = xr.Dataset(data_vars=data_vars, coords=coords, attrs=attrs).set_coords([\"lat\", \"lon\"])\n", + " track_data.append(ds)" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } }, { "cell_type": "code", - "execution_count": 5, - "id": "0a3b08fb-3054-47f5-879a-ecc403e22356", - "metadata": {}, - "outputs": [], + "execution_count": 78, + "outputs": [ + { + "data": { + "text/plain": "51" + }, + "execution_count": 78, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "data_dir = \"/home/turnerm/sync/aa_repo_data/Data/public/exploration/phl/ecmwf_forecast/CSVS2\"" - ] + "len(track_data)" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } }, { - "cell_type": "code", - "execution_count": 6, - "id": "1959216f-13e6-42b1-adb3-fb33f85bd076", - "metadata": {}, - "outputs": [], - "source": [ - "typhoon_name = \"rai\"\n", - "df = pd.read_csv(f\"{data_dir}/{typhoon_name}_all.csv\")" - ] + "cell_type": "markdown", + "source": [], + "metadata": { + "collapsed": false + } + }, + { + "cell_type": "markdown", + "source": [], + "metadata": { + "collapsed": false + } }, { "cell_type": "code", "execution_count": null, - "id": "88cb811d-5ef5-4a92-a5ad-5c72d3cb29e8", - "metadata": {}, "outputs": [], + "source": [], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } + }, + { + "cell_type": "code", + "execution_count": 69, + "outputs": [ + { + "data": { + "text/plain": "12.0" + }, + "execution_count": 69, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "track = xr.Dataset(\n", - " data_vars={\n", - " \"time_step\": (\"time\", np.full_like(df.forecast_time, 3, dtype=float)),\n", - " \"max_sustained_wind\": (\n", - " \"time\", df.cyc_speed, # conversion from kn to meter/s\n", - " ),\n", - " #\"environmental_pressure\": (\n", - " # \"time\",\n", - " # [1010]*len(dta_dict['SID']),\n", - " #),\n", - " #\"central_pressure\": (\"time\", dta_dict['USA_PRES']),\n", - " \"lat\": (\"time\", df.lat),\n", - " \"lon\": (\"time\", df.lon),\n", - " #\"radius_max_wind\": (\"time\",dta_dict['USA_RMW']),\n", - " #\"radius_oci\": (\"time\", [np.nan]*len(dta_dict['USA_RMW'])),\n", - " \"basin\": (\"time\", ['WP']*len(df)),\n", - "\n", - "\n", - " },\n", - " coords={\"time\": pd.date_range(\"1980-01-01\", periods=len(dta_dict['SID']), freq=\"3H\"),},\n", - " attrs={\n", - " \"max_sustained_wind_unit\": \"m/s\",\n", - " \"central_pressure_unit\": \"mb\",\n", - " \"name\": typhoon,\n", - " \"sid\": typhoon, # +str(forcast_df.ensemble_number),\n", - " \"orig_event_flag\": True,\n", - " \"data_provider\": 'ibtracs_usa',\n", - " \"id_no\": typhoon,\n", - " \"basin\": 'wp',\n", - " \"category\": dta_dict['Catagory'][0], \n", - "\n", - " },\n", - ")\n", - "track = track.set_coords([\"lat\", \"lon\"])" - ] + "time_step = (group[\"time\"].values[1] - group[\"time\"].values[0]).astype('timedelta64[h]')\n", + "time_step = pd.to_timedelta(time_step).total_seconds() / 3600\n", + "time_step" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } }, { "cell_type": "code", "execution_count": null, - "id": "f788ce75-0684-4a3d-9aa2-e7ac161a29ce", - "metadata": {}, "outputs": [], - "source": [ - "\n", - " dta_dict=data.query('SID==@typhoon').to_dict('list') \n", - " track = xr.Dataset(\n", - " data_vars={\n", - " \"time_step\": (\"time\", np.full_like(dta_dict['Timestep'], 3, dtype=float)),\n", - " \"max_sustained_wind\": (\n", - " \"time\", dta_dict['USA_WIND'], # conversion from kn to meter/s\n", - " ),\n", - " \"environmental_pressure\": (\n", - " \"time\",\n", - " [1010]*len(dta_dict['SID']),\n", - " ),\n", - " \"central_pressure\": (\"time\", dta_dict['USA_PRES']),\n", - " \"lat\": (\"time\", dta_dict['LAT']),\n", - " \"lon\": (\"time\", dta_dict['LON']),\n", - " \"radius_max_wind\": (\"time\",dta_dict['USA_RMW']),\n", - " \"radius_oci\": (\"time\", [np.nan]*len(dta_dict['USA_RMW'])),\n", - " \"basin\": (\"time\", ['WP']*len(dta_dict['USA_RMW'])),\n", - "\n", - "\n", - " },\n", - " coords={\"time\": pd.date_range(\"1980-01-01\", periods=len(dta_dict['SID']), freq=\"3H\"),},\n", - " attrs={\n", - " \"max_sustained_wind_unit\": \"m/s\",\n", - " \"central_pressure_unit\": \"mb\",\n", - " \"name\": typhoon,\n", - " \"sid\": typhoon, # +str(forcast_df.ensemble_number),\n", - " \"orig_event_flag\": True,\n", - " \"data_provider\": 'ibtracs_usa',\n", - " \"id_no\": typhoon,\n", - " \"basin\": 'wp',\n", - " \"category\": dta_dict['Catagory'][0], \n", - "\n", - " },\n", - " )\n", - " track = track.set_coords([\"lat\", \"lon\"])\n", - " return track" - ] + "source": [], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } } ], "metadata": { @@ -315,4 +286,4 @@ }, "nbformat": 4, "nbformat_minor": 5 -} +} \ No newline at end of file From acf5b54e726800b6c4f4519c72a9f048e9281660 Mon Sep 17 00:00:00 2001 From: turnerm Date: Tue, 23 Aug 2022 16:48:47 +0200 Subject: [PATCH 04/17] Changed model and added README --- .../utility_fun/read_in_hindcast.py | 15 +- analysis/hindcasts/01_download_hindcasts.py | 4 +- analysis/hindcasts/02_convert_to_csv.py | 4 +- analysis/hindcasts/README.MD | 32 ++ .../hindcasts/download_ecmwf_hindcasts.ipynb | 289 ------------------ 5 files changed, 48 insertions(+), 296 deletions(-) create mode 100644 analysis/hindcasts/README.MD delete mode 100644 analysis/hindcasts/download_ecmwf_hindcasts.ipynb diff --git a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/read_in_hindcast.py b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/read_in_hindcast.py index a97c4c6..6973ad3 100644 --- a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/read_in_hindcast.py +++ b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/read_in_hindcast.py @@ -1,13 +1,14 @@ from datetime import datetime from pathlib import Path +import numpy as np import xarray as xr import pandas as pd + def read_in_hindcast(typhoon_name: str, remote_dir: str, local_directory: str): # Read in the hindcast csv - print(remote_dir) - filename = Path(local_directory) / f"{typhoon_name}_all.csv" + filename = Path(local_directory) / f"{typhoon_name.lower()}_all.csv" forecast_time = datetime.strptime(remote_dir, "%Y%m%d%H%M%S") df = pd.read_csv(filename) @@ -31,7 +32,9 @@ def read_in_hindcast(typhoon_name: str, remote_dir: str, local_directory: str): central_pressure=(["time"], group['pressure']), lat=(["time"], group["lat"]), lon=(["time"], group["lon"]), - time_step=(["time"], [time_step] * len(group)) + time_step=(["time"], [time_step] * len(group)), + radius_max_wind = (["time"], [np.nan] * len(group)), + environmental_pressure = (["time"], [1010.] * len(group)), ) attrs=dict( max_sustained_wind_unit="m/s", @@ -41,7 +44,11 @@ def read_in_hindcast(typhoon_name: str, remote_dir: str, local_directory: str): ensemble_number=ensemble, is_ensemble=True, forecast_time=forecast_time, - basin="W - North West Pacific" + basin="W - North West Pacific", + sid=typhoon_name, + orig_event_flag=False, + id_no=None, + category=None ) ds = xr.Dataset(data_vars=data_vars, coords=coords, attrs=attrs).set_coords(["lat", "lon"]) tracks.append(ds) diff --git a/analysis/hindcasts/01_download_hindcasts.py b/analysis/hindcasts/01_download_hindcasts.py index 36d2f1b..7b5791b 100644 --- a/analysis/hindcasts/01_download_hindcasts.py +++ b/analysis/hindcasts/01_download_hindcasts.py @@ -5,8 +5,9 @@ from dateutil import rrule +from constants import save_dir -save_dir = Path("/home/turnerm/sync/aa_repo_data/Data/public/exploration/phl/ecmwf_hindcast") +save_dir = Path(save_dir) email = input('email: ') pswd = input('password: ') @@ -21,7 +22,6 @@ exit(1) start_date = datetime(2006, 10, 1, 0, 0, 0) -start_date = datetime(2020, 9, 7, 0, 0, 0) dspath = 'https://rda.ucar.edu/data/ds330.3/' date_list = rrule.rrule(rrule.HOURLY, dtstart=start_date, interval=12) verbose = True diff --git a/analysis/hindcasts/02_convert_to_csv.py b/analysis/hindcasts/02_convert_to_csv.py index 469ee0a..721ef2a 100644 --- a/analysis/hindcasts/02_convert_to_csv.py +++ b/analysis/hindcasts/02_convert_to_csv.py @@ -9,7 +9,9 @@ import xml.etree.ElementTree as ET from dateutil import rrule -save_dir = Path("/home/turnerm/sync/aa_repo_data/Data/public/exploration/phl/ecmwf_hindcast") +from constants import savedir + +save_dir = Path(savedir) filename = "../../IBF-Typhoon-model/data/wind_data/input/typhoon_events.csv" df_typhoons = pd.read_csv(filename) diff --git a/analysis/hindcasts/README.MD b/analysis/hindcasts/README.MD new file mode 100644 index 0000000..c223332 --- /dev/null +++ b/analysis/hindcasts/README.MD @@ -0,0 +1,32 @@ +# Hindcasts + +1. Make a file in this directory called `constants.py`. Add a variable + called `save_dir` that is a string and points to where you want to + save the hindcasts. +2. From this directory, execute: + ``` + python 01_download_hindcasts.py + ``` + This will download all the xml ECMWF hindcasts from rda.ucar.edu. + Note this takes a very long time (~1 day) and a lot of disk space. +3. Execute: + ``` + python 02_convert_to_csv.py + ``` + This uses the file `data/wind_data/input/typhoon_events.cs` (from + the fiducial dataset) to select typhoons to pull from the xml files, + and convert them to csv. +4. Run the main pipeline, here are some example parameters: + ```shell + run-typhoon-model \ + --no-azure \ + --use-hindcast \ + --remote_directory=20061127120000 \ + --typhoonname=DURIAN \ + --local-directory=${SAVE_DIR}/csv/ + ``` + For this example, the typhoon DURIAN is used, which made landfall on + 30 Nov 2006, therefore we run on 27 Nov 2006 12:00, to get the forecast + 72 hour ahead. For the local directory, we use the same one as specified + in `save_dir` in the constants file, plus `csv` because that is where + the csv summaries are located. \ No newline at end of file diff --git a/analysis/hindcasts/download_ecmwf_hindcasts.ipynb b/analysis/hindcasts/download_ecmwf_hindcasts.ipynb deleted file mode 100644 index 9acf805..0000000 --- a/analysis/hindcasts/download_ecmwf_hindcasts.ipynb +++ /dev/null @@ -1,289 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "47c17dcd-992a-40e6-9fb2-b5870a386561", - "metadata": {}, - "source": [ - "## Download ECMWF xml" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "id": "c686d0bd-5b1a-4df9-8a53-491f6452654e", - "metadata": {}, - "outputs": [], - "source": [ - "from pathlib import Path\n", - "from datetime import datetime, timedelta\n", - "\n", - "import pandas as pd\n", - "import xarray as xr\n", - "import numpy as np" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "id": "4049d1fa-7f65-41de-92d5-d29bc90c8bad", - "metadata": {}, - "outputs": [], - "source": [ - "save_dir = Path(\"/home/turnerm/sync/aa_repo_data/Data/public/exploration/phl/ecmwf_hindcast\")" - ] - }, - { - "cell_type": "markdown", - "id": "f0daafc8-56ab-4af3-b2d6-048f6224450f", - "metadata": { - "tags": [] - }, - "source": [ - "## Get typhoon names" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "id": "433c65c3-30c7-4668-be8e-7ba7ebb5083b", - "metadata": {}, - "outputs": [], - "source": [ - "filename = \"../../IBF-Typhoon-model/data/wind_data/input/typhoon_events.csv\"\n", - "df_typhoons = pd.read_csv(filename)\n", - "df_typhoons.columns = [\"local\", \"international\", \"year\"]\n", - "for cname in [\"local\", \"international\"]:\n", - " df_typhoons[cname] = df_typhoons[cname].str.lower()\n", - "df_typhoons = df_typhoons.sort_values(by=[\"year\", \"international\"])" - ] - }, - { - "cell_type": "markdown", - "id": "4bcd0dca-396f-43b4-8451-90b15ef794fc", - "metadata": {}, - "source": [ - "## Test with Durian" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "outputs": [], - "source": [ - "# Select a typhoon and a target date\n", - "typhoon_name = \"durian\"\n", - "landfall_date = datetime(2006, 11, 30, 12)" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } - }, - { - "cell_type": "code", - "execution_count": 18, - "id": "cf3feb29-f8f9-4176-b3ec-44ebd4f0b9d9", - "metadata": {}, - "outputs": [], - "source": [ - "filename = save_dir / f\"csv/{typhoon_name}_all.csv\"\n", - "forecast_date = landfall_date - timedelta(days=3)\n", - "\n", - "df = pd.read_csv(filename)\n", - "for cname in [\"time\", \"forecast_time\"]:\n", - " df[cname] = pd.to_datetime(df[cname])\n", - "df = df[df[\"mtype\"] == \"ensembleforecast\"]\n", - "df = df[df[\"forecast_time\"] == forecast_date]" - ] - }, - { - "cell_type": "code", - "execution_count": 29, - "outputs": [ - { - "data": { - "text/plain": " mtype product cyc_number ensemble speed pressure \\\n1185 ensembleforecast ecmwf 25 0 13.3 1004.8 \n1186 ensembleforecast ecmwf 25 0 13.6 1005.5 \n1187 ensembleforecast ecmwf 25 0 13.5 1005.3 \n1188 ensembleforecast ecmwf 25 0 13.6 1005.1 \n1189 ensembleforecast ecmwf 25 0 21.3 1000.0 \n... ... ... ... ... ... ... \n1741 ensembleforecast ecmwf 25 50 20.0 999.8 \n1742 ensembleforecast ecmwf 25 50 28.3 992.1 \n1743 ensembleforecast ecmwf 25 50 36.7 984.1 \n1744 ensembleforecast ecmwf 25 50 32.7 983.0 \n1745 ensembleforecast ecmwf 25 50 39.5 976.3 \n\n time lat lon lead_time forecast_time \n1185 2006-11-27 12:00:00 9.8 136.8 0 2006-11-27 12:00:00 \n1186 2006-11-28 00:00:00 10.4 134.2 12 2006-11-27 12:00:00 \n1187 2006-11-28 12:00:00 11.3 130.6 24 2006-11-27 12:00:00 \n1188 2006-11-29 00:00:00 12.6 128.5 36 2006-11-27 12:00:00 \n1189 2006-11-29 12:00:00 13.0 126.0 48 2006-11-27 12:00:00 \n... ... ... ... ... ... \n1741 2006-11-30 12:00:00 12.3 122.0 72 2006-11-27 12:00:00 \n1742 2006-12-01 00:00:00 12.3 119.9 84 2006-11-27 12:00:00 \n1743 2006-12-01 12:00:00 13.0 117.9 96 2006-11-27 12:00:00 \n1744 2006-12-02 00:00:00 13.0 115.8 108 2006-11-27 12:00:00 \n1745 2006-12-02 12:00:00 12.7 114.0 120 2006-11-27 12:00:00 \n\n[561 rows x 11 columns]", - "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 \n \n \n \n \n \n \n \n \n \n \n \n
mtypeproductcyc_numberensemblespeedpressuretimelatlonlead_timeforecast_time
1185ensembleforecastecmwf25013.31004.82006-11-27 12:00:009.8136.802006-11-27 12:00:00
1186ensembleforecastecmwf25013.61005.52006-11-28 00:00:0010.4134.2122006-11-27 12:00:00
1187ensembleforecastecmwf25013.51005.32006-11-28 12:00:0011.3130.6242006-11-27 12:00:00
1188ensembleforecastecmwf25013.61005.12006-11-29 00:00:0012.6128.5362006-11-27 12:00:00
1189ensembleforecastecmwf25021.31000.02006-11-29 12:00:0013.0126.0482006-11-27 12:00:00
....................................
1741ensembleforecastecmwf255020.0999.82006-11-30 12:00:0012.3122.0722006-11-27 12:00:00
1742ensembleforecastecmwf255028.3992.12006-12-01 00:00:0012.3119.9842006-11-27 12:00:00
1743ensembleforecastecmwf255036.7984.12006-12-01 12:00:0013.0117.9962006-11-27 12:00:00
1744ensembleforecastecmwf255032.7983.02006-12-02 00:00:0013.0115.81082006-11-27 12:00:00
1745ensembleforecastecmwf255039.5976.32006-12-02 12:00:0012.7114.01202006-11-27 12:00:00
\n

561 rows × 11 columns

\n
" - }, - "execution_count": 29, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } - }, - { - "cell_type": "code", - "execution_count": 76, - "outputs": [], - "source": [ - "track_data = []\n", - "\n", - "for ensemble, group in df.groupby(\"ensemble\"):\n", - "\n", - " time_step = (group[\"time\"].values[1] - group[\"time\"].values[0]).astype('timedelta64[h]')\n", - " time_step = pd.to_timedelta(time_step).total_seconds() / 3600\n", - "\n", - " coords = dict(\n", - " time=([\"time\"], group[\"time\"]),\n", - " )\n", - " data_vars=dict(\n", - " max_sustained_wind=([\"time\"], group['speed']),\n", - " central_pressure=([\"time\"], group['pressure']),\n", - " lat=([\"time\"], group[\"lat\"]),\n", - " lon=([\"time\"], group[\"lon\"]),\n", - " time_step=([\"time\"], [time_step] * len(group))\n", - " )\n", - " attrs=dict(\n", - " max_sustained_wind_unit=\"m/s\",\n", - " central_pressure_unit=\"mb\",\n", - " name=typhoon_name.upper(),\n", - " data_provider=\"ECMWF\",\n", - " ensemble_number=ensemble,\n", - " is_ensemble=True,\n", - " forecast_time=forecast_date,\n", - " basin=\"W - North West Pacific\"\n", - " )\n", - "\n", - " ds = xr.Dataset(data_vars=data_vars, coords=coords, attrs=attrs).set_coords([\"lat\", \"lon\"])\n", - " track_data.append(ds)" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } - }, - { - "cell_type": "code", - "execution_count": 78, - "outputs": [ - { - "data": { - "text/plain": "51" - }, - "execution_count": 78, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "len(track_data)" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } - }, - { - "cell_type": "markdown", - "source": [], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "markdown", - "source": [], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } - }, - { - "cell_type": "code", - "execution_count": 69, - "outputs": [ - { - "data": { - "text/plain": "12.0" - }, - "execution_count": 69, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "time_step = (group[\"time\"].values[1] - group[\"time\"].values[0]).astype('timedelta64[h]')\n", - "time_step = pd.to_timedelta(time_step).total_seconds() / 3600\n", - "time_step" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } - } - ], - "metadata": { - "kernelspec": { - "display_name": "typhoon", - "language": "python", - "name": "typhoon" - }, - "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.8.10" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} \ No newline at end of file From de22b21fbf129a9181bd5cfa17204cec358a46e6 Mon Sep 17 00:00:00 2001 From: turnerm Date: Tue, 23 Aug 2022 20:37:39 +0200 Subject: [PATCH 05/17] Fixed a couple of bugs --- analysis/hindcasts/01_download_hindcasts.py | 2 +- analysis/hindcasts/02_convert_to_csv.py | 14 +++----------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/analysis/hindcasts/01_download_hindcasts.py b/analysis/hindcasts/01_download_hindcasts.py index 7b5791b..9335bf1 100644 --- a/analysis/hindcasts/01_download_hindcasts.py +++ b/analysis/hindcasts/01_download_hindcasts.py @@ -23,7 +23,7 @@ start_date = datetime(2006, 10, 1, 0, 0, 0) dspath = 'https://rda.ucar.edu/data/ds330.3/' -date_list = rrule.rrule(rrule.HOURLY, dtstart=start_date, interval=12) +date_list = rrule.rrule(rrule.HOURLY, dtstart=start_date, until=datetime.utcnow().date(), interval=12) verbose = True diff --git a/analysis/hindcasts/02_convert_to_csv.py b/analysis/hindcasts/02_convert_to_csv.py index 721ef2a..7fd4562 100644 --- a/analysis/hindcasts/02_convert_to_csv.py +++ b/analysis/hindcasts/02_convert_to_csv.py @@ -1,17 +1,13 @@ -import sys, os -import requests -import getpass -from datetime import datetime +import os from pathlib import Path import re import pandas as pd import xml.etree.ElementTree as ET -from dateutil import rrule -from constants import savedir +from constants import save_dir -save_dir = Path(savedir) +save_dir = Path(save_dir) filename = "../../IBF-Typhoon-model/data/wind_data/input/typhoon_events.csv" df_typhoons = pd.read_csv(filename) @@ -24,10 +20,6 @@ def xml2csv(filename): print(f"{filename}") tree = ET.parse(filename) root = tree.getroot() - try: - model_name=root.find('header/generatingApplication/model/name').text - except AttributeError: - model_name = '' prod_center=root.find('header/productionCenter').text baseTime=root.find('header/baseTime').text From d4b1818beafddba6c1edff435ded6ab4862f0ae9 Mon Sep 17 00:00:00 2001 From: turnerm Date: Tue, 23 Aug 2022 21:42:56 +0200 Subject: [PATCH 06/17] Added exception catch --- .../documentation/notebooks/rainfalldownload.ipynb | 2 +- analysis/hindcasts/02_convert_to_csv.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/IBF-Typhoon-model/documentation/notebooks/rainfalldownload.ipynb b/IBF-Typhoon-model/documentation/notebooks/rainfalldownload.ipynb index 081b89b..caedfe3 100644 --- a/IBF-Typhoon-model/documentation/notebooks/rainfalldownload.ipynb +++ b/IBF-Typhoon-model/documentation/notebooks/rainfalldownload.ipynb @@ -1229,7 +1229,7 @@ "hash": "c56dc72bed4e123c21144b1399355bbd07b8d587f6360d6b6ea22ee2ab335a35" }, "kernelspec": { - "display_name": "Python 3.8.10 ('geo_env')", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, diff --git a/analysis/hindcasts/02_convert_to_csv.py b/analysis/hindcasts/02_convert_to_csv.py index 7fd4562..15ea7d9 100644 --- a/analysis/hindcasts/02_convert_to_csv.py +++ b/analysis/hindcasts/02_convert_to_csv.py @@ -5,6 +5,7 @@ import pandas as pd import xml.etree.ElementTree as ET + from constants import save_dir save_dir = Path(save_dir) @@ -18,7 +19,11 @@ def xml2csv(filename): print(f"{filename}") - tree = ET.parse(filename) + try: + tree = ET.parse(filename) + except ET.ParseError: + print("Error with file, skipping") + return root = tree.getroot() prod_center=root.find('header/productionCenter').text From 38065e4cc72495395803b5ef2e140947189f6178 Mon Sep 17 00:00:00 2001 From: turnerm Date: Wed, 24 Aug 2022 21:04:20 +0200 Subject: [PATCH 07/17] Add 10 min to one min conversion --- IBF-Typhoon-model/.Rhistory | 813 ++++++++++-------- IBF-Typhoon-model/run_model_V2.R | 1 - .../utility_fun/read_in_hindcast.py | 4 +- 3 files changed, 440 insertions(+), 378 deletions(-) diff --git a/IBF-Typhoon-model/.Rhistory b/IBF-Typhoon-model/.Rhistory index af3abd6..dba0b0f 100644 --- a/IBF-Typhoon-model/.Rhistory +++ b/IBF-Typhoon-model/.Rhistory @@ -1,111 +1,149 @@ -shiny::runApp('C:/Users/ATeklesadik/OneDrive - Rode Kruis/Documents/documents/IBF-system/trigger-model-development/flood/trigger-model/dashboard/IARP_trigger_dashboard/4d6a6b23b2b24be180e5bd67d38ab20f/4d6a6b23b2b24be180e5bd67d38ab20f~') #!/usr/bin/env Rscript -args = commandArgs(trailingOnly=TRUE) -#options(warn=-1) -suppressMessages(library(stringr)) -suppressMessages(library(ggplot2)) +args <- commandArgs(trailingOnly = TRUE) suppressMessages(library(dplyr)) suppressMessages(library(tidyr)) suppressMessages(library(tmap)) -suppressMessages(library(httr)) suppressMessages(library(sf)) suppressMessages(library(geojsonsf)) suppressMessages(library(raster)) -suppressMessages(library(ranger)) suppressMessages(library(rlang)) -suppressMessages(library(plyr)) suppressMessages(library(lubridate)) -suppressMessages(library(rNOMADS)) suppressMessages(library(ncdf4)) suppressMessages(library(huxtable)) suppressMessages(library(xgboost)) -rainfall_error = args[1] +suppressMessages(library(readr)) +rainfall_error <- args[1] sf_use_s2(FALSE) -path='C:/Users/ATeklesadik/OneDrive - Rode Kruis/Documents/documents/Typhoon-Impact-based-forecasting-model/IBF-Typhoon-model/' -#path='/home/fbf/' -#path='./' -main_directory<-path ########################################################################### -# ------------------------ import DATA ----------------------------------- -setwd(path) -source('lib_r/settings.R') -source('lib_r/data_cleaning_forecast.R') -source('lib_r/prepare_typhoon_input.R') -source('lib_r/track_interpolation.R') -source('lib_r/Read_rainfall_v2.R') -source('lib_r/Model_input_processing.R') -source('lib_r/run_prediction_model.R') -source('lib_r/Make_maps.R') -source('lib_r/Check_landfall_time.R') -# ------------------------ import DATA ----------------------------------- -#php_admin3 <- st_read(dsn=paste0(main_directory,'data-raw'),layer='phl_admin3_simpl2') -php_admin3 <- geojsonsf::geojson_sf(paste0(main_directory,'data-raw/phl_admin3_simpl2.geojson')) -#php_admin1 <- st_read(dsn=paste0(main_directory,'data-raw'),layer='phl_admin1_gadm_pcode') -php_admin1 <- geojsonsf::geojson_sf(paste0(main_directory,'data-raw/phl_admin1_gadm_pcode.geojson')) +# Constants +SUS_TO_GUST = 1.49 # sus to gust conversion, 1 min average +# See Table 1.1 here: https://library.wmo.int/doc_num.php?explnum_id=290 +MS_TO_MPH = 2.23694 # meters / second to miles per hour +source("lib_r/settings.R") +source("lib_r/data_cleaning_forecast.R") +source("lib_r/prepare_typhoon_input.R") +source("lib_r/track_interpolation.R") +source("lib_r/Read_rainfall_v2.R") +source("lib_r/settings.R") +source("lib_r/data_cleaning_forecast.R") +source("lib_r/prepare_typhoon_input.R") +source("lib_r/track_interpolation.R") +source("lib_r/Read_rainfall_v2.R") +source("lib_r/Model_input_processing.R") +source("lib_r/run_prediction_model.R") +source("lib_r/Make_maps.R") +source("lib_r/Check_landfall_time.R") +source("lib_r/damage_probability.R") +php_admin3 <- geojsonsf::geojson_sf("data-raw/gis_data/phl_admin3_simpl2.geojson") +php_admin1 <- geojsonsf::geojson_sf("data-raw/gis_data/phl_admin1_gadm_pcode.geojson") +php_admin3<-st_make_valid(php_admin3) +php_admin1<-st_make_valid(php_admin1) wshade <- php_admin3 -material_variable2 <- read.csv(paste0(main_directory,"data/material_variable2.csv")) -data_matrix_new_variables <- read.csv(paste0(main_directory,"data/data_matrix_new_variables.csv")) -geo_variable <- read.csv(paste0(main_directory,"data/geo_variable.csv")) +material_variable2 <- read.csv("data-raw/pre_disaster_indicators/material_variable2.csv") +data_matrix_new_variables <- read.csv("data-raw/landuse_stormsurge/data_matrix_new_variables.csv") +geo_variable <- read.csv("data-raw/topography/geo_variable.csv") wshade <- php_admin3 -xgmodel<-readRDS(paste0(main_directory,"/models/operational/xgboost_regression_v2.RDS"), refhook = NULL) +xgmodel <- readRDS("models/operational/xgboost_regression_v4.RDS", refhook = NULL) # load forecast data -typhoon_info_for_model <- read.csv(paste0(main_directory,"/forecast/Input/typhoon_info_for_model.csv")) -#typhoon_events <- read.csv(paste0(main_directory,'/forecast/Input/typhoon_info_for_model.csv')) -rain_directory <- as.character(typhoon_info_for_model[typhoon_info_for_model$source=='Rainfall',]$filename) -windfield_data <- as.character(typhoon_info_for_model[typhoon_info_for_model$source=='windfield',]$filename) -ECMWF_ <- as.character(typhoon_info_for_model[typhoon_info_for_model$source=='ecmwf',]$filename) -TRACK_DATA <- read.csv(ECMWF_)#%>%dplyr::mutate(STORMNAME=Typhoon_stormname, YYYYMMDDHH=format(strptime(YYYYMMDDHH, format = "%Y-%m-%d %H:%M:%S"), '%Y%m%d%H%00')) -Output_folder<-as.character(typhoon_info_for_model[typhoon_info_for_model$source=='Output_folder',]$filename) -forecast_time<-as.character(typhoon_info_for_model[typhoon_info_for_model$source=='ecmwf',]$time) -#------------------------- define functions --------------------------------- -ntile_na <- function(x,n){ +typhoon_info_for_model <- read.csv("forecast/Input/typhoon_info_for_model.csv") +rain_directory <- as.character( +typhoon_info_for_model[typhoon_info_for_model[["source"]] == "Rainfall", ][["filename"]] +) +windfield_data <- as.character( +typhoon_info_for_model[typhoon_info_for_model[["source"]] == "windfield", ][["filename"]] +) +ECMWF_ <- as.character( +typhoon_info_for_model[typhoon_info_for_model[["source"]] == "ecmwf", ][["filename"]] +) +TRACK_DATA <- read.csv(ECMWF_) # %>%dplyr::mutate(STORMNAME=Typhoon_stormname, YYYYMMDDHH=format(strptime(YYYYMMDDHH, format = "%Y-%m-%d %H:%M:%S"), '%Y%m%d%H%00')) +Output_folder <- as.character( +typhoon_info_for_model[typhoon_info_for_model[["source"]] == "Output_folder", ][["filename"]] +) +forecast_time <- as.character( +typhoon_info_for_model[typhoon_info_for_model[["source"]] == "ecmwf", ][["time"]] +) +ntile_na <- function(x, n) { notna <- !is.na(x) -out <- rep(NA_real_,length(x)) -out[notna] <- ntile(x[notna],n) +out <- rep(NA_real_, length(x)) +out[notna] <- ntile(x[notna], n) return(out) } -wind_grid <- read.csv(windfield_data)%>%dplyr::mutate(dis_track_min=ifelse(dis_track_min<1,1,dis_track_min),Mun_Code=adm3_pcode,pcode=as.factor(substr(adm3_pcode, 1, 10))) -View(wind_grid) +wind_grid <- read.csv(windfield_data) %>% +dplyr::mutate( +dis_track_min = ifelse(dis_track_min < 1, 1, dis_track_min), +Mun_Code = adm3_pcode, +pcode = as.factor(substr(adm3_pcode, 1, 10)) +) rainfall_ <- Read_rainfall_v2(wshade) View(rainfall_) -typhoon_hazard <- wind_grid%>% -left_join(rainfall_,by = "Mun_Code")%>% -dplyr::mutate(typhoon_name=name, -rainfall_24h=rainfall_24h, -ranfall_sum=rainfall_24h, -dist_track=dis_track_min, -gust_dur=0, -sust_dur=0, -vmax_gust=v_max*1.49, #sus to gust convrsion 1.49 -- 10 min average -vmax_gust_mph=v_max*1.49*2,23694, #mph 1.9 is factor to drive gust and sustained wind -vmax_sust_mph=v_max*2,23694, -vmax_sust=v_max)%>% #1.21 is conversion factor for 10 min average to 1min average -dplyr::select(Mun_Code,vmax_gust,vmax_gust_mph,vmax_sust_mph,vmax_sust,dist_track,rainfall_24h,gust_dur,sust_dur,ranfall_sum,storm_id,typhoon_name) +rainfall$24h <- rainfall$24h * 10 +rainfall[,1] +rainfall_[,1] +rainfall_[,2] <- rainfall_[,2] * 10 +rainfall_[,2] <- +View(rainfall_) +typhoon_hazard <- wind_grid %>% +left_join(rainfall_, by = "Mun_Code") %>% +dplyr::mutate( +typhoon_name = name, +rainfall_24h = rainfall_24h, +ranfall_sum = rainfall_24h, +dist_track = dis_track_min, +gust_dur = 0, +sust_dur = 0, +vmax_gust = v_max * SUS_TO_GUST, +vmax_gust_mph = v_max * SUS_TO_GUST * MS_TO_MPH, +vmax_sust_mph = v_max * MS_TO_MPH, +vmax_sust = v_max +) %>% +dplyr::select( +Mun_Code, vmax_gust, +vmax_gust_mph, vmax_sust_mph, +vmax_sust, dist_track, +rainfall_24h, gust_dur, +sust_dur, ranfall_sum, +storm_id, typhoon_name +) # BUILD DATA MATRIC FOR NEW TYPHOON data_new_typhoon1 <- geo_variable %>% -left_join(material_variable2 %>% dplyr::select(-Region,-Province,-Municipality_City), by = "Mun_Code") %>% -left_join(data_matrix_new_variables , by = "Mun_Code") %>% -left_join(typhoon_hazard , by = "Mun_Code")%>%na.omit() -data <- clean_typhoon_forecast_data_ensamble(data_new_typhoon1)#%>%na.omit() # Randomforests don't handle NAs, you can impute in the future -model_input<-data%>%dplyr::select(-GEN_typhoon_name, +left_join(material_variable2 %>% +dplyr::select( +-Region, +-Province, +-Municipality_City +), by = "Mun_Code") %>% +left_join(data_matrix_new_variables, by = "Mun_Code") %>% +left_join(typhoon_hazard, by = "Mun_Code") +typhoon_data_cleaned <- clean_typhoon_forecast_data_ensamble(data_new_typhoon1) # %>%na.omit() # Randomforests don't handle NAs, you can impute in the future +model_input <- typhoon_data_cleaned %>% dplyr::select( +-GEN_typhoon_name, -GEN_typhoon_id, -GEO_n_households, -GEN_mun_code, -index, #-GEN_mun_code, #-contains("INT_"), --contains('DAM_'), --GEN_mun_name) -test_x <- data.matrix(model_input) -xgb_test <- xgb.DMatrix(data=test_x) -y_predicted <- predict(xgmodel, xgb_test) -df_imact_forecast <- as.data.frame(y_predicted)%>% -dplyr::mutate(index= 1:length(y_predicted), -impact=y_predicted)%>%left_join(data , by = "index")%>%dplyr::mutate(dist50=ifelse(WEA_dist_track >= 50,0,1), -e_impact=ifelse(impact > 100,100,impact), -region=substr(GEN_mun_code, 1, 4), -Damaged_houses=as.integer(GEO_n_households*e_impact*0.01), -)%>%filter(WEA_dist_track<500)%>%dplyr::select(index, +-contains("DAM_"), +-GEN_mun_name +) +test_x <- data.matrix(model_input) +xgb_test <- xgb.DMatrix(data = test_x) +y_predicted <- predict(xgmodel, xgb_test) +df_impact_forecast <- as.data.frame(y_predicted) %>% +dplyr::mutate( +index = 1:length(y_predicted), +impact = y_predicted +) %>% +left_join(typhoon_data_cleaned, by = "index") %>% +dplyr::mutate( +dist50 = ifelse(WEA_dist_track >= 50, 0, 1), +e_impact = ifelse(impact > 100, 100, impact), +region = substr(GEN_mun_code, 1, 4), +Damaged_houses = as.integer(GEO_n_households * e_impact * 0.01), +) %>% +filter(WEA_dist_track < 100) %>% +dplyr::select( +index, region, GEN_mun_code, GEN_mun_name, @@ -114,37 +152,102 @@ GEN_typhoon_name, GEN_typhoon_id, WEA_dist_track, WEA_vmax_sust_mhp, -#GEN_mun_code, e_impact, dist50, -Damaged_houses -#GEN_typhoon_name, -#GEN_typhoon_id, -)%>%drop_na() -Typhoon_stormname <- as.character(unique(wind_grid$name)[1]) -df_imact_forecast_CERF<-df_imact_forecast%>%filter(region%in%c('PH05','PH08'))%>% -dplyr::summarise(CDamaged_houses = sum(Damaged_houses))%>% -dplyr::mutate(DM_CLASS = ifelse(CDamaged_houses >= 80000,5, -ifelse(CDamaged_houses >= 50000,4, -ifelse(CDamaged_houses >= 30000,3, -ifelse(CDamaged_houses >= 10000,2, -ifelse(CDamaged_houses >= 5000,1, 0))))))%>% -ungroup()%>%group_by(GEN_typhoon_name)%>% -dplyr::summarise(VH_80K = round(100*sum(DM_CLASS>=5)/52), -H_50K = round(100*sum(DM_CLASS>=4)/52), -H_30K = round(100*sum(DM_CLASS>=3)/52), -M_10K = round(100*sum(DM_CLASS >=2)/52), -L_5K = round(100*sum(DM_CLASS>=1)/52))%>%dplyr::rename(Typhoon_name=GEN_typhoon_name)%>% -mutate( -Typhoon_name = toupper(Typhoon_name) +Damaged_houses, +) %>% +drop_na() %>% +# Add 0 damage tracks to any municipalities with missing members +# Note that after this step the index is NA for the 0 damage members +tidyr::complete( +GEN_typhoon_id, +nesting( +region, +GEN_mun_code, +GEN_mun_name, +GEO_n_households, +GEN_typhoon_name +), +fill = list( +WEA_vmax_sust_mhp = 0, +e_impact = 0, +dist50 = 0, +Damaged_houses = 0 ) -df_imact_forecast <- as.data.frame(y_predicted)%>% -dplyr::mutate(index= 1:length(y_predicted), -impact=y_predicted)%>%left_join(data , by = "index")%>%dplyr::mutate(dist50=ifelse(WEA_dist_track >= 50,0,1), -e_impact=ifelse(impact > 100,100,impact), -region=substr(GEN_mun_code, 1, 4), -Damaged_houses=as.integer(GEO_n_households*e_impact*0.01), -)%>%filter(WEA_dist_track<500)%>%dplyr::select(index, +) +Typhoon_stormname <- as.character(unique(wind_grid[["name"]])[1]) +# Only select regions 5, 8 and 13 +cerf_regions <- c("PH05", "PH08", "PH16") +cerf_damage_thresholds <- c(80000, 50000, 30000, 10000, 5000) +cerf_probabilities <- c(0.95, 0.80, 0.70, 0.60, 0.50) +df_impact_forecast_CERF <- get_total_impact_forecast( +df_impact_forecast %>% filter(region %in% cerf_regions), +cerf_damage_thresholds, cerf_probabilities, "CERF" +) +View(df_impact_forecast_CERF) +rainfall_[,2] <- rainfall_[,2] * 10 +typhoon_hazard <- wind_grid %>% +left_join(rainfall_, by = "Mun_Code") %>% +dplyr::mutate( +typhoon_name = name, +rainfall_24h = rainfall_24h, +ranfall_sum = rainfall_24h, +dist_track = dis_track_min, +gust_dur = 0, +sust_dur = 0, +vmax_gust = v_max * SUS_TO_GUST, +vmax_gust_mph = v_max * SUS_TO_GUST * MS_TO_MPH, +vmax_sust_mph = v_max * MS_TO_MPH, +vmax_sust = v_max +) %>% +dplyr::select( +Mun_Code, vmax_gust, +vmax_gust_mph, vmax_sust_mph, +vmax_sust, dist_track, +rainfall_24h, gust_dur, +sust_dur, ranfall_sum, +storm_id, typhoon_name +) +# BUILD DATA MATRIC FOR NEW TYPHOON +data_new_typhoon1 <- geo_variable %>% +left_join(material_variable2 %>% +dplyr::select( +-Region, +-Province, +-Municipality_City +), by = "Mun_Code") %>% +left_join(data_matrix_new_variables, by = "Mun_Code") %>% +left_join(typhoon_hazard, by = "Mun_Code") +typhoon_data_cleaned <- clean_typhoon_forecast_data_ensamble(data_new_typhoon1) # %>%na.omit() # Randomforests don't handle NAs, you can impute in the future +model_input <- typhoon_data_cleaned %>% dplyr::select( +-GEN_typhoon_name, +-GEN_typhoon_id, +-GEO_n_households, +-GEN_mun_code, +-index, +#-GEN_mun_code, +#-contains("INT_"), +-contains("DAM_"), +-GEN_mun_name +) +test_x <- data.matrix(model_input) +xgb_test <- xgb.DMatrix(data = test_x) +y_predicted <- predict(xgmodel, xgb_test) +df_impact_forecast <- as.data.frame(y_predicted) %>% +dplyr::mutate( +index = 1:length(y_predicted), +impact = y_predicted +) %>% +left_join(typhoon_data_cleaned, by = "index") %>% +dplyr::mutate( +dist50 = ifelse(WEA_dist_track >= 50, 0, 1), +e_impact = ifelse(impact > 100, 100, impact), +region = substr(GEN_mun_code, 1, 4), +Damaged_houses = as.integer(GEO_n_households * e_impact * 0.01), +) %>% +filter(WEA_dist_track < 100) %>% +dplyr::select( +index, region, GEN_mun_code, GEN_mun_name, @@ -153,20 +256,104 @@ GEN_typhoon_name, GEN_typhoon_id, WEA_dist_track, WEA_vmax_sust_mhp, -#GEN_mun_code, e_impact, dist50, -Damaged_houses -GEN_typhoon_name, -#GEN_typhoon_id, -)%>%drop_na() -df_imact_forecast <- as.data.frame(y_predicted)%>% -dplyr::mutate(index= 1:length(y_predicted), -impact=y_predicted)%>%left_join(data , by = "index")%>%dplyr::mutate(dist50=ifelse(WEA_dist_track >= 50,0,1), -e_impact=ifelse(impact > 100,100,impact), -region=substr(GEN_mun_code, 1, 4), -Damaged_houses=as.integer(GEO_n_households*e_impact*0.01), -)%>%filter(WEA_dist_track<500)%>%dplyr::select(index, +Damaged_houses, +) %>% +drop_na() %>% +# Add 0 damage tracks to any municipalities with missing members +# Note that after this step the index is NA for the 0 damage members +tidyr::complete( +GEN_typhoon_id, +nesting( +region, +GEN_mun_code, +GEN_mun_name, +GEO_n_households, +GEN_typhoon_name +), +fill = list( +WEA_vmax_sust_mhp = 0, +e_impact = 0, +dist50 = 0, +Damaged_houses = 0 +) +) +Typhoon_stormname <- as.character(unique(wind_grid[["name"]])[1]) +# Only select regions 5, 8 and 13 +cerf_regions <- c("PH05", "PH08", "PH16") +cerf_damage_thresholds <- c(80000, 50000, 30000, 10000, 5000) +cerf_probabilities <- c(0.95, 0.80, 0.70, 0.60, 0.50) +df_impact_forecast_CERF <- get_total_impact_forecast( +df_impact_forecast %>% filter(region %in% cerf_regions), +cerf_damage_thresholds, cerf_probabilities, "CERF" +) +View(df_impact_forecast_CERF) +View(rainfall_) +rainfall_ <- Read_rainfall_v2(wshade) +rainfall_[,2] <- rainfall_[,2] + 1000 +typhoon_hazard <- wind_grid %>% +left_join(rainfall_, by = "Mun_Code") %>% +dplyr::mutate( +typhoon_name = name, +rainfall_24h = rainfall_24h, +ranfall_sum = rainfall_24h, +dist_track = dis_track_min, +gust_dur = 0, +sust_dur = 0, +vmax_gust = v_max * SUS_TO_GUST, +vmax_gust_mph = v_max * SUS_TO_GUST * MS_TO_MPH, +vmax_sust_mph = v_max * MS_TO_MPH, +vmax_sust = v_max +) %>% +dplyr::select( +Mun_Code, vmax_gust, +vmax_gust_mph, vmax_sust_mph, +vmax_sust, dist_track, +rainfall_24h, gust_dur, +sust_dur, ranfall_sum, +storm_id, typhoon_name +) +# BUILD DATA MATRIC FOR NEW TYPHOON +data_new_typhoon1 <- geo_variable %>% +left_join(material_variable2 %>% +dplyr::select( +-Region, +-Province, +-Municipality_City +), by = "Mun_Code") %>% +left_join(data_matrix_new_variables, by = "Mun_Code") %>% +left_join(typhoon_hazard, by = "Mun_Code") +typhoon_data_cleaned <- clean_typhoon_forecast_data_ensamble(data_new_typhoon1) # %>%na.omit() # Randomforests don't handle NAs, you can impute in the future +model_input <- typhoon_data_cleaned %>% dplyr::select( +-GEN_typhoon_name, +-GEN_typhoon_id, +-GEO_n_households, +-GEN_mun_code, +-index, +#-GEN_mun_code, +#-contains("INT_"), +-contains("DAM_"), +-GEN_mun_name +) +test_x <- data.matrix(model_input) +xgb_test <- xgb.DMatrix(data = test_x) +y_predicted <- predict(xgmodel, xgb_test) +df_impact_forecast <- as.data.frame(y_predicted) %>% +dplyr::mutate( +index = 1:length(y_predicted), +impact = y_predicted +) %>% +left_join(typhoon_data_cleaned, by = "index") %>% +dplyr::mutate( +dist50 = ifelse(WEA_dist_track >= 50, 0, 1), +e_impact = ifelse(impact > 100, 100, impact), +region = substr(GEN_mun_code, 1, 4), +Damaged_houses = as.integer(GEO_n_households * e_impact * 0.01), +) %>% +filter(WEA_dist_track < 100) %>% +dplyr::select( +index, region, GEN_mun_code, GEN_mun_name, @@ -175,37 +362,102 @@ GEN_typhoon_name, GEN_typhoon_id, WEA_dist_track, WEA_vmax_sust_mhp, -#GEN_mun_code, e_impact, dist50, Damaged_houses, -GEN_typhoon_name, -#GEN_typhoon_id, -)%>%drop_na() -Typhoon_stormname <- as.character(unique(wind_grid$name)[1]) -df_imact_forecast_CERF<-df_imact_forecast%>%filter(region%in%c('PH05','PH08'))%>% -dplyr::summarise(CDamaged_houses = sum(Damaged_houses))%>% -dplyr::mutate(DM_CLASS = ifelse(CDamaged_houses >= 80000,5, -ifelse(CDamaged_houses >= 50000,4, -ifelse(CDamaged_houses >= 30000,3, -ifelse(CDamaged_houses >= 10000,2, -ifelse(CDamaged_houses >= 5000,1, 0))))))%>% -ungroup()%>%group_by(GEN_typhoon_name)%>% -dplyr::summarise(VH_80K = round(100*sum(DM_CLASS>=5)/52), -H_50K = round(100*sum(DM_CLASS>=4)/52), -H_30K = round(100*sum(DM_CLASS>=3)/52), -M_10K = round(100*sum(DM_CLASS >=2)/52), -L_5K = round(100*sum(DM_CLASS>=1)/52))%>%dplyr::rename(Typhoon_name=GEN_typhoon_name)%>% -mutate( -Typhoon_name = toupper(Typhoon_name) +) %>% +drop_na() %>% +# Add 0 damage tracks to any municipalities with missing members +# Note that after this step the index is NA for the 0 damage members +tidyr::complete( +GEN_typhoon_id, +nesting( +region, +GEN_mun_code, +GEN_mun_name, +GEO_n_households, +GEN_typhoon_name +), +fill = list( +WEA_vmax_sust_mhp = 0, +e_impact = 0, +dist50 = 0, +Damaged_houses = 0 +) ) -df_imact_forecast <- as.data.frame(y_predicted)%>% -dplyr::mutate(index= 1:length(y_predicted), -impact=y_predicted)%>%left_join(data , by = "index")%>%dplyr::mutate(dist50=ifelse(WEA_dist_track >= 50,0,1), -e_impact=ifelse(impact > 100,100,impact), -region=substr(GEN_mun_code, 1, 4), -Damaged_houses=as.integer(GEO_n_households*e_impact*0.01), -)%>%filter(WEA_dist_track<500)%>%dplyr::select(index, +Typhoon_stormname <- as.character(unique(wind_grid[["name"]])[1]) +# Only select regions 5, 8 and 13 +cerf_regions <- c("PH05", "PH08", "PH16") +cerf_damage_thresholds <- c(80000, 50000, 30000, 10000, 5000) +cerf_probabilities <- c(0.95, 0.80, 0.70, 0.60, 0.50) +df_impact_forecast_CERF <- get_total_impact_forecast( +df_impact_forecast %>% filter(region %in% cerf_regions), +cerf_damage_thresholds, cerf_probabilities, "CERF" +) +View(df_impact_forecast_CERF) +rainfall_[,2] <- rainfall_[,2] - 1000 +typhoon_hazard <- wind_grid %>% +left_join(rainfall_, by = "Mun_Code") %>% +dplyr::mutate( +typhoon_name = name, +rainfall_24h = rainfall_24h, +ranfall_sum = rainfall_24h, +dist_track = dis_track_min, +gust_dur = 0, +sust_dur = 0, +vmax_gust = v_max * SUS_TO_GUST, +vmax_gust_mph = v_max * SUS_TO_GUST * MS_TO_MPH, +vmax_sust_mph = v_max * MS_TO_MPH, +vmax_sust = v_max +) %>% +dplyr::select( +Mun_Code, vmax_gust, +vmax_gust_mph, vmax_sust_mph, +vmax_sust, dist_track, +rainfall_24h, gust_dur, +sust_dur, ranfall_sum, +storm_id, typhoon_name +) +# BUILD DATA MATRIC FOR NEW TYPHOON +data_new_typhoon1 <- geo_variable %>% +left_join(material_variable2 %>% +dplyr::select( +-Region, +-Province, +-Municipality_City +), by = "Mun_Code") %>% +left_join(data_matrix_new_variables, by = "Mun_Code") %>% +left_join(typhoon_hazard, by = "Mun_Code") +typhoon_data_cleaned <- clean_typhoon_forecast_data_ensamble(data_new_typhoon1) # %>%na.omit() # Randomforests don't handle NAs, you can impute in the future +model_input <- typhoon_data_cleaned %>% dplyr::select( +-GEN_typhoon_name, +-GEN_typhoon_id, +-GEO_n_households, +-GEN_mun_code, +-index, +#-GEN_mun_code, +#-contains("INT_"), +-contains("DAM_"), +-GEN_mun_name +) +test_x <- data.matrix(model_input) +xgb_test <- xgb.DMatrix(data = test_x) +y_predicted <- predict(xgmodel, xgb_test) +df_impact_forecast <- as.data.frame(y_predicted) %>% +dplyr::mutate( +index = 1:length(y_predicted), +impact = y_predicted +) %>% +left_join(typhoon_data_cleaned, by = "index") %>% +dplyr::mutate( +dist50 = ifelse(WEA_dist_track >= 50, 0, 1), +e_impact = ifelse(impact > 100, 100, impact), +region = substr(GEN_mun_code, 1, 4), +Damaged_houses = as.integer(GEO_n_households * e_impact * 0.01), +) %>% +filter(WEA_dist_track < 100) %>% +dplyr::select( +index, region, GEN_mun_code, GEN_mun_name, @@ -214,238 +466,47 @@ GEN_typhoon_name, GEN_typhoon_id, WEA_dist_track, WEA_vmax_sust_mhp, -#GEN_mun_code, e_impact, dist50, Damaged_houses, -#GEN_typhoon_name, -#GEN_typhoon_id, -)%>%drop_na() -Typhoon_stormname <- as.character(unique(wind_grid$name)[1]) -View(df_imact_forecast) -df_imact_forecast_CERF<-df_imact_forecast%>%filter(region%in%c('PH05','PH08'))%>% -dplyr::summarise(CDamaged_houses = sum(Damaged_houses))%>% -dplyr::mutate(DM_CLASS = ifelse(CDamaged_houses >= 80000,5, -ifelse(CDamaged_houses >= 50000,4, -ifelse(CDamaged_houses >= 30000,3, -ifelse(CDamaged_houses >= 10000,2, -ifelse(CDamaged_houses >= 5000,1, 0))))))%>% -ungroup()%>%group_by(GEN_typhoon_name)%>% -dplyr::summarise(VH_80K = round(100*sum(DM_CLASS>=5)/52), -H_50K = round(100*sum(DM_CLASS>=4)/52), -H_30K = round(100*sum(DM_CLASS>=3)/52), -M_10K = round(100*sum(DM_CLASS >=2)/52), -L_5K = round(100*sum(DM_CLASS>=1)/52))%>%dplyr::rename(Typhoon_name=GEN_typhoon_name)%>% -mutate( -Typhoon_name = toupper(GEN_typhoon_name) +) %>% +drop_na() %>% +# Add 0 damage tracks to any municipalities with missing members +# Note that after this step the index is NA for the 0 damage members +tidyr::complete( +GEN_typhoon_id, +nesting( +region, +GEN_mun_code, +GEN_mun_name, +GEO_n_households, +GEN_typhoon_name +), +fill = list( +WEA_vmax_sust_mhp = 0, +e_impact = 0, +dist50 = 0, +Damaged_houses = 0 +) +) +Typhoon_stormname <- as.character(unique(wind_grid[["name"]])[1]) +# Only select regions 5, 8 and 13 +cerf_regions <- c("PH05", "PH08", "PH16") +cerf_damage_thresholds <- c(80000, 50000, 30000, 10000, 5000) +cerf_probabilities <- c(0.95, 0.80, 0.70, 0.60, 0.50) +df_impact_forecast_CERF <- get_total_impact_forecast( +df_impact_forecast %>% filter(region %in% cerf_regions), +cerf_damage_thresholds, cerf_probabilities, "CERF" ) -df_imact_forecast_CERF<-df_imact_forecast%>%filter(region%in%c('PH05','PH08'))%>% -dplyr::summarise(CDamaged_houses = sum(Damaged_houses))%>% -dplyr::mutate(DM_CLASS = ifelse(CDamaged_houses >= 80000,5, -ifelse(CDamaged_houses >= 50000,4, -ifelse(CDamaged_houses >= 30000,3, -ifelse(CDamaged_houses >= 10000,2, -ifelse(CDamaged_houses >= 5000,1, 0))))))%>% -ungroup()%>%group_by(GEN_typhoon_name)%>% -dplyr::summarise(VH_80K = round(100*sum(DM_CLASS>=5)/52), -H_50K = round(100*sum(DM_CLASS>=4)/52), -H_30K = round(100*sum(DM_CLASS>=3)/52), -M_10K = round(100*sum(DM_CLASS >=2)/52), -L_5K = round(100*sum(DM_CLASS>=1)/52))%>%dplyr::rename(Typhoon_name=GEN_typhoon_name)%>% mutate(Typhoon_name = toupper(Typhoon_name)) -df_imact_forecast_CERF<-df_imact_forecast%>%filter(region%in%c('PH05','PH08'))%>% -dplyr::summarise(CDamaged_houses = sum(Damaged_houses))%>% -dplyr::mutate(DM_CLASS = ifelse(CDamaged_houses >= 80000,5, -ifelse(CDamaged_houses >= 50000,4, -ifelse(CDamaged_houses >= 30000,3, -ifelse(CDamaged_houses >= 10000,2, -ifelse(CDamaged_houses >= 5000,1, 0))))))%>% -ungroup()%>%group_by(GEN_typhoon_name)%>% -dplyr::summarise(VH_80K = round(100*sum(DM_CLASS>=5)/52), -H_50K = round(100*sum(DM_CLASS>=4)/52), -H_30K = round(100*sum(DM_CLASS>=3)/52), -M_10K = round(100*sum(DM_CLASS >=2)/52), -L_5K = round(100*sum(DM_CLASS>=1)/52))%>%ungroup()#%>%dplyr::rename(Typhoon_name=GEN_typhoon_name)%>% mutate(Typhoon_name = toupper(Typhoon_name)) -View(df_imact_forecast) -df_imact_forecast_CERF<-df_imact_forecast%>%filter(region%in%c('PH05','PH08'))%>% -dplyr::summarise(CDamaged_houses = sum(Damaged_houses))%>% -dplyr::mutate(DM_CLASS = ifelse(CDamaged_houses >= 80000,5, -ifelse(CDamaged_houses >= 50000,4, -ifelse(CDamaged_houses >= 30000,3, -ifelse(CDamaged_houses >= 10000,2, -ifelse(CDamaged_houses >= 5000,1, 0)))))) -View(df_imact_forecast_CERF) -df_imact_forecast_CERF<-df_imact_forecast%>%filter(region%in%c('PH05','PH08'))%>%group_by(GEN_typhoon_name)%>% -dplyr::summarise(CDamaged_houses = sum(Damaged_houses))%>%dplyr::mutate(DM_CLASS = ifelse(CDamaged_houses >= 80000,5, -ifelse(CDamaged_houses >= 50000,4, -ifelse(CDamaged_houses >= 30000,3, -ifelse(CDamaged_houses >= 10000,2, -ifelse(CDamaged_houses >= 5000,1, 0)))))) -View(df_imact_forecast_CERF) -View(df_imact_forecast) -df_imact_forecast_CERF<-df_imact_forecast%>%filter(region%in%c('PH02','PH08'))%>%group_by(GEN_typhoon_name)%>% -dplyr::summarise(CDamaged_houses = sum(Damaged_houses))%>%dplyr::mutate(DM_CLASS = ifelse(CDamaged_houses >= 80000,5, -ifelse(CDamaged_houses >= 50000,4, -ifelse(CDamaged_houses >= 30000,3, -ifelse(CDamaged_houses >= 10000,2, -ifelse(CDamaged_houses >= 5000,1, 0)))))) -View(df_imact_forecast_CERF) -View(df_imact_forecast_CERF) -df_imact_forecast_CERF<-df_imact_forecast%>%filter(region%in%c('PH02','PH08'))%>%group_by(GEN_typhoon_name)%>% -dplyr::summarise(CDamaged_houses = sum(Damaged_houses))%>%dplyr::mutate(DM_CLASS = ifelse(CDamaged_houses >= 80000,5, -ifelse(CDamaged_houses >= 50000,4, -ifelse(CDamaged_houses >= 30000,3, -ifelse(CDamaged_houses >= 10000,2, -ifelse(CDamaged_houses >= 5000,1, 0))))))%>% -ungroup()%>%group_by(GEN_typhoon_name)%>% -dplyr::summarise(VH_80K = round(100*sum(DM_CLASS>=5)/52), -H_50K = round(100*sum(DM_CLASS>=4)/52), -H_30K = round(100*sum(DM_CLASS>=3)/52), -M_10K = round(100*sum(DM_CLASS >=2)/52), -L_5K = round(100*sum(DM_CLASS>=1)/52))%>%ungroup() -View(df_imact_forecast_CERF) -df_imact_forecast_CERF<-df_imact_forecast%>%filter(region%in%c('PH02','PH08'))%>%group_by(GEN_typhoon_id)%>% -dplyr::summarise(CDamaged_houses = sum(Damaged_houses))%>%dplyr::mutate(DM_CLASS = ifelse(CDamaged_houses >= 80000,5, -ifelse(CDamaged_houses >= 50000,4, -ifelse(CDamaged_houses >= 30000,3, -ifelse(CDamaged_houses >= 10000,2, -ifelse(CDamaged_houses >= 5000,1, 0)))))) -View(df_imact_forecast_CERF) -df_imact_forecast_CERF<-df_imact_forecast%>%filter(region%in%c('PH02','PH08'))%>%group_by(GEN_typhoon_id)%>% -dplyr::summarise(CDamaged_houses = sum(Damaged_houses))%>%dplyr::mutate(DM_CLASS = ifelse(CDamaged_houses >= 80000,5, -ifelse(CDamaged_houses >= 50000,4, -ifelse(CDamaged_houses >= 30000,3, -ifelse(CDamaged_houses >= 100,2, -ifelse(CDamaged_houses >= 50,1, 0)))))) -View(df_imact_forecast_CERF) -View(df_imact_forecast_CERF) -df_imact_forecast_CERF<-df_imact_forecast%>%filter(region%in%c('PH02','PH08'))%>%group_by(GEN_typhoon_id)%>% -dplyr::summarise(CDamaged_houses = sum(Damaged_houses))%>%dplyr::mutate(DM_CLASS = ifelse(CDamaged_houses >= 80000,5, -ifelse(CDamaged_houses >= 50000,4, -ifelse(CDamaged_houses >= 30000,3, -ifelse(CDamaged_houses >= 100,2, -ifelse(CDamaged_houses >= 50,1, 0))))))%>%ungroup()%>%#group_by(GEN_typhoon_name)%>% -dplyr::summarise(VH_80K = round(100*sum(DM_CLASS>=5)/52), -H_50K = round(100*sum(DM_CLASS>=4)/52), -H_30K = round(100*sum(DM_CLASS>=3)/52), -M_10K = round(100*sum(DM_CLASS >=2)/52), -L_5K = round(100*sum(DM_CLASS>=1)/52)) -View(df_imact_forecast_CERF) -df_imact_forecast_CERF<-df_imact_forecast%>%filter(region%in%c('PH02','PH08'))%>%group_by(GEN_typhoon_id)%>% -dplyr::summarise(CDamaged_houses = sum(Damaged_houses))%>%dplyr::mutate(DM_CLASS = ifelse(CDamaged_houses >= 80000,5, -ifelse(CDamaged_houses >= 50000,4, -ifelse(CDamaged_houses >= 30000,3, -ifelse(CDamaged_houses >= 100,2, -ifelse(CDamaged_houses >= 50,1, 0))))))%>%ungroup()%>%#group_by(GEN_typhoon_name)%>% -dplyr::summarise(VH_80K = round(100*sum(DM_CLASS>=5)/52), -H_50K = round(100*sum(DM_CLASS>=4)/52), -H_30K = round(100*sum(DM_CLASS>=3)/52), -M_10K = round(100*sum(DM_CLASS >=2)/52), -L_5K = round(100*sum(DM_CLASS>=1)/52))%>%dplyr::mutate(Typhoon_name = toupper(Typhoon_stormname)) -View(df_imact_forecast_CERF) -df_imact_forecast_CERF<-df_imact_forecast%>%filter(region%in%c('PH02','PH08'))%>%group_by(GEN_typhoon_id)%>% -dplyr::summarise(CDamaged_houses = sum(Damaged_houses))%>%dplyr::mutate(DM_CLASS = ifelse(CDamaged_houses >= 80000,5, -ifelse(CDamaged_houses >= 50000,4, -ifelse(CDamaged_houses >= 30000,3, -ifelse(CDamaged_houses >= 100,2, -ifelse(CDamaged_houses >= 50,1, 0))))))%>%ungroup()%>%#group_by(GEN_typhoon_name)%>% -dplyr::summarise(VH_80K = round(100*sum(DM_CLASS>=5)/52), -H_50K = round(100*sum(DM_CLASS>=4)/52), -H_30K = round(100*sum(DM_CLASS>=3)/52), -M_10K = round(100*sum(DM_CLASS >=2)/52), -L_5K = round(100*sum(DM_CLASS>=1)/52))%>%dplyr::mutate(Typhoon_name = toupper(Typhoon_stormname)) -write.csv(df_imact_forecast_CERF, file = paste0(Output_folder,'CERF_TRIGGER_LEVEL_',forecast_time,'_', Typhoon_stormname,'.csv')) -df_imact_forecast_CERF%>% as_hux()%>% -set_text_color(1, everywhere, "blue")%>% -theme_article()%>%set_caption("PROBABILITY FOR THE NUMBER OF COMPLETELY DAMAGED BUILDINGS") #(Region 5 and 8) -df_imact_forecast_CERF<-df_imact_forecast%>%filter(region%in%c('PH02','PH08'))%>%group_by(GEN_typhoon_name,GEN_typhoon_id)%>% -dplyr::summarise(CDamaged_houses = sum(Damaged_houses))%>%dplyr::mutate(DM_CLASS = ifelse(CDamaged_houses >= 80000,5, -ifelse(CDamaged_houses >= 50000,4, -ifelse(CDamaged_houses >= 30000,3, -ifelse(CDamaged_houses >= 100,2, -ifelse(CDamaged_houses >= 50,1, 0))))))%>%ungroup()%>%#group_by(GEN_typhoon_name)%>% -dplyr::summarise(VH_80K = round(100*sum(DM_CLASS>=5)/52), -H_50K = round(100*sum(DM_CLASS>=4)/52), -H_30K = round(100*sum(DM_CLASS>=3)/52), -M_10K = round(100*sum(DM_CLASS >=2)/52), -L_5K = round(100*sum(DM_CLASS>=1)/52))%>%dplyr::mutate(Typhoon_name = toupper(Typhoon_stormname)) -write.csv(df_imact_forecast_CERF, file = paste0(Output_folder,'CERF_TRIGGER_LEVEL_',forecast_time,'_', Typhoon_stormname,'.csv')) -df_imact_forecast_CERF%>% as_hux()%>% -set_text_color(1, everywhere, "blue")%>% -theme_article()%>%set_caption("PROBABILITY FOR THE NUMBER OF COMPLETELY DAMAGED BUILDINGS") #(Region 5 and 8) -df_imact_forecast_CERF<-df_imact_forecast%>%filter(region%in%c('PH02','PH08'))%>%group_by(GEN_typhoon_name,GEN_typhoon_id)%>% -dplyr::summarise(CDamaged_houses = sum(Damaged_houses))%>%dplyr::mutate(DM_CLASS = ifelse(CDamaged_houses >= 80000,5, -ifelse(CDamaged_houses >= 50000,4, -ifelse(CDamaged_houses >= 30000,3, -ifelse(CDamaged_houses >= 100,2, -ifelse(CDamaged_houses >= 50,1, 0))))))%>%ungroup()%>%#group_by(GEN_typhoon_name)%>% -dplyr::summarise(VH_80K = round(100*sum(DM_CLASS>=5)/52), -H_50K = round(100*sum(DM_CLASS>=4)/52), -H_30K = round(100*sum(DM_CLASS>=3)/52), -M_10K = round(100*sum(DM_CLASS >=2)/52), -L_5K = round(100*sum(DM_CLASS>=1)/52))%>%dplyr::mutate(Typhoon_name = toupper(Typhoon_stormname)) -write.csv(df_imact_forecast_CERF, file = paste0(Output_folder,'CERF_TRIGGER_LEVEL_',forecast_time,'_', Typhoon_stormname,'.csv')) -df_imact_forecast_CERF%>% as_hux()%>% -set_text_color(1, everywhere, "blue")%>% -theme_article()%>%set_caption("PROBABILITY FOR THE NUMBER OF COMPLETELY DAMAGED BUILDINGS") #(Region 5 and 8) -df_imact_forecast%>%filter(region%in%c('PH02','PH08'))%>%group_by(GEN_typhoon_name,GEN_typhoon_id)%>% -dplyr::summarise(CDamaged_houses = sum(Damaged_houses))%>%dplyr::mutate(DM_CLASS = ifelse(CDamaged_houses >= 80000,5, -ifelse(CDamaged_houses >= 50000,4, -ifelse(CDamaged_houses >= 30000,3, -ifelse(CDamaged_houses >= 100,2, -ifelse(CDamaged_houses >= 50,1, 0))))))%>%ungroup() -df_imact_forecast%>%filter(region%in%c('PH02','PH08'))%>%group_by(GEN_typhoon_name,GEN_typhoon_id)%>% -dplyr::summarise(CDamaged_houses = sum(Damaged_houses))%>%dplyr::mutate(DM_CLASS = ifelse(CDamaged_houses >= 80000,5, -ifelse(CDamaged_houses >= 50000,4, -ifelse(CDamaged_houses >= 30000,3, -ifelse(CDamaged_houses >= 100,2, -ifelse(CDamaged_houses >= 50,1, 0))))))%>%ungroup()%>%group_by(GEN_typhoon_name)%>% -dplyr::summarise(VH_80K = round(100*sum(DM_CLASS>=5)/52), -H_50K = round(100*sum(DM_CLASS>=4)/52), -H_30K = round(100*sum(DM_CLASS>=3)/52), -M_10K = round(100*sum(DM_CLASS >=2)/52), -L_5K = round(100*sum(DM_CLASS>=1)/52))%>%ungroup()%>%dplyr::mutate(Typhoon_name = toupper(Typhoon_stormname)) -df_imact_forecast_CERF<-df_imact_forecast%>%filter(region%in%c('PH02','PH08'))%>%group_by(GEN_typhoon_name,GEN_typhoon_id)%>% -dplyr::summarise(CDamaged_houses = sum(Damaged_houses))%>%dplyr::mutate(DM_CLASS = ifelse(CDamaged_houses >= 80000,5, -ifelse(CDamaged_houses >= 50000,4, -ifelse(CDamaged_houses >= 30000,3, -ifelse(CDamaged_houses >= 100,2, -ifelse(CDamaged_houses >= 50,1, 0))))))%>%ungroup()%>%group_by(GEN_typhoon_name)%>% -dplyr::summarise(VH_80K = round(100*sum(DM_CLASS>=5)/52), -H_50K = round(100*sum(DM_CLASS>=4)/52), -H_30K = round(100*sum(DM_CLASS>=3)/52), -M_10K = round(100*sum(DM_CLASS >=2)/52), -L_5K = round(100*sum(DM_CLASS>=1)/52))%>%ungroup()%>%dplyr::rename(Typhoon_name=GEN_typhoon_name) -write.csv(df_imact_forecast_CERF, file = paste0(Output_folder,'CERF_TRIGGER_LEVEL_',forecast_time,'_', Typhoon_stormname,'.csv')) -df_imact_forecast_CERF%>% as_hux()%>% -set_text_color(1, everywhere, "blue")%>% -theme_article()%>%set_caption("PROBABILITY FOR THE NUMBER OF COMPLETELY DAMAGED BUILDINGS") #(Region 5 and 8) -df_imact_forecast_dref<-df_imact_forecast%>%group_by(GEN_typhoon_name,GEN_typhoon_id)%>% -dplyr::summarise(CDamaged_houses = sum(Damaged_houses))%>% -dplyr::mutate(DM_CLASS = ifelse(CDamaged_houses >= 100000,5, -ifelse(CDamaged_houses >= 80000,4, -ifelse(CDamaged_houses >= 70000,3, -ifelse(CDamaged_houses >= 50000,2, -ifelse(CDamaged_houses >= 30000,1, 0))))))%>% -ungroup()%>%group_by(GEN_typhoon_name)%>% -dplyr::summarise(VH_100K = round(100*sum(DM_CLASS>=5)/52), -H_80K = round(100*sum(DM_CLASS>=4)/52), -H_70K = round(100*sum(DM_CLASS>=3)/52), -M_50K = round(100*sum(DM_CLASS >=2)/52), -L_30K = round(100*sum(DM_CLASS>=1)/52))%>%ungroup%>%dplyr::rename(Typhoon_name=GEN_typhoon_name) -df_imact_forecast_dref%>%as_hux()%>% -set_text_color(1, everywhere, "blue")%>% -theme_article()%>%set_caption("PROBABILITY FOR THE NUMBER OF COMPLETELY DAMAGED BUILDINGS") -write.csv(df_imact_forecast_dref, file = paste0(Output_folder,'DREF_TRIGGER_LEVEL_',forecast_time,'_', Typhoon_stormname,'.csv')) -number_ensambles<-length(unique(df_imact_forecast$GEN_typhoon_id)) -df_imact_dist50 <- aggregate(df_imact_forecast$dist50, by=list(GEN_mun_code=df_imact_forecast$GEN_mun_code), FUN=sum)%>% -dplyr::mutate(probability_dist50=100*x/number_ensambles)%>%dplyr::select(GEN_mun_code,probability_dist50)%>% -left_join(aggregate(df_imact_forecast$e_impact, by=list(GEN_mun_code=df_imact_forecast$GEN_mun_code), FUN=sum)%>% -dplyr::mutate(impact=x/number_ensambles)%>%dplyr::select(GEN_mun_code,impact),by='GEN_mun_code')%>% -left_join(aggregate(df_imact_forecast$WEA_dist_track, by=list(GEN_mun_code=df_imact_forecast$GEN_mun_code), FUN=sum)%>% -dplyr::mutate(WEA_dist_track=x/number_ensambles)%>%dplyr::select(GEN_mun_code,WEA_dist_track),by='GEN_mun_code') -df_impact<-df_imact_forecast%>%left_join(df_imact_dist50,by='GEN_mun_code') -# ------------------------ calculate probability ----------------------------------- -event_impact <- php_admin3%>%left_join(df_imact_dist50%>%dplyr::mutate(adm3_pcode=GEN_mun_code),by='adm3_pcode') -track <- track_interpolation(TRACK_DATA) %>%dplyr::mutate(Data_Provider='ECMWF_HRS') -maps <- Make_maps_avg(php_admin1,event_impact,track,TYF='ECMWF',Typhoon_stormname) -tmap_save(maps,filename = paste0(Output_folder,'Average_Impact_','_',forecast_time,'_', Typhoon_stormname,'.png'), width=20, height=24,dpi=600,units="cm") +dref_damage_thresholds <- c(100000, 80000, 70000, 50000, 30000) +dref_probabilities <- c(0.95, 0.80, 0.70, 0.60, 0.50) +df_impact_forecast_DREF <- get_total_impact_forecast(df_impact_forecast, +dref_damage_thresholds, +dref_probabilities, "DREF")%>% +dplyr::mutate(trigger = ifelse('100k' >= 50,1, +ifelse('80k' >= 60,1, +ifelse('70k' >= 50,1, +ifelse('50k' >= 80,1, +ifelse('30k' >= 95,1, 0)))))) +#write trigger to file +write.csv(df_impact_forecast_DREF,file = paste0(Output_folder, "trigger", "_", forecast_time, "_",Typhoon_stormname, ".csv")) diff --git a/IBF-Typhoon-model/run_model_V2.R b/IBF-Typhoon-model/run_model_V2.R index a63911e..a176380 100644 --- a/IBF-Typhoon-model/run_model_V2.R +++ b/IBF-Typhoon-model/run_model_V2.R @@ -98,7 +98,6 @@ wind_grid <- read.csv(windfield_data) %>% rainfall_ <- Read_rainfall_v2(wshade) - typhoon_hazard <- wind_grid %>% left_join(rainfall_, by = "Mun_Code") %>% dplyr::mutate( diff --git a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/read_in_hindcast.py b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/read_in_hindcast.py index 6973ad3..75f491b 100644 --- a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/read_in_hindcast.py +++ b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/read_in_hindcast.py @@ -5,6 +5,8 @@ import xarray as xr import pandas as pd +ONE_MIN_TO_TEN_MIN = 0.84 + def read_in_hindcast(typhoon_name: str, remote_dir: str, local_directory: str): # Read in the hindcast csv @@ -28,7 +30,7 @@ def read_in_hindcast(typhoon_name: str, remote_dir: str, local_directory: str): time=(["time"], group["time"]), ) data_vars=dict( - max_sustained_wind=(["time"], group['speed']), + max_sustained_wind=(["time"], group['speed'] / ONE_MIN_TO_TEN_MIN), central_pressure=(["time"], group['pressure']), lat=(["time"], group["lat"]), lon=(["time"], group["lon"]), From ca2e0436c281b6410b8150579d6abd346f914055 Mon Sep 17 00:00:00 2001 From: turnerm Date: Fri, 26 Aug 2022 16:42:02 +0200 Subject: [PATCH 08/17] Add interpolation --- .../src/typhoonmodel/utility_fun/forecast_process.py | 1 + 1 file changed, 1 insertion(+) diff --git a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/forecast_process.py b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/forecast_process.py index 75a9b1e..c887db4 100644 --- a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/forecast_process.py +++ b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/forecast_process.py @@ -119,6 +119,7 @@ def __init__(self,main_path, remote_dir,typhoonname, countryCodeISO3, admin_leve # This code allows several retries with some sleep time in between if use_hindcast: fcast_data = read_in_hindcast.read_in_hindcast(typhoonname, remote_dir, local_directory) + fcast_data = [track_data_clean.track_data_clean(tr) for tr in fcast_data] else: n_tries = 0 while True: From 0d41944f19625aa5d8779aad46708c4b49f54a54 Mon Sep 17 00:00:00 2001 From: turnerm Date: Fri, 16 Sep 2022 10:43:59 +0200 Subject: [PATCH 09/17] Fixed probabilities --- IBF-Typhoon-model/run_model_V2.R | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/IBF-Typhoon-model/run_model_V2.R b/IBF-Typhoon-model/run_model_V2.R index a176380..c12fa2a 100644 --- a/IBF-Typhoon-model/run_model_V2.R +++ b/IBF-Typhoon-model/run_model_V2.R @@ -97,6 +97,8 @@ wind_grid <- read.csv(windfield_data) %>% ) rainfall_ <- Read_rainfall_v2(wshade) +rainfall_[,2] <- rainfall_[,2] - 1000 + typhoon_hazard <- wind_grid %>% left_join(rainfall_, by = "Mun_Code") %>% @@ -217,7 +219,7 @@ Typhoon_stormname <- as.character(unique(wind_grid[["name"]])[1]) # Only select regions 5, 8 and 13 cerf_regions <- c("PH05", "PH08", "PH16") cerf_damage_thresholds <- c(80000, 50000, 30000, 10000, 5000) -cerf_probabilities <- c(0.95, 0.80, 0.70, 0.60, 0.50) +cerf_probabilities <- c(0.50, 0.60, 0.70, 0.80, 0.95) df_impact_forecast_CERF <- get_total_impact_forecast( df_impact_forecast %>% filter(region %in% cerf_regions), @@ -229,19 +231,12 @@ df_impact_forecast_CERF <- get_total_impact_forecast( # ------------------------ calculate and plot probability National ----------------------------------- dref_damage_thresholds <- c(100000, 80000, 70000, 50000, 30000) -dref_probabilities <- c(0.95, 0.80, 0.70, 0.60, 0.50) +dref_probabilities <- c(0.50, 0.60, 0.70, 0.80, 0.95) df_impact_forecast_DREF <- get_total_impact_forecast(df_impact_forecast, dref_damage_thresholds, dref_probabilities, "DREF")%>% - dplyr::mutate(trigger = ifelse('100k' >= 50,1, - ifelse('80k' >= 60,1, - ifelse('70k' >= 50,1, - ifelse('50k' >= 80,1, - ifelse('30k' >= 95,1, 0)))))) - -#write trigger to file -write.csv(df_impact_forecast_DREF,file = paste0(Output_folder, "trigger", "_", forecast_time, "_",Typhoon_stormname, ".csv")) + # ------------------------ calculate average impact vs probability ----------------------------------- From e7bd71c9c7980efaeacdf6c410f1928e6e47325a Mon Sep 17 00:00:00 2001 From: turnerm Date: Fri, 16 Sep 2022 12:10:03 +0200 Subject: [PATCH 10/17] Added synth rainfall --- .../src/typhoonmodel/pipeline.py | 1 + .../typhoonmodel/utility_fun/Rainfall_data.py | 14 +++++- .../utility_fun/forecast_process.py | 46 +++++++++++-------- 3 files changed, 40 insertions(+), 21 deletions(-) diff --git a/IBF-Typhoon-model/src/typhoonmodel/pipeline.py b/IBF-Typhoon-model/src/typhoonmodel/pipeline.py index 59d6111..930e01e 100644 --- a/IBF-Typhoon-model/src/typhoonmodel/pipeline.py +++ b/IBF-Typhoon-model/src/typhoonmodel/pipeline.py @@ -46,6 +46,7 @@ def main(path, remote_directory, use_hindcast, local_directory, typhoonname, no_ if not remote_directory or not local_directory or not typhoonname: logger.error("If you want to use a hindcast, you need to specify remote directory" "(for the forecast timestamp), a local directory, and the typhoon name") + logger.info(f"Running on hindcast {typhoonname}") Forecast(path, remote_dir, typhoonname, countryCodeISO3='PHP', admin_level=3, no_azure=no_azure, use_hindcast=use_hindcast, local_directory=local_directory) print('---------------------AUTOMATION SCRIPT FINISHED---------------------------------') diff --git a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/Rainfall_data.py b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/Rainfall_data.py index f51fa41..bff0a10 100644 --- a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/Rainfall_data.py +++ b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/Rainfall_data.py @@ -165,4 +165,16 @@ def zonal_stat_rain(filepath,admin): # Obtain list with maximum 6h rainfall maximum_6h = [max(x.values()) for x in final] return pd.DataFrame(maximum_6h) - \ No newline at end of file + + +def create_synthetic_rainfall(Input_folder): + # TODO: turn this into actual data from the past + logger.info("Creating synthetic rainfall dataset") + ADMIN_PATH = 'data-raw/gis_data/phl_admin3_simpl2.geojson' + admin = gpd.read_file(ADMIN_PATH) + df_rain = pd.DataFrame({ + "max_06h_rain": 250, + "max_24h_rain": 1000, + "Mun_Code": admin['adm3_pcode'].values, + }) + df_rain.to_csv(os.path.join(Input_folder, "rainfall/rain_data.csv"), index=False) diff --git a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/forecast_process.py b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/forecast_process.py index c887db4..7fdfea7 100644 --- a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/forecast_process.py +++ b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/forecast_process.py @@ -76,29 +76,34 @@ def __init__(self,main_path, remote_dir,typhoonname, countryCodeISO3, admin_leve self.Output_folder = Output_folder #download NOAA rainfall - try: - #Rainfall_data_window.download_rainfall_nomads(Input_folder,path,Alternative_data_point) - Rainfall_data.download_rainfall_nomads(self.Input_folder,self.main_path,self.Alternative_data_point) - rainfall_error=False - self.rainfall_data=pd.read_csv(os.path.join(self.Input_folder, "rainfall/rain_data.csv")) - except: - traceback.print_exc() - #logger.warning(f'Rainfall download failed, performing download in R script') - logger.info(f'Rainfall download failed, performing download in R script') - rainfall_error=True - self.rainfall_data=[] - ###### download UCL data - - try: - ucl_data.create_ucl_metadata(self.main_path, - self.UCL_USERNAME,self.UCL_PASSWORD) - ucl_data.process_ucl_data(self.main_path, - self.Input_folder,self.UCL_USERNAME,self.UCL_PASSWORD) - except: - logger.info(f'UCL download failed') + if use_hindcast: + Rainfall_data.create_synthetic_rainfall(self.Input_folder) + rainfall_error = False + else: + try: + #Rainfall_data_window.download_rainfall_nomads(Input_folder,path,Alternative_data_point) + Rainfall_data.download_rainfall_nomads(self.Input_folder,self.main_path,self.Alternative_data_point) + rainfall_error=False + self.rainfall_data=pd.read_csv(os.path.join(self.Input_folder, "rainfall/rain_data.csv")) + except: + traceback.print_exc() + #logger.warning(f'Rainfall download failed, performing download in R script') + logger.info(f'Rainfall download failed, performing download in R script') + rainfall_error=True + self.rainfall_data=[] + ###### download UCL data + + try: + ucl_data.create_ucl_metadata(self.main_path, + self.UCL_USERNAME,self.UCL_PASSWORD) + ucl_data.process_ucl_data(self.main_path, + self.Input_folder,self.UCL_USERNAME,self.UCL_PASSWORD) + except: + logger.info(f'UCL download failed') ##Create grid points to calculate Winfield + logger.info("Creating windfield") cent = Centroids() cent.set_raster_from_pnt_bounds((118,6,127,19), res=0.05) cent.check() @@ -118,6 +123,7 @@ def __init__(self,main_path, remote_dir,typhoonname, countryCodeISO3, admin_leve # Sometimes the ECMWF ftp server complains about too many requests # This code allows several retries with some sleep time in between if use_hindcast: + logger.info("Reading in hindcast data") fcast_data = read_in_hindcast.read_in_hindcast(typhoonname, remote_dir, local_directory) fcast_data = [track_data_clean.track_data_clean(tr) for tr in fcast_data] else: From 93def3b5afa09671a727a8f4ba02f1d2e2c89716 Mon Sep 17 00:00:00 2001 From: turnerm Date: Fri, 16 Sep 2022 12:32:36 +0200 Subject: [PATCH 11/17] Fixed synthetic rainfall and added hres --- .../typhoonmodel/utility_fun/Rainfall_data.py | 21 ++++++++++++------- .../utility_fun/read_in_hindcast.py | 10 +++++---- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/Rainfall_data.py b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/Rainfall_data.py index bff0a10..65384b7 100644 --- a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/Rainfall_data.py +++ b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/Rainfall_data.py @@ -170,11 +170,16 @@ def zonal_stat_rain(filepath,admin): def create_synthetic_rainfall(Input_folder): # TODO: turn this into actual data from the past logger.info("Creating synthetic rainfall dataset") - ADMIN_PATH = 'data-raw/gis_data/phl_admin3_simpl2.geojson' - admin = gpd.read_file(ADMIN_PATH) - df_rain = pd.DataFrame({ - "max_06h_rain": 250, - "max_24h_rain": 1000, - "Mun_Code": admin['adm3_pcode'].values, - }) - df_rain.to_csv(os.path.join(Input_folder, "rainfall/rain_data.csv"), index=False) + # Make the 24 h netcdf only + ds = xr.load_dataset('./data_raw/rainfall_synthetic_1000.csv') + rainfall_path = os.path.join(Input_folder, 'rainfall/rainfall_24.nc') + ds.to_netcdf(rainfall_path) + # Unclear that this csv is used + # ADMIN_PATH = 'data-raw/gis_data/phl_admin3_simpl2.geojson' + # admin = gpd.read_file(ADMIN_PATH) + # df_rain = pd.DataFrame({ + # "max_06h_rain": 250, + # "max_24h_rain": 1000, + # "Mun_Code": admin['adm3_pcode'].values, + # }) + # df_rain.to_csv(os.path.join(Input_folder, "rainfall/rain_data.csv"), index=False) diff --git a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/read_in_hindcast.py b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/read_in_hindcast.py index 75f491b..d4e13d6 100644 --- a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/read_in_hindcast.py +++ b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/read_in_hindcast.py @@ -11,18 +11,20 @@ def read_in_hindcast(typhoon_name: str, remote_dir: str, local_directory: str): # Read in the hindcast csv filename = Path(local_directory) / f"{typhoon_name.lower()}_all.csv" - forecast_time = datetime.strptime(remote_dir, "%Y%m%d%H%M%S") + forecast_time = datetime.strptime(remote_dir, "%Y%m%d%H%M%S") df = pd.read_csv(filename) for cname in ["time", "forecast_time"]: df[cname] = pd.to_datetime(df[cname]) - df = df[df["mtype"] == "ensembleforecast"] + df = df[df["mtype"].isin(["ensembleforecast", "forecast"])] df = df[df["forecast_time"] == forecast_time] # Format into a list of tracks tracks = [] for ensemble, group in df.groupby("ensemble"): + is_ensemble = True if group["mtype"] == "ensembleforecast" else False + time_step = (group["time"].values[1] - group["time"].values[0]).astype('timedelta64[h]') time_step = pd.to_timedelta(time_step).total_seconds() / 3600 @@ -43,8 +45,8 @@ def read_in_hindcast(typhoon_name: str, remote_dir: str, local_directory: str): central_pressure_unit="mb", name=typhoon_name.upper(), data_provider="ECMWF", - ensemble_number=ensemble, - is_ensemble=True, + ensemble_number=ensemble if is_ensemble else -1, + is_ensemble=is_ensemble, forecast_time=forecast_time, basin="W - North West Pacific", sid=typhoon_name, From 9fa3cad767dd5e36949232476a9b13915d3d4ca5 Mon Sep 17 00:00:00 2001 From: turnerm Date: Fri, 16 Sep 2022 12:54:09 +0200 Subject: [PATCH 12/17] Put back probs because order doesnt matter --- .../data-raw/rainfall_synthetic_1000.nc | Bin 0 -> 18737699 bytes IBF-Typhoon-model/run_model_V2.R | 6 +++--- .../typhoonmodel/utility_fun/Rainfall_data.py | 2 +- .../utility_fun/forecast_process.py | 1 + .../utility_fun/read_in_hindcast.py | 5 +++-- 5 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 IBF-Typhoon-model/data-raw/rainfall_synthetic_1000.nc diff --git a/IBF-Typhoon-model/data-raw/rainfall_synthetic_1000.nc b/IBF-Typhoon-model/data-raw/rainfall_synthetic_1000.nc new file mode 100644 index 0000000000000000000000000000000000000000..52c88511d950a1fde3ef8bb340cdd8fbd926c1e4 GIT binary patch literal 18737699 zcmeF(ZLA&lf!FcBADTMpZR=*+tm$^kX`bq|NqUk^6E|(zNgO*j&C{)&7B6Mj$HX`B zrLKLko#4LeAjB%{itep=P{fPX5fxHiKy~v15$$TlNbGJ5E5QYUlocQj4}xd~)fHR7 zD;CPkncw&!iL+_RqDp*D8-G1dXU>^3^SLuup7WO$AKd@mYd(BU=^i_FlT-~H(=-MC?Rm_8Z)a)myz_~3!93$v})&!=y@Iwt_N4XzH+o%N&7DP&ur8VU0h-J z_l2tcaM~rWnXlyd$rH~UK5?Xd#{SW*tlOHyOI$gza%Sbo@lm(Z(aEPrPoF%s{M3=t zXBNKDt)W|g_Xba&IdbCYkyA&9XX>7%+jE9z8J0SHYWeBqQ_ClwT0Y!8;lk&;cQ$OL zXWLbsZWrnn{^%tOA3gGo)1%WX?LwnF$9LX&+xRoLjqiDKeD}TMar^&;&z5#8Zz)&L zU&vEOjxTqwq+NXe=$@+p=t|#^`KJu=e z-CSF@Zr#%FCf)Mqzu9f)?j`>4+xa)X_d5r==e_Eux@X$5z558e$ByGi&a9ky_UQ7t z?uE6FfANVgeYM|{$FJLyH?kuR-S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td1_K)aYdD^$T1>R_1zhwKBdF^re?jKwGIw!iv(80FhMB!h5`0hjd7ax4! z!d>>2>=t}#YlV>je*qeWm z-8Gl2=jifNr`qq{TRHK}kLyp|VT%kM_PSxXeKQ`mfGuDP*aANuTcG;oYW_mhcIb8l z`+@zye&9IZ00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0Wz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/run_model_V2.R index c12fa2a..91ea5dd 100644 --- a/IBF-Typhoon-model/run_model_V2.R +++ b/IBF-Typhoon-model/run_model_V2.R @@ -219,7 +219,7 @@ Typhoon_stormname <- as.character(unique(wind_grid[["name"]])[1]) # Only select regions 5, 8 and 13 cerf_regions <- c("PH05", "PH08", "PH16") cerf_damage_thresholds <- c(80000, 50000, 30000, 10000, 5000) -cerf_probabilities <- c(0.50, 0.60, 0.70, 0.80, 0.95) +cerf_probabilities <- c(0.95, 0.80, 0.70, 0.60, 0.50) df_impact_forecast_CERF <- get_total_impact_forecast( df_impact_forecast %>% filter(region %in% cerf_regions), @@ -231,11 +231,11 @@ df_impact_forecast_CERF <- get_total_impact_forecast( # ------------------------ calculate and plot probability National ----------------------------------- dref_damage_thresholds <- c(100000, 80000, 70000, 50000, 30000) -dref_probabilities <- c(0.50, 0.60, 0.70, 0.80, 0.95) +dref_probabilities <- c(0.95, 0.80, 0.70, 0.60, 0.50) df_impact_forecast_DREF <- get_total_impact_forecast(df_impact_forecast, dref_damage_thresholds, - dref_probabilities, "DREF")%>% + dref_probabilities, "DREF") # ------------------------ calculate average impact vs probability ----------------------------------- diff --git a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/Rainfall_data.py b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/Rainfall_data.py index 65384b7..a4f7994 100644 --- a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/Rainfall_data.py +++ b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/Rainfall_data.py @@ -171,7 +171,7 @@ def create_synthetic_rainfall(Input_folder): # TODO: turn this into actual data from the past logger.info("Creating synthetic rainfall dataset") # Make the 24 h netcdf only - ds = xr.load_dataset('./data_raw/rainfall_synthetic_1000.csv') + ds = xr.load_dataset('./data-raw/rainfall_synthetic_1000.nc') rainfall_path = os.path.join(Input_folder, 'rainfall/rainfall_24.nc') ds.to_netcdf(rainfall_path) # Unclear that this csv is used diff --git a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/forecast_process.py b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/forecast_process.py index 7fdfea7..d465342 100644 --- a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/forecast_process.py +++ b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/forecast_process.py @@ -188,6 +188,7 @@ def __init__(self,main_path, remote_dir,typhoonname, countryCodeISO3, admin_leve fname.write(line_+'\n') # Adjust track time step data_forced=[tr.where(tr.time <= max(tr_HRS[0].time.values),drop=True) for tr in fcast_data] + # Use pressure from high res # data_forced = [track_data_clean.track_data_force_HRS(tr,HRS_SPEED) for tr in data_forced] # forced with HRS windspeed #data_forced= [track_data_clean.track_data_clean(tr) for tr in fcast_data] # taking speed of ENS diff --git a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/read_in_hindcast.py b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/read_in_hindcast.py index d4e13d6..fa47cd4 100644 --- a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/read_in_hindcast.py +++ b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/read_in_hindcast.py @@ -23,7 +23,8 @@ def read_in_hindcast(typhoon_name: str, remote_dir: str, local_directory: str): tracks = [] for ensemble, group in df.groupby("ensemble"): - is_ensemble = True if group["mtype"] == "ensembleforecast" else False + is_ensemble = False if ensemble == 'none' else True + #is_ensemble = True if group["mtype"].values[0] == "ensembleforecast" else False time_step = (group["time"].values[1] - group["time"].values[0]).astype('timedelta64[h]') time_step = pd.to_timedelta(time_step).total_seconds() / 3600 @@ -45,7 +46,7 @@ def read_in_hindcast(typhoon_name: str, remote_dir: str, local_directory: str): central_pressure_unit="mb", name=typhoon_name.upper(), data_provider="ECMWF", - ensemble_number=ensemble if is_ensemble else -1, + ensemble_number=ensemble, is_ensemble=is_ensemble, forecast_time=forecast_time, basin="W - North West Pacific", From 681ec5a30258bf9c07cfa5d8b627374944afa256 Mon Sep 17 00:00:00 2001 From: turnerm Date: Fri, 16 Sep 2022 12:56:22 +0200 Subject: [PATCH 13/17] Remove unused line --- .../src/typhoonmodel/utility_fun/read_in_hindcast.py | 1 - 1 file changed, 1 deletion(-) diff --git a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/read_in_hindcast.py b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/read_in_hindcast.py index fa47cd4..6e4f294 100644 --- a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/read_in_hindcast.py +++ b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/read_in_hindcast.py @@ -24,7 +24,6 @@ def read_in_hindcast(typhoon_name: str, remote_dir: str, local_directory: str): for ensemble, group in df.groupby("ensemble"): is_ensemble = False if ensemble == 'none' else True - #is_ensemble = True if group["mtype"].values[0] == "ensembleforecast" else False time_step = (group["time"].values[1] - group["time"].values[0]).astype('timedelta64[h]') time_step = pd.to_timedelta(time_step).total_seconds() / 3600 From b9d7e824a53de833f6a7615356a5a310d03fcafe Mon Sep 17 00:00:00 2001 From: turnerm Date: Fri, 16 Sep 2022 13:06:22 +0200 Subject: [PATCH 14/17] Forcing use of hres central pressure --- .../src/typhoonmodel/utility_fun/Rainfall_data.py | 6 +++++- .../src/typhoonmodel/utility_fun/forecast_process.py | 6 +++++- .../src/typhoonmodel/utility_fun/read_in_hindcast.py | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/Rainfall_data.py b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/Rainfall_data.py index a4f7994..cfaa04b 100644 --- a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/Rainfall_data.py +++ b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/Rainfall_data.py @@ -173,7 +173,11 @@ def create_synthetic_rainfall(Input_folder): # Make the 24 h netcdf only ds = xr.load_dataset('./data-raw/rainfall_synthetic_1000.nc') rainfall_path = os.path.join(Input_folder, 'rainfall/rainfall_24.nc') - ds.to_netcdf(rainfall_path) + # TODO: Fix this by deleting old file once I have internet to google it + try: + ds.to_netcdf(rainfall_path) + except PermissionError: + logger.warning("Can't overwrite old file, skipping") # Unclear that this csv is used # ADMIN_PATH = 'data-raw/gis_data/phl_admin3_simpl2.geojson' # admin = gpd.read_file(ADMIN_PATH) diff --git a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/forecast_process.py b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/forecast_process.py index d465342..962cf42 100644 --- a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/forecast_process.py +++ b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/forecast_process.py @@ -175,6 +175,7 @@ def __init__(self,main_path, remote_dir,typhoonname, countryCodeISO3, admin_leve if tr_HRS !=[]: HRS_SPEED=(tr_HRS[0].max_sustained_wind.values/0.84).tolist() ############# 0.84 is conversion factor for ECMWF 10MIN TO 1MIN AVERAGE + HRS_PRESSURE = tr_HRS[0].central_pressure.values dfff=tr_HRS[0].to_dataframe() dfff[['VMAX','LAT','LON']]=dfff[['max_sustained_wind','lat','lon']] dfff['YYYYMMDDHH']=dfff.index.values @@ -189,7 +190,10 @@ def __init__(self,main_path, remote_dir,typhoonname, countryCodeISO3, admin_leve # Adjust track time step data_forced=[tr.where(tr.time <= max(tr_HRS[0].time.values),drop=True) for tr in fcast_data] # Use pressure from high res - # data_forced = [track_data_clean.track_data_force_HRS(tr,HRS_SPEED) for tr in data_forced] # forced with HRS windspeed + # Setting pressure to high res pressure + for tr in data_forced: + tr["central_pressure"] = (('time'), HRS_PRESSURE) + # data_forced = [track_data_clean.track_data_force_HRS(tr,HRS_SPEED) for tr in data_forced] # forced with HRS windspeed #data_forced= [track_data_clean.track_data_clean(tr) for tr in fcast_data] # taking speed of ENS # interpolate to 3h steps from the original 6h diff --git a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/read_in_hindcast.py b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/read_in_hindcast.py index 6e4f294..72e2ed9 100644 --- a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/read_in_hindcast.py +++ b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/read_in_hindcast.py @@ -23,7 +23,7 @@ def read_in_hindcast(typhoon_name: str, remote_dir: str, local_directory: str): tracks = [] for ensemble, group in df.groupby("ensemble"): - is_ensemble = False if ensemble == 'none' else True + is_ensemble = 'False' if ensemble == 'none' else 'True' time_step = (group["time"].values[1] - group["time"].values[0]).astype('timedelta64[h]') time_step = pd.to_timedelta(time_step).total_seconds() / 3600 From acc29b4ed9b4a2639a916372c39d2ec7933c01eb Mon Sep 17 00:00:00 2001 From: turnerm Date: Fri, 16 Sep 2022 13:56:03 +0200 Subject: [PATCH 15/17] Fix rainfall --- .../typhoonmodel/utility_fun/Rainfall_data.py | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/Rainfall_data.py b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/Rainfall_data.py index cfaa04b..89b2246 100644 --- a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/Rainfall_data.py +++ b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/Rainfall_data.py @@ -168,22 +168,25 @@ def zonal_stat_rain(filepath,admin): def create_synthetic_rainfall(Input_folder): + # TODO: Why is only rainfall 24 used? # TODO: turn this into actual data from the past logger.info("Creating synthetic rainfall dataset") # Make the 24 h netcdf only ds = xr.load_dataset('./data-raw/rainfall_synthetic_1000.nc') - rainfall_path = os.path.join(Input_folder, 'rainfall/rainfall_24.nc') + rainfall_path = os.path.join(Input_folder, 'rainfall/') + if not os.path.exists(rainfall_path): + os.makedirs(rainfall_path) # TODO: Fix this by deleting old file once I have internet to google it try: - ds.to_netcdf(rainfall_path) + ds.to_netcdf(os.path.join(rainfall_path, "rainfall_24.nc")) except PermissionError: logger.warning("Can't overwrite old file, skipping") # Unclear that this csv is used - # ADMIN_PATH = 'data-raw/gis_data/phl_admin3_simpl2.geojson' - # admin = gpd.read_file(ADMIN_PATH) - # df_rain = pd.DataFrame({ - # "max_06h_rain": 250, - # "max_24h_rain": 1000, - # "Mun_Code": admin['adm3_pcode'].values, - # }) - # df_rain.to_csv(os.path.join(Input_folder, "rainfall/rain_data.csv"), index=False) + ADMIN_PATH = 'data-raw/gis_data/phl_admin3_simpl2.geojson' + admin = gpd.read_file(ADMIN_PATH) + df_rain = pd.DataFrame({ + "max_06h_rain": 250, + "max_24h_rain": 1000, + "Mun_Code": admin['adm3_pcode'].values, + }) + df_rain.to_csv(os.path.join(Input_folder, "rainfall/rain_data.csv"), index=False) From 75a53f3de060ef3807186922fc2a7972802aeb9f Mon Sep 17 00:00:00 2001 From: turnerm Date: Fri, 16 Sep 2022 21:37:55 +0200 Subject: [PATCH 16/17] Maybe fixed the pressure --- .../src/typhoonmodel/utility_fun/forecast_process.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/forecast_process.py b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/forecast_process.py index 962cf42..f5cd959 100644 --- a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/forecast_process.py +++ b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/forecast_process.py @@ -174,6 +174,8 @@ def __init__(self,main_path, remote_dir,typhoonname, countryCodeISO3, admin_leve tr_HRS=[tr for tr in fcast_data if (tr.is_ensemble=='False')] if tr_HRS !=[]: + # Make HRS track same length as the others + tr_HRS = [tr.where(tr.time <= max(fcast_data[0].time.values),drop=True) for tr in tr_HRS] HRS_SPEED=(tr_HRS[0].max_sustained_wind.values/0.84).tolist() ############# 0.84 is conversion factor for ECMWF 10MIN TO 1MIN AVERAGE HRS_PRESSURE = tr_HRS[0].central_pressure.values dfff=tr_HRS[0].to_dataframe() @@ -188,12 +190,14 @@ def __init__(self,main_path, remote_dir,typhoonname, countryCodeISO3, admin_leve #line_='Rainfall,'+'%sRainfall/' % Input_folder +','+ typhoons + ',' + date_dir #StormName # fname.write(line_+'\n') # Adjust track time step - data_forced=[tr.where(tr.time <= max(tr_HRS[0].time.values),drop=True) for tr in fcast_data] + data_forced = fcast_data + # data_forced=[tr.where(tr.time <= max(tr_HRS[0].time.values),drop=True) for tr in fcast_data] # Use pressure from high res + # TODO: need to make both time variables equal, check how they differ # Setting pressure to high res pressure for tr in data_forced: tr["central_pressure"] = (('time'), HRS_PRESSURE) - # data_forced = [track_data_clean.track_data_force_HRS(tr,HRS_SPEED) for tr in data_forced] # forced with HRS windspeed + data_forced = [track_data_clean.track_data_force_HRS(tr,HRS_SPEED) for tr in data_forced] # forced with HRS windspeed #data_forced= [track_data_clean.track_data_clean(tr) for tr in fcast_data] # taking speed of ENS # interpolate to 3h steps from the original 6h From 8c7d06fcea76e5276048f55d86ad46ab827f3a8f Mon Sep 17 00:00:00 2001 From: turnerm Date: Sat, 17 Sep 2022 16:46:08 +0800 Subject: [PATCH 17/17] Removed unneeded --- .../typhoonmodel/utility_fun/forecast_process.py | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/forecast_process.py b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/forecast_process.py index f5cd959..ab9482e 100644 --- a/IBF-Typhoon-model/src/typhoonmodel/utility_fun/forecast_process.py +++ b/IBF-Typhoon-model/src/typhoonmodel/utility_fun/forecast_process.py @@ -175,9 +175,6 @@ def __init__(self,main_path, remote_dir,typhoonname, countryCodeISO3, admin_leve if tr_HRS !=[]: # Make HRS track same length as the others - tr_HRS = [tr.where(tr.time <= max(fcast_data[0].time.values),drop=True) for tr in tr_HRS] - HRS_SPEED=(tr_HRS[0].max_sustained_wind.values/0.84).tolist() ############# 0.84 is conversion factor for ECMWF 10MIN TO 1MIN AVERAGE - HRS_PRESSURE = tr_HRS[0].central_pressure.values dfff=tr_HRS[0].to_dataframe() dfff[['VMAX','LAT','LON']]=dfff[['max_sustained_wind','lat','lon']] dfff['YYYYMMDDHH']=dfff.index.values @@ -192,16 +189,8 @@ def __init__(self,main_path, remote_dir,typhoonname, countryCodeISO3, admin_leve # Adjust track time step data_forced = fcast_data # data_forced=[tr.where(tr.time <= max(tr_HRS[0].time.values),drop=True) for tr in fcast_data] - # Use pressure from high res - # TODO: need to make both time variables equal, check how they differ - # Setting pressure to high res pressure - for tr in data_forced: - tr["central_pressure"] = (('time'), HRS_PRESSURE) - data_forced = [track_data_clean.track_data_force_HRS(tr,HRS_SPEED) for tr in data_forced] # forced with HRS windspeed - - #data_forced= [track_data_clean.track_data_clean(tr) for tr in fcast_data] # taking speed of ENS - # interpolate to 3h steps from the original 6h - #fcast_equal_timestep(3) + # TODO: Use pressure from high res + # Complicated because all tracks are diff length, some more or less than HRS else: len_ar=np.min([ len(var.lat.values) for var in fcast_data ]) lat_ = np.ma.mean( [ var.lat.values[:len_ar] for var in fcast_data ], axis=0 )