{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 139,
   "id": "eea46721-2898-411d-a80c-a908030c6977",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import geopandas as gpd\n",
    "import pandas as pd\n",
    "from shapely.geometry import Point, Polygon"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 140,
   "id": "17f63fe2-e5f6-48a3-94f8-74ef660b2868",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7f8391dc35b0>"
      ]
     },
     "execution_count": 140,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 119992 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "ori_data = np.load('./np_data/20200220.npy')\n",
    "data = ori_data[:,:,0].copy()\n",
    "plt.imshow(data, cmap='RdYlGn_r')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "326b7241-afc8-43ce-b15e-3154fbeaa2d6",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "d9248def-25ef-4ae9-8425-d3a4e851afda",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7fea807c26d0>"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 122688 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "data = ori_data[:,:,0].copy()\n",
    "plt.imshow(data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "d41b956d-03af-46df-8ec1-ef9fa5503ccf",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Figure size 640x480 with 0 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.clf()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "bef156fa-d565-4ce8-ab33-4da917342eb1",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 创建一个190x110的经纬度网格\n",
    "lon_min, lat_min = 114.025, 33.525\n",
    "lon_max, lat_max = 123.475, 38.975\n",
    "lon_step = (lon_max - lon_min) / 190\n",
    "lat_step = (lat_max - lat_min) / 110"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "1eb83907-4dff-497a-b481-3624a062a134",
   "metadata": {},
   "outputs": [],
   "source": [
    "lons = np.linspace(lon_min, lon_max, 190)\n",
    "lats = np.linspace(lat_min, lat_max, 110)\n",
    "lon_grid, lat_grid = np.meshgrid(lons, lats)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "9bf5b19f-0776-4562-a194-039e10e4c5e3",
   "metadata": {
    "scrolled": true,
    "tags": []
   },
   "outputs": [],
   "source": [
    "# 初始化一个空的GeoDataFrame\n",
    "gdf = gpd.GeoDataFrame(columns=['geometry', 'value'])\n",
    "\n",
    "# 将网格转换为多边形并添加到GeoDataFrame\n",
    "for i in range(lat_grid.shape[0] - 1):\n",
    "    for j in range(lat_grid.shape[1] - 1):\n",
    "        polygon = Polygon([\n",
    "            (lon_grid[i, j], lat_grid[i, j]),\n",
    "            (lon_grid[i, j+1], lat_grid[i, j+1]),\n",
    "            (lon_grid[i+1, j+1], lat_grid[i+1, j+1]),\n",
    "            (lon_grid[i+1, j], lat_grid[i+1, j])\n",
    "        ])\n",
    "        # 使用concat而不是append\n",
    "        gdf = pd.concat([gdf, gpd.GeoDataFrame({'geometry': [polygon], 'value': [data[i, j]]})], ignore_index=True)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "68817ef0-79d8-49e6-ada4-152f746d5e3c",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/tmp/ipykernel_7233/3979395723.py:2: FutureWarning: The geopandas.dataset module is deprecated and will be removed in GeoPandas 1.0. You can get the original 'naturalearth_lowres' data from https://www.naturalearthdata.com/downloads/110m-cultural-vectors/.\n",
      "  world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))\n"
     ]
    }
   ],
   "source": [
    "# 读取世界地图\n",
    "world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "8157b80b-a758-44f2-9739-62439b254786",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 60524 characters]",
      "text/plain": [
       "<Figure size 1000x1000 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig, ax = plt.subplots(1, 1, figsize=(10, 10))\n",
    "world.plot(ax=ax, color='white', edgecolor='black')\n",
    "\n",
    "# 绘制网格\n",
    "gdf.plot(ax=ax, column='value', legend=False, cmap='RdYlGn_r')\n",
    "# 设置地图范围\n",
    "ax.set_xlim(lon_min, lon_max)\n",
    "ax.set_ylim(lat_min, lat_max)\n",
    "plt.savefig('./origin.png', bbox_inches='tight')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "f98c3cb6-a13e-4b59-93f7-17706c5ef975",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "93c8c793-10bd-4e8c-aab8-7317103979b1",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "show_list = os.listdir('./out_mat/96/train/')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "79d57a73-909c-4c69-aa1a-82c04233b50e",
   "metadata": {},
   "outputs": [],
   "source": [
    "val_list = [x for x in show_list if '20201106' in x]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b6f213fe-5f61-4c32-a475-25d421b7f440",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "id": "0306308d-d578-4114-9bfb-e2ffc2e87219",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Figure size 640x480 with 0 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "for i, p in enumerate(val_list):\n",
    "    if i >= 10:\n",
    "        break\n",
    "    val_data = np.load(f'./out_mat/96/train/{p}')[:,:,0]\n",
    "    plt.imshow(val_data, cmap='RdYlGn_r')\n",
    "    plt.savefig(f'./figures/full/{i}.png', bbox_inches='tight')\n",
    "    plt.clf()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "id": "0e9bf439-bc45-4ffd-823c-153e0361d360",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['20200503-439.jpg',\n",
       " '20201212-1053.jpg',\n",
       " '20200416-1333.jpg',\n",
       " '20200505-626.jpg',\n",
       " '20200516-624.jpg']"
      ]
     },
     "execution_count": 69,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "masks = [x for x in os.listdir('./out_mat/96/mask/30/')][:5]\n",
    "masks"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "id": "4a69e0ab-cf00-402e-84f6-821ea5edd1e2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['20201106-859.npy',\n",
       " '20201106-866.npy',\n",
       " '20201106-1088.npy',\n",
       " '20201106-1142.npy',\n",
       " '20201106-1238.npy']"
      ]
     },
     "execution_count": 70,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "new_miss = val_list[5:10]\n",
    "new_miss"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "id": "cc86d982-d861-490c-9e5a-b94e9d18d9b1",
   "metadata": {},
   "outputs": [],
   "source": [
    "import cv2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "id": "847c5cce-8109-48e1-8041-7132e5f9c3b1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Figure size 640x480 with 0 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "for img, msk in zip(new_miss, masks):\n",
    "    img_np = np.load(f'./out_mat/96/train/{img}')[:,:,0]\n",
    "    msk_np = cv2.cvtColor(cv2.imread(f'./out_mat/96/mask/30/{msk}'), cv2.COLOR_BGR2GRAY)\n",
    "    msk_np_2 = msk_np.astype(float)\n",
    "    msk_np_2[msk_np_2 == 0] = np.nan\n",
    "    miss = img_np * msk_np_2\n",
    "    plt.imshow(miss, cmap='RdYlGn_r')\n",
    "    plt.savefig(f'./figures/miss/{img}.png', bbox_inches='tight')\n",
    "    plt.clf()\n",
    "    plt.imshow(msk_np_2, cmap='gray')\n",
    "    plt.savefig(f'./figures/mask/{img}.png', bbox_inches='tight')\n",
    "    plt.clf()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "3aab440a-32d8-4ba3-a729-daebaef80edd",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "data_list = [x for x in os.listdir('./np_data/') if 'npy' in x]\n",
    "dates = list()\n",
    "miss_rate_list = list()\n",
    "for path in data_list:\n",
    "    dates.append(path.split('.')[0].strip())\n",
    "    data = np.load(f\"./np_data/{path}\")[:,:,0]\n",
    "    miss_rate = (np.isnan(data) * 1).sum() / (data.shape[0] * data.shape[1])\n",
    "    miss_rate_list.append(miss_rate)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "904c5576-cdfa-4dc9-b824-21bef037fc7d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>date</th>\n",
       "      <th>rate</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>20201116</td>\n",
       "      <td>0.14933</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>20200120</td>\n",
       "      <td>0.054163</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>20200724</td>\n",
       "      <td>0.124641</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>20200622</td>\n",
       "      <td>0.364641</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>20200711</td>\n",
       "      <td>0.896986</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       date      rate\n",
       "0  20201116   0.14933\n",
       "1  20200120  0.054163\n",
       "2  20200724  0.124641\n",
       "3  20200622  0.364641\n",
       "4  20200711  0.896986"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "miss_df = pd.DataFrame([dates, miss_rate_list]).T\n",
    "miss_df.columns = ['date', 'rate']\n",
    "miss_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "1efb840f-b749-41fa-96d8-35a2f9aa1b9e",
   "metadata": {},
   "outputs": [],
   "source": [
    "miss_df.date = pd.to_datetime(miss_df.date)\n",
    "miss_df['month'] = miss_df.date.apply(lambda x: x.month)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "45ddaec0-d868-4946-9d6a-e30246b2fdd1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "month\n",
       "1     0.496714\n",
       "2     0.445747\n",
       "3     0.246096\n",
       "4     0.232876\n",
       "5     0.349770\n",
       "6     0.427705\n",
       "7     0.523877\n",
       "8     0.510536\n",
       "9     0.295989\n",
       "10    0.393019\n",
       "11    0.345657\n",
       "12    0.313314\n",
       "Name: rate, dtype: float64"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "miss_df.groupby('month')['rate'].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "5b7fea10-889f-448f-b1c4-7900ad3fc202",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "72fc40d6-fd5a-4709-9ab9-f64cd3c9db1d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4245"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(os.listdir('./out_mat/96/mask/50/'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "id": "4623918e-1970-4fc4-8914-23357eb3bbb6",
   "metadata": {},
   "outputs": [],
   "source": [
    "with open('./POMINO_data/POMINO_v2.1_daily_20200220.txt', 'r', encoding='utf-8') as fr:\n",
    "    d = fr.readlines()\n",
    "    dd = [float(x.strip()) for x in d]\n",
    "    vcd = np.zeros([160,280])\n",
    "    ct = 0\n",
    "    for j in range(280):\n",
    "        for i in range(160):\n",
    "            vcd[i,j] = dd[ct]\n",
    "            ct += 1\n",
    "            if i == 159:\n",
    "                break"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "id": "b513f7b7-41e9-461d-9e0d-daf985014c10",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7fea72102820>"
      ]
     },
     "execution_count": 70,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 63484 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.imshow(vcd)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 106,
   "id": "1a285b44-13a9-47c4-873b-d832d54c623e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(110, 190)"
      ]
     },
     "execution_count": 106,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "img1.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 129,
   "id": "1f1f9fbe-66a6-4f23-980b-2dd74867419c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 33940 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "img1 = np.load('./np_data/20200320.npy')[:,:,0]\n",
    "data = img1[:96, -96:].copy()\n",
    "plt.imshow(data, cmap='RdYlGn_r')\n",
    "plt.xticks([])\n",
    "plt.yticks([])\n",
    "plt.savefig('./figures/fig4-ori_and_miss/a.png', bbox_inches='tight')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 130,
   "id": "1e015fff-aaaa-44eb-846c-34079ea633fe",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAGFCAYAAAASI+9IAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy88F64QAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAGCElEQVR4nO3cwW7iSBRA0QLN1vkAFP7/wyJ5n3iPe3fVGk0GpwMNhHO2yaKCkK/eK8W7dV3XAQBjjP2tDwDA/RAFACIKAEQUAIgoABBRACCiAED+2fJLp9NpzPM8pmkau93u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FACIKAEQUAIgoABBRACCiAEBEAYCIAgARBQAiCgBEFACIKAAQUQAgogBARAGAiAIAEQUAIgoARBQAiCgAEFEAIKIAQEQBgIgCABEFACIKAEQUAIgoABBRACCiAEBEAYCIAgARBQAiCgBEFACIKAAQUQAgogBARAGAiAIAEQUAIgoARBQAiCgAEFEAIKIAQEQBgIgCABEFACIKAEQUAIgoABBRACCiAEBEAYCIAgARBQAiCgBEFACIKAAQUQAgogBARAGAiAIAEQUAIgoARBQAiCgAEFEAIKIAQEQBgIgCABEFACIKAEQUAIgoABBRACCiAEBEAYCIAgARBQAiCgBEFACIKAAQUQAgogBARAGAiAIAEQUAIgoARBQAiCgAEFEAIKIAQEQBgIgCABEFACIKAEQUAIgoABBRACCiAEBEAYCIAgARBQAiCgBEFACIKAAQUQAgogBARAGAiAIAEQUAIgoARBQAiCgAEFEAIKIAQEQBgIgCABEFACIKAEQUAIgoABBRACCiAEBEAYCIAgARBQAiCgBEFACIKAAQUQAgogBARAGAiAIAEQUAIgoARBQAiCgAEFEAIKIAQEQBgIgCABEFACIKAEQUAIgoABBRACCiAEBEAYCIAgARBQAiCgBEFACIKAAQUQAgogBARAGAiAIAEQUAIgoARBQAiCgAEFEAIKIAQDZFYV3Xa58DgL/g3PN8UxSWZbnIYQC4rXPP8926YQw4nU5jnucxTdPY7XYXOxwAf8e6rmNZlnE4HMZ+//k8sCkKADwHF80ARBQAiCgAEFEAIKIAQEQBgIgCAPkFLy1jWyOvK7cAAAAASUVORK5CYII=",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.imshow(np.isnan(data) * 1, cmap='gray')\n",
    "plt.xticks([])\n",
    "plt.yticks([])\n",
    "plt.savefig('./figures/fig4-ori_and_miss/a-mask.png', bbox_inches='tight')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 137,
   "id": "f86a7a59-4b71-4f39-ae7f-6394daae5308",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 39840 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "img2 = np.load('./np_data/20200621.npy')\n",
    "data = img2[:,:,0][110-96:110, 20:116].copy()\n",
    "plt.imshow(data, cmap='RdYlGn_r')\n",
    "plt.xticks([])\n",
    "plt.yticks([])\n",
    "plt.savefig('./figures/fig4-ori_and_miss/b.png', bbox_inches='tight')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 138,
   "id": "d45ac436-0e5b-4860-a763-265b84914b7d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAGFCAYAAAASI+9IAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy88F64QAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAKIUlEQVR4nO3dwU7jSBiFUQfNFrFH8P4PRot9w57MYqQrOj3EqbjsKrvOkWbR6mkITsKnqt+xT+fz+TwBwDRND60fAAD9EAUAQhQACFEAIEQBgBAFAEIUAIh/bvmfvr6+pvf39+nx8XE6nU5rPyYAKjufz9Pn5+f0/Pw8PTz8vB64KQrv7+/T6+trtQcHQBtvb2/Ty8vLj39/0/bR4+NjtQcEQDtzv89vioItI4BjmPt9btAMQIgCACEKAIQoABCiAECIAgAhCgCEKAAQogBAiAIAIQoAhCgAEKIAQIgCACEKAIQoABCiAECIAgAhCgCEKAAQogBAiAIAIQoAhCgAEKIAQIgCACEKAIQoABCiAECIAgAhCgCEKAAQogBAiAIAIQoAhCgAEKIAQIgCACEKAIQoABCiAECIAgAhCgCEKAAQogBAiAIAIQoAhCgAEKIAQIgCACEKAIQoABCiAECIAgAhCgCEKAAQogBAiAIAIQoAhCgAEKIAQIgCACEKAIQoABCiAECIAgAhCgCEKAAQogBAiAIAI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Z7uS/D9e699TK79nNe+98fHx/T09DT79a0UAAhRACBsH8HBjXJaaC962caapvueeysFAEIUAAhRACDMFAp936Nz+0zoR0+nqPbC7TgBWEQUAAhRACCqzRRqngvdci+w9NLAJV/rkj1PtjDKLTSpw0oBgBAFAEIUAIguP6fQci++5tce9daEUMPS9+KSzxTt9TMPLp0NQFWiAECIAgBRbaZg/7zctWO0lz3M3pS87kY9xr2+N3t+PvY6Y3DtIwAWEQUAQhQAiOGvfbTlXuFe9iGPaum56ku/3lZ6nRkstdd9/drWfn6tFAAIUQAgRAGA6PLaR3Cv7/vMpXuve50hjKrl7OTafKOn2cf3x+LaRwAUEwUAoovto5anoJb+vS2EZUqX1kuej9Lnaq/Pbek2Sq+35+zpVNrSy/YsuUx3qbW/vpUCACEKAIQoABCrXTq7lZ72Jef0dOrampbstx71mGxpyTGsfWkQ+melAECIAgAhCgBEF59TmNPTPmXNW2iueQvTnvbie3oszFtzBrFkvlT78xgl36vk59r7rNBKAYAQBQDipu2j1ts3Hx8fTb//Vkb5OalrT6+bJY91y5+z9Hvt6TmYvXTM+Ybf+L9+/ZpeX1+rPSgA2nh7e5teXl5+/PubovD19TW9v79Pj4+PuxuaAPDfCuHz83N6fn6eHh5+nhzcFAUAxmDQDECIAgAhCgCEKAAQogBAiAIAIQoAxL+YhdnB/7PKzgAAAABJRU5ErkJggg==",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.imshow(np.isnan(data) * 1, cmap='gray')\n",
    "plt.xticks([])\n",
    "plt.yticks([])\n",
    "plt.savefig('./figures/fig4-ori_and_miss/b-mask.png', bbox_inches='tight')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 133,
   "id": "02b56763-e1f5-4091-a708-4d11dbb2ad15",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 19276 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "img3 = np.load('./np_data/20200922.npy')\n",
    "data = img3[:,:,0][10:106, :96].copy()\n",
    "plt.imshow(data, cmap='RdYlGn_r')\n",
    "plt.xticks([])\n",
    "plt.yticks([])\n",
    "plt.savefig('./figures/fig4-ori_and_miss/c.png', bbox_inches='tight')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 134,
   "id": "45053672-473c-4001-acad-3572f68b3225",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAGFCAYAAAASI+9IAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy88F64QAAAACXBIWXMAAA9hAAAPYQGoP6dpAAALCklEQVR4nO3dwU7jShAFUDN6W+I9Gv7/w0ZiD9mTt+IOChOcxm273T5nNRKZxHECV1XVbj9cLpfLAADDMPza+gAAaIdQACCEAgAhFAAIoQBACAUAQigAEP/d86D39/fh5eVleHx8HB4eHpY+JgAqu1wuw/l8Hp6enoZfv27XA3eFwsvLy/D8/Fzt4ADYxp8/f4bfv3/f/PldofD4+JgnO51OdY7sk3Ecqz8nAF99/D2/5a5Q+GgZnU6nRUIBgHVMjQAMmgGIuyqFpV3vyWeYDbANlQIAIRQACKEAQAgFAEIoABBCAYAQCgCEUAAghAIAIRQAiCa2ubh2ve3FNdtgACxDpQBACAUAQigAEE3OFKZMzRw+m5o/2LYb4C+VAgAhFAAIoQBA7HKmUKJk/gBwdCoFAEIoABBCAYDofqZQquY1EMznOhJYl0oBgBAKAIRQACBWmSnU7gO3cu1Bab+7leMehv305vdynNALlQIAIRQACKEAQLhOoaKWZgZT5hyrPj/0S6UAQAgFAEIoABCrzBSm+telPervHr+nvv4ce7omAtgPlQIAIRQAiMMvSV2zDdPqa1liCnxQKQAQQgGAEAoAxCYzhdIe9pZbMpT8/7kzgc+vNf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FRL/dYtt9goMXeZ6JLvs+ZtRo8yc2iNSgGAEAoAhFAAIMwUmK2ldddH6DPPPd9b9uprbjHd6syhpd+Hn1ApABBCAYAQCgCEmQJdqdnPPcJ84l+22tOp9jbde+/tb0WlAEAIBQBCKAAQZgpwg570V61eG0A9KgUAQigAEEIBgDBTADYx9z4PNe/dwF8qBQBCKAAQ2kdAEyx3bYNKAYAQCgCEUAAgzBSAXbDEdB0qBQBCKAAQQgGAMFMAqtH33z+VAgAhFAAIoQBACAUAQigAEEIBgBAKAIRQACCEAgAhFAAIoQBA2PsIOJzr+z3bs+kvlQIAIRQACKEAQJgpAF26nhtwH5UCACEUAAjtI+DwppaoHmkJq0oBgBAKAIRQACDMFIAufe77ly5PPfJyVpUCACEUAAihAECYKQAUKrluoXQ+sfU1ECoFAEIoABBCAYAwUwC6N7WX0dbPt9Rz/WQ+oVIAIIQCACEUAAgzBYArW18rsCWVAgAhFAAIoQBAmCkAh3OUmcFPrnlQKQAQQgGAEAoAhJkCwEwlM4rW7/+sUgAghAIAIRQACKEAQAgFAEIoABCWpAKsaGr5asmS1ZKlsG9vb8M4jpOPUykAEEIBgBAKAISZAkBDtt7WW6UAQAgFAEIoABBCAYAQCgCEUAAghAIAIRQACKEAQAgFAEIoABBCAYAQCgCEUAAghAIAIRQACKEAQAgFAEIoABBCAYAQCgCEUAAghAIAIRQACKEAQAgFAEIoABBCAYAQCgDEf/c86HK5DMMwDG9vb4seDADL+Pj7/fH3/Ja7QuF8Pg/DMAzPz88zDwuALZ3P52Ecx5s/f7hMxcYwDO/v78PLy8vw+Pg4PDw8VD1AAJZ3uVyG8/k8PD09Db9+3Z4c3BUKAByDQTMAIRQACKEAQAgFAEIoABBCAYAQCgDE/1RK3grSvWT4AAAAAElFTkSuQmCC",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.imshow(np.isnan(data) * 1, cmap='gray')\n",
    "plt.xticks([])\n",
    "plt.yticks([])\n",
    "plt.savefig('./figures/fig4-ori_and_miss/c-mask.png', bbox_inches='tight')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 135,
   "id": "40cfca7f-21ed-49b4-aedd-afc0d2ba8b10",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 37252 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "img4 = np.load('./np_data/20201221.npy')\n",
    "data = img4[:,:,0][:96, -96:].copy()\n",
    "plt.imshow(data, cmap='RdYlGn_r')\n",
    "plt.xticks([])\n",
    "plt.yticks([])\n",
    "plt.savefig('./figures/fig4-ori_and_miss/d.png', bbox_inches='tight')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 136,
   "id": "264fc468-fc1f-4298-923a-4e0174c052d8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAGFCAYAAAASI+9IAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy88F64QAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAI1klEQVR4nO3dwW7aWhRAUVJ1GjGP2v//sEqZB+bhzfZLkQo4tsE2a0kZJSEGqm7de2z8cjqdTjsA2O12Px59AAAshygAEFEAIKIAQEQBgIgCABEFAPLzlh/6/Pzcvb+/715fX3cvLy9zHxMAEzudTrvj8bh7e3vb/fjx7/XATVF4f3/f/f79e7KDA+Ax/vz5s/v169c/v3/T9tHr6+tkBwTA41z7//ymKNgyAtiGa/+fGzQDEFEAIKIAQEQBgIgCALnpOgWAZ3Z+L7Itn5FppQBARAGAiAIAMVMAnt75zGDMz6993mClAEBEAYDYPgKeztDtontuCV07tkvHMsWps1YKAEQUAIgoABAzBWCThs4N7mXscQ35/a8/ezgcdvv9/urvWCkAEF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NObdC1rZFwLS29P5bKQAQUQAgogBAzBRgAmPnFUvdk17qcQ31yNtvPtJ3/l1aKQAQUQAgogBAzBRgAcbeipJpPfPrbaUAQEQBgIgCADFTgJXb6jUSjPf1vT0cDrv9fn/1d6wUAIgoABBRACBmCrACW7ktJstnpQBARAGAiAIAMVOAJ3fPeYVrIpbPSgGAiAIAEQUAYqYAPMT5LMO8YRmsFACIKAAQ20fA3fi4juWzUgAgogBARAGAmCkAi+AU1el9Z4ZjpQBARAGAiAIAEQUAIgoARBQAyE2npDo1DLi3w+Hw6EPYpGv/n98UhePxOMnBANxqv98/+hA26Xg8XnxtX043LAM+Pz937+/vu9fXVx9oBbBCp9Npdzwed29vb7sfP/49ObgpCgA8B4NmACIKAEQUAIgoABBRACCiAEBEAYD8B4CL/jqYMJxeAAAAAElFTkSuQmCC",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.imshow(np.isnan(data) * 1, cmap='gray')\n",
    "plt.xticks([])\n",
    "plt.yticks([])\n",
    "plt.savefig('./figures/fig4-ori_and_miss/d-mask.png', bbox_inches='tight')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 166,
   "id": "605f263e-1ef3-4fa7-be74-142c6918d682",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 7320 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "ori_data_16 = np.load('./np_data/20200220.npy')\n",
    "data = ori_data_16[25:55,65:95,0].copy()\n",
    "plt.imshow(data, cmap='RdYlGn_r')\n",
    "plt.gca().axis('off')  # 获取当前坐标轴并关闭\n",
    "plt.savefig('./figures/fig1/color.png', bbox_inches='tight')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 167,
   "id": "b7c0d144-b0f4-427c-b07c-3bb4d4d4be96",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 6028 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.clf()\n",
    "plt.imshow(data, cmap='gray')\n",
    "plt.gca().axis('off')  # 获取当前坐标轴并关闭\n",
    "plt.savefig('./figures/fig1/gray.png', bbox_inches='tight')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 158,
   "id": "7cfe14e9-1f71-4db2-bedf-4ce036c7496a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(30, 30)"
      ]
     },
     "execution_count": 158,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 164,
   "id": "d2e09df0-a482-4c03-aa3a-bbcca4024c45",
   "metadata": {},
   "outputs": [],
   "source": [
    "pd.DataFrame(data.astype(int)).to_csv('./numeric.csv', index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 161,
   "id": "2bde0a43-b1ab-4bb4-b77a-6b74373127a3",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "8 7 7 7 7 7 6 6 8 9 9 10 10 10 10 9 10 9 9 9 8 8 9 9 8 9 9 9 9 10 \n",
      "8 8 7 7 7 7 7 7 8 9 9 10 10 10 9 9 9 10 10 9 9 9 9 10 9 9 10 10 10 10 \n",
      "8 8 7 8 8 8 8 8 8 8 9 9 10 10 9 9 9 9 10 9 9 9 10 10 10 10 10 11 12 13 \n",
      "9 9 10 9 8 9 9 9 9 9 9 9 9 10 9 9 9 9 8 9 9 9 10 10 10 11 12 14 15 16 \n",
      "10 9 9 10 9 10 11 11 10 11 12 10 11 11 11 10 9 9 8 9 9 9 10 12 12 14 15 17 18 20 \n",
      "8 8 8 10 10 11 12 11 11 13 12 10 11 12 12 11 10 9 8 9 9 10 12 15 16 17 19 22 25 24 \n",
      "8 8 8 9 9 10 11 11 11 13 11 11 11 13 14 13 12 11 10 10 10 12 15 16 18 19 20 21 21 20 \n",
      "7 8 9 9 9 9 10 10 11 10 11 12 16 17 18 19 16 15 13 12 14 15 15 15 16 16 17 18 18 16 \n",
      "7 8 8 9 9 10 10 10 10 11 12 13 16 19 22 25 25 22 16 18 19 18 15 15 15 15 15 15 15 14 \n",
      "8 8 7 8 9 10 12 11 10 11 13 13 15 21 22 24 25 23 19 21 22 19 16 15 14 13 13 12 12 12 \n",
      "10 9 7 8 8 9 10 10 10 11 11 12 15 19 21 22 24 23 22 20 18 16 14 13 12 12 11 11 12 13 \n",
      "9 8 8 9 8 9 10 11 11 12 12 14 17 19 21 20 22 23 23 19 16 15 14 12 12 12 12 11 12 12 \n",
      "10 10 10 10 11 11 11 12 13 14 17 21 24 25 22 22 24 26 25 20 18 19 15 13 12 12 13 13 13 13 \n",
      "10 10 10 12 12 13 13 14 15 17 21 25 28 28 26 25 28 32 27 20 15 17 17 16 15 13 13 13 13 13 \n",
      "10 9 9 13 14 15 15 16 18 22 25 28 31 32 32 28 27 24 20 17 15 16 18 18 17 15 14 14 13 13 \n",
      "10 10 12 14 16 17 17 23 27 30 29 30 33 37 35 30 27 23 18 15 15 16 17 17 17 18 17 17 14 13 \n",
      "10 11 10 12 15 18 25 33 43 41 36 36 36 37 36 35 29 22 19 17 15 15 16 17 18 19 19 18 16 14 \n",
      "12 13 11 13 15 20 30 39 47 46 39 30 28 30 34 39 31 25 21 18 17 17 17 17 17 17 17 15 16 14 \n",
      "15 14 14 14 16 20 26 38 36 31 26 22 20 21 30 40 36 27 21 20 18 17 17 16 16 15 13 13 13 13 \n",
      "16 15 15 15 16 17 17 18 19 20 17 15 13 16 24 28 30 22 18 17 15 15 15 15 15 14 14 14 14 13 \n",
      "18 17 16 16 16 14 12 10 10 13 11 10 10 12 15 18 18 16 13 13 12 11 12 13 15 14 14 15 17 16 \n",
      "18 16 17 16 15 10 8 8 8 9 10 9 10 11 12 12 11 10 8 10 9 8 8 11 13 14 14 16 17 16 \n",
      "15 12 12 11 9 7 6 7 7 6 7 9 10 9 9 8 7 6 6 6 6 6 7 7 9 12 14 14 14 13 \n",
      "9 7 5 6 6 6 6 6 6 5 6 8 10 8 6 5 4 5 5 4 5 6 6 7 7 10 11 11 10 7 \n",
      "4 3 4 4 5 6 7 7 8 7 8 9 11 8 5 5 4 4 4 4 5 6 6 6 7 9 9 6 6 4 \n",
      "4 2 4 5 6 8 10 8 9 9 10 12 11 9 5 4 4 4 3 4 5 5 6 6 6 7 7 5 4 4 \n",
      "3 3 3 5 7 11 15 11 11 11 11 11 12 8 5 4 3 3 3 4 5 5 6 5 5 5 6 6 5 5 \n",
      "4 4 5 7 9 13 14 14 14 11 10 11 15 9 6 4 3 3 4 4 4 4 5 6 6 5 5 7 6 6 \n",
      "4 4 6 8 9 14 16 18 14 10 10 15 17 12 6 4 3 4 3 4 4 3 5 5 5 4 4 6 7 6 \n",
      "4 4 5 5 9 11 13 19 14 10 14 17 15 9 5 4 3 5 5 4 4 4 4 5 5 4 3 4 5 5 \n"
     ]
    }
   ],
   "source": [
    "for i in range(data.shape[0]):\n",
    "    for j in range(data.shape[1]):\n",
    "        print(int(data[i][j]), end=' ')\n",
    "    print()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 168,
   "id": "bc1b4e5e-52b5-462c-8fbf-e1ebaeca382f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>train</th>\n",
       "      <th>validation</th>\n",
       "      <th>test</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>9624</td>\n",
       "      <td>1500</td>\n",
       "      <td>1743</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>6534</td>\n",
       "      <td>1117</td>\n",
       "      <td>1150</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>5380</td>\n",
       "      <td>840</td>\n",
       "      <td>956</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>5211</td>\n",
       "      <td>818</td>\n",
       "      <td>890</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   train  validation  test\n",
       "0   9624        1500  1743\n",
       "1   6534        1117  1150\n",
       "2   5380         840   956\n",
       "3   5211         818   890"
      ]
     },
     "execution_count": 168,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 169,
   "id": "534dd823-08b2-419f-bb83-10f211fc2533",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0db4e06f-4027-4e45-809c-b63a2cdfe15b",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.16"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
