|
10 | 10 | "Plot the RMS of the $8\\times8\\degree$ MDT current tiles, to visualise how the energy in the tiles varies - we want to exclude the regions near coastlines when picking our training data."
|
11 | 11 | ]
|
12 | 12 | },
|
| 13 | + { |
| 14 | + "cell_type": "code", |
| 15 | + "execution_count": null, |
| 16 | + "id": "002e5fcb", |
| 17 | + "metadata": {}, |
| 18 | + "outputs": [], |
| 19 | + "source": [ |
| 20 | + "%load_ext autoreload\n", |
| 21 | + "%autoreload 2" |
| 22 | + ] |
| 23 | + }, |
13 | 24 | {
|
14 | 25 | "cell_type": "code",
|
15 | 26 | "execution_count": null,
|
|
141 | 152 | "\n",
|
142 | 153 | "fig.colorbar(im, ax=axes[\"A\"])"
|
143 | 154 | ]
|
| 155 | + }, |
| 156 | + { |
| 157 | + "cell_type": "markdown", |
| 158 | + "id": "3a5a91c1", |
| 159 | + "metadata": {}, |
| 160 | + "source": [ |
| 161 | + "# Noise application\n", |
| 162 | + "\n", |
| 163 | + "We estimate noise strength by creating a noise strength map - visualise this here" |
| 164 | + ] |
| 165 | + }, |
| 166 | + { |
| 167 | + "cell_type": "code", |
| 168 | + "execution_count": null, |
| 169 | + "id": "2a99491a", |
| 170 | + "metadata": {}, |
| 171 | + "outputs": [], |
| 172 | + "source": [ |
| 173 | + "from current_denoising.generation import applying_noise\n", |
| 174 | + "\n", |
| 175 | + "filter_size = 5\n", |
| 176 | + "\n", |
| 177 | + "filtered = applying_noise.noise_strength_map(data, filter_size=filter_size)" |
| 178 | + ] |
| 179 | + }, |
| 180 | + { |
| 181 | + "cell_type": "code", |
| 182 | + "execution_count": null, |
| 183 | + "id": "40fc172c", |
| 184 | + "metadata": {}, |
| 185 | + "outputs": [], |
| 186 | + "source": [ |
| 187 | + "fig, axis = plt.subplots(1, 1, figsize=(12, 6))\n", |
| 188 | + "\n", |
| 189 | + "im = axis.imshow(filtered, **imshow_kw)\n", |
| 190 | + "\n", |
| 191 | + "earth_radius_km = 6370\n", |
| 192 | + "axis.set_title(\n", |
| 193 | + " f\"{filter_size=} grid point\\n\"\n", |
| 194 | + " r\"$\\approx$\"\n", |
| 195 | + " f\"{earth_radius_km / 12 * filter_size:.0f}km at equator\"\n", |
| 196 | + ")\n", |
| 197 | + "fig.colorbar(im)\n", |
| 198 | + "\n", |
| 199 | + "lat, long = maps.lat_long_grid(data.shape)\n", |
| 200 | + "extent = [long[0], long[-1], lat[0], lat[-1]]\n", |
| 201 | + "im.set_extent(extent)\n", |
| 202 | + "\n", |
| 203 | + "fig.tight_layout()" |
| 204 | + ] |
| 205 | + }, |
| 206 | + { |
| 207 | + "cell_type": "code", |
| 208 | + "execution_count": null, |
| 209 | + "id": "0b754829", |
| 210 | + "metadata": {}, |
| 211 | + "outputs": [], |
| 212 | + "source": [ |
| 213 | + "\"\"\"Plot a tile near Australia to reproduce Fig 9 in Laura's paper\"\"\"\n", |
| 214 | + "\n", |
| 215 | + "import numpy as np\n", |
| 216 | + "from current_denoising.generation import ioutils\n", |
| 217 | + "\n", |
| 218 | + "# NB the latitude is backwards here, so it is positive instead of negative\n", |
| 219 | + "lat, long = -38, -70\n", |
| 220 | + "size = 128\n", |
| 221 | + "\n", |
| 222 | + "# Get the index of the nearest grid point to each of these\n", |
| 223 | + "indices = []\n", |
| 224 | + "for a, b in zip([lat, long], maps.lat_long_grid(data.shape)):\n", |
| 225 | + " indices.append(int(np.argmin(np.abs(b - a))))\n", |
| 226 | + "\n", |
| 227 | + "tile = ioutils._tile(filtered, indices, size)\n", |
| 228 | + "\n", |
| 229 | + "fig, axis = plt.subplots()\n", |
| 230 | + "axis.imshow(tile, **imshow_kw)\n", |
| 231 | + "axis.set_axis_off()" |
| 232 | + ] |
| 233 | + }, |
| 234 | + { |
| 235 | + "cell_type": "code", |
| 236 | + "execution_count": null, |
| 237 | + "id": "63bbc617", |
| 238 | + "metadata": {}, |
| 239 | + "outputs": [], |
| 240 | + "source": [] |
144 | 241 | }
|
145 | 242 | ],
|
146 | 243 | "metadata": {
|
|
0 commit comments