{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "network(), radar() and site() objects \n", "==\n", "***\n", "\n", "This notebook introduces the high-level python interface with the radar.dat and hdw.dat content. \n", "For more in-depth access (i.e., your own hdw.dat), look at the radInfoIO module: \n", "\n", " radInfoIo?" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Populating the interactive namespace from numpy and matplotlib\n" ] } ], "source": [ "# Import radar module\n", "%pylab inline\n", "from davitpy.pydarn.radar import *" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Import all radars\n", "This could be used to iterate through radars, plot them all on a map, find radars in view of specific points..." ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Network information object: \n", "\tTotal radars: 52\n", "\t\t(North) - [0][tst] Test Radar (planned)\n", "\t\t(North) - [1][gbr] Goose Bay (active)\n", "\t\t(North) - [2][sch] Schefferville (offline)\n", "\t\t(North) - [3][kap] Kapuskasing (active)\n", "\t\t(South) - [4][hal] Halley (active)\n", "\t\t(North) - [5][sas] Saskatoon (active)\n", "\t\t(North) - [6][pgr] Prince George (active)\n", "\t\t(North) - [7][kod] Kodiak (active)\n", "\t\t(North) - [8][sto] Stokkseyri (active)\n", "\t\t(North) - [9][pyk] Pykkvibaer (active)\n", "\t\t(North) - [10][han] Hankasalmi (active)\n", "\t\t(South) - [11][san] SANAE (active)\n", "\t\t(South) - [12][sys] Syowa South (active)\n", "\t\t(South) - [13][sye] Syowa East (active)\n", "\t\t(South) - [14][tig] TIGER (active)\n", "\t\t(South) - [15][ker] Kerguelen (active)\n", "\t\t(North) - [16][ksr] King Salmon (active)\n", "\t\t(South) - [18][unw] Unwin (active)\n", "\t\t(South) - [19][zho] Zhongshan Station (active)\n", "\t\t(South) - [20][mcm] McMurdo (active)\n", "\t\t(South) - [21][fir] Falkland Islands (offline)\n", "\t\t(South) - [22][sps] South Pole Station (active)\n", "\t\t(South) - [24][bpk] Buckland Park (active)\n", "\t\t(North) - [32][wal] Wallops Island (active)\n", "\t\t(North) - [33][bks] Blackstone (active)\n", "\t\t(North) - [40][hok] Hokkaido (active)\n", "\t\t(North) - [41][hkw] Hokkaido West (planned)\n", "\t\t(North) - [64][inv] Inuvik (active)\n", "\t\t(North) - [65][rkn] Rankin Inlet (active)\n", "\t\t(North) - [66][cly] Clyde River (active)\n", "\t\t(South) - [96][dce] Dome C East (active)\n", "\t\t(North) - [128][svb] Svalbard (planned)\n", "\t\t(North) - [204][fhw] Fort Hays West (active)\n", "\t\t(North) - [205][fhe] Fort Hays East (active)\n", "\t\t(North) - [206][cvw] Christmas Valley West (active)\n", "\t\t(North) - [207][cve] Christmas Valley East (active)\n", "\t\t(North) - [208][adw] Adak West (active)\n", "\t\t(North) - [209][ade] Adak East (active)\n", "\t\t(North) - [210][azw] Azores West (planned)\n", "\t\t(North) - [211][aze] Azores East (planned)\n", "\t\t(North) - [501][sve] Svedlovsk East (planned)\n", "\t\t(North) - [502][svw] Svedlovsk West (planned)\n", "\t\t(North) - [504][ire] Irkutsk East (planned)\n", "\t\t(North) - [505][irw] Irkutsk West (planned)\n", "\t\t(North) - [506][kae] Kashi East (planned)\n", "\t\t(North) - [507][kaw] Kashi West (planned)\n", "\t\t(North) - [508][eje] Ejina East (planned)\n", "\t\t(North) - [509][ejw] Ejina West (planned)\n", "\t\t(North) - [510][she] Shenyang East (planned)\n", "\t\t(North) - [511][shw] Shenyang West (planned)\n", "\t\t(North) - [512][ekb] EKB Radar (planned)\n", "\t\t(North) - [513][jia] Jiamusi (planned)\n" ] } ], "source": [ "radars = network()\n", "print radars" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "52\n", "52\n" ] } ], "source": [ "# How to get the total number of radars\n", "print len(radars)\n", "print radars.nradar" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "id: 33 \n", "status: 1 \n", "cnum: 2 \n", "code: [u'bks', u'i'] \n", "name: Blackstone \n", "operator: Virginia Tech \n", "hdwfname: hdw.dat.bks \n", "stTime: 2008-02-02 \n", "edTime: 2500-01-01 \n", "snum: 12 \n", "sites: 12 elements\n" ] } ], "source": [ "# How to get a specific radar from the mountain of recorded radars\n", "print radars.getRadarByCode(\"bks\")\n", "# is equivalent to...\n", "#print radars.getRadarById(33)\n", "#print, radars.getRadarByName(\"Blackstone\")" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "tval: 3000-01-01 00:00:00 \n", "geolat: 53.32 \n", "geolon: -60.46 \n", "alt: 50.00 \n", "boresite: 5.00 \n", "bmsep: 3.24 \n", "vdir: 1 \n", "atten: 0.00 \n", "tdiff: 0.4780 \n", "phidiff: 1.0 \n", "interfer: [ 1.50, 100.00, 0.00] \n", "recrise: 0.000 \n", "maxatten: 0.0 \n", "maxgate: 100 \n", "maxbeam: 16\n" ] } ], "source": [ "# How to get a specific radar site information at a given date\n", "from datetime import datetime\n", "print radars.getRadarByName('Goose Bay').getSiteByDate(datetime(2011,1,4))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Import a specific radar\n", "Saves memory and time" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "id: 33 \n", "status: 1 \n", "cnum: 2 \n", "code: [u'bks', u'i'] \n", "name: Blackstone \n", "operator: Virginia Tech \n", "hdwfname: hdw.dat.bks \n", "stTime: 2008-02-02 \n", "edTime: 2500-01-01 \n", "snum: 12 \n", "sites: 12 elements\n" ] } ], "source": [ "# How to get only one radar without getting all the other radars\n", "rad = radar(code='bks')\n", "print rad" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Import a specific radar site\n", "Saves even more memory and time" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "tval: 2011-09-12 00:00:00 \n", "geolat: 37.10 \n", "geolon: -77.95 \n", "alt: 50.00 \n", "boresite: -32.00 \n", "bmsep: 3.86 \n", "vdir: 1 \n", "atten: 0.00 \n", "tdiff: -0.3240 \n", "phidiff: 1.0 \n", "interfer: [ 0.00, -58.90, -2.70] \n", "recrise: 0.000 \n", "maxatten: 0.0 \n", "maxgate: 110 \n", "maxbeam: 16\n" ] } ], "source": [ "# How to get a site without going trhough the whole network or radar classes\n", "print site(code='bks', dt=datetime(2010,11,17))" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.3" } }, "nbformat": 4, "nbformat_minor": 0 }