Created
March 12, 2020 00:52
-
-
Save sophaskins/3a4d622644f33a5f23e3398cd42fc696 to your computer and use it in GitHub Desktop.
Map FT-8 QSOs with Jupyter Notebooks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import adif_io\n", | |
"import numpy as np\n", | |
"import pandas as pd\n", | |
"import matplotlib.pyplot as plt\n", | |
"import maidenhead\n", | |
"import smopy\n", | |
"%matplotlib inline\n", | |
"\n", | |
"adi_path = \"/Users/sophaskins/Library/Application Support/WSJT-X/wsjtx_log.adi\"\n", | |
"all_qsos = adif_io.read_from_file(adi_path)\n", | |
"qsos = [q for q in all_qsos[0] if int(q[\"QSO_DATE\"]) > 20200310]" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"coordinates = []\n", | |
"for qso in qsos:\n", | |
" if 'GRIDSQUARE' in qso and qso['GRIDSQUARE'] != \"\":\n", | |
" # adding \"gg\" centers in the grid, rather than upper left\n", | |
" coordinates.append(maidenhead.toLoc(qso['GRIDSQUARE'] + \"gg\"))\n", | |
"\n", | |
"lat_min = min([c[0] for c in coordinates])\n", | |
"lat_max = max([c[0] for c in coordinates])\n", | |
"lon_min = min([c[1] for c in coordinates])\n", | |
"lon_max = max([c[1] for c in coordinates])" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"map = smopy.Map((lat_min, lon_min, lat_max, lon_max))\n", | |
"ax = map.show_mpl(figsize=(24, 24))\n", | |
"for c in coordinates:\n", | |
" x, y = map.to_pixels(c[0], c[1])\n", | |
" ax.plot(x, y, 'or', ms=30, mew=2)\n" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"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.7.6" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment