Exercise 2: Scripting interface

This exercise has four parts:

  1. Installing the Madrigal API of your choice (python, Matlab, or IDL)

  2. Running the globalDownload script

  3. Generate and run the globalIsprint script

  4. Edit a script directly (most advanced)

Links and scripts to download

 

Python script to plot the latest Poker Flat data

Matlab script to plot the latest Poker Flat data

IDL script to plot the latest Poker Flat data

Python script to run globalIsprint example

Matlab script to run globalIsprint example

IDL script to run globalIsprint example

 

Step 1: Download Python, Matlab, and/or IDL Remote APIs

Go to the OpenMadrigal download page, and download one or more version. Available as *.tar.gz or *zip files. The Matlab and IDL installations assumes you have these commercial products already installed; the python version is open-source and can be installed on any computer.

Matlab installation: The Matlab version is simply *.m files, so they need to be put in a standard Matlab directory.

IDL installation: The IDL version is simply *.pro files, so they need to to put in a standard IDL directory.

To install the python version:

  1. Make sure you have python installed. If not, install it from python.org.

  2. To run the plotting test script in the next exercise, run the next two steps. The non-plotting parts of the Madrigal python API will run without those third-party modules.

  3. Install the package numpy from numpy.scipy.org if you don't already have it. This package does numerical arrays and linear algebra.

  4. Install the ploting package matplotlib from matplotlib.sourceforge.net if you don't already have it.

  5. To install the remote python madrigal api from www.openmadrigal.org, you will need to uncompress the file. Then you will need to run python setupMadrigalWeb.py install. If you are installing on Windows, you will need to open a command prompt, and then change directory to where you uncompressed the file. From windows the python command may be something like c:\python25\python.exe setupMadrigalWeb.py install. All the command line scripts (globalIsprint.py, madrigalPColor.py, and madrigalScatter.py) will be put into your PATH and so can be called directly from the command line.

Step 2: Create and run a globalDownload script

globalDownload is a simple script that will allow you to download a whole series of files, in any format - ascii, Hdf5, or the old Cedar format. Unlike globalIsprint, there is not a web interface to generate these commands, but in general the commands are simpler. You specify the time range, the instruments, and, optionally, the kinds of data.

As an optional exercise, use one the three scripts above to download all Poker Flat ISR (kinst=61) with long pulse data (kindat=5950) for March 2007. If you run into problems, see the answers at the bottom of the page for all three languages.

Step 3: Create and run a globalIsprint script

  • Download either the python, Matlab, or IDL version of the script to run the globalIsprint example (see top of page).

  • Go to the SRI or the CEDAR Madrigal site, and choose Full data access then Global Madrigal search.

  • Choose the Poker Flat radar and the date range of March 10-20, 2007.

  • Select Show advanced filters.

  • Choose Alternating code for kind of data.

  • Add three filters:

 

Mnemonic

Lower limit

Upper limit

Kp

4.0

leave blank

gdalt

240

260

ne

2e11

leave blank

 

  • Hit the Select parameters button.

  • Choose the parameters year,month,day,hour,min,sec,elm,azm,gdalt,gdlat,glon,kp,ne,dne and hit Done.

  • Choose Continue at the bottom.

  • Select the language you are using, and hit OK.

  • Verify the script runs successfully as is. If there is a problem, compare to the scripts at the top.

  • Modify the script as suggested below. You can either directly edit your script, or regenerate it using the web interface.

  • Instead of using Kp as a filter, filter on Ap3 > 15.

  • Add Te and Ti as parameters

  • Filter also on Te > 1000

Step 4: Use and modify the script to plot latest Poker Flat data (plotLatestPoker.*)

  1. Download either the python, Matlab, or IDL version of the script to plot the last hour of Poker Flat data (see top of page).

  2. Verify the script runs successfully as is.

  3. This version just plots Nel (log of electron density) for the last hour of Poker Flat data. Modify the script to plot Ti (ion temperature) or Te (electron temperature). You will need to change the requested parameters, the Y label string, and for the Matlab and IDL versions, the minimum and maximum parameters values.

  4. Rename the first plot from test.png to test_org.png. Then modify the filter string to be " filter=beamid,64016,64016 " to only include only a single beam (the vertical one). How do the plots differ?

  • No labels