{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pyaurorax\n", "import datetime\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "import cartopy\n", "\n", "aurorax = pyaurorax.PyAuroraX()\n", "at = aurorax.tools" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "f0bd52dcd38545ca89fe5af5bb173f93", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Downloading THEMIS_ASI_GRID_MOSV001 files: 0%| | 0.00/1.82M [00:00" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Slice out a single frame of grid data\n", "grid = data.data.grid[:, :, 0]\n", "timestamp = data.timestamp[0]\n", "\n", "# Grab the fill value used to represent grid cells with no data\n", "fill_val = data.data.fill_value\n", "\n", "# Prep the grid data for plotting (make non-data cells transparent)\n", "rgba_grid = at.grid_files.prep_grid_image(grid, fill_val, scale=[0,12500])\n", "\n", "# Create an empty map using cartopy\n", "projection = cartopy.crs.NearsidePerspective(central_longitude=-100, central_latitude=55)\n", "fig = plt.figure(figsize=(5, 5))\n", "ax = fig.add_axes((0, 0, 1, 1), projection=projection)\n", "ax.set_extent([-140, -70, 35, 80], crs=cartopy.crs.Geodetic())\n", "ax.add_feature(cartopy.feature.OCEAN, zorder=0)\n", "\n", "# Overlay the grid data on the map\n", "plt.imshow(rgba_grid, extent=(-180, 180, -90, 90), transform=cartopy.crs.PlateCarree(), origin='lower')\n", "plt.text(0.01, 0.925, \"THEMIS ASI - Gridded Data\", transform=ax.transAxes, fontsize=18, weight='bold')\n", "plt.text(0.01, 0.100, timestamp.strftime(\"%Y/%m/%d\"), transform=ax.transAxes, fontsize=18, weight='bold')\n", "plt.text(0.01, 0.025, timestamp.strftime(\"%H:%M:%S\")+\" UT\", transform=ax.transAxes, fontsize=18, weight='bold')\n", "plt.show()" ] } ], "metadata": { "kernelspec": { "display_name": "pyaurorax", "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.9.19" } }, "nbformat": 4, "nbformat_minor": 2 }