Exercise 2: Scripting interface

This exercise has three 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

Links and scripts to download

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 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, globalDownload.py, etc.) 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.

Use one the three scripts above to download from the CEDAR Madrigal site (http://cedar.openmadrigal.org) all Jicamarca IS Radar (kinst=10) Drift data (kindat=1910) for 2010 in Hdf5 format. 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 CEDAR Madrigal site, and choose Full data access then Global Madrigal search.

  • Choose the Jicamarca IS radar and the date range of all of January 2012.

  • Select Show advanced filters.

  • Choose Vertical and Zonal Drifts for kind of data.

  • Add a filter:

 

Mnemonic

Lower limit

Upper limit

VIPN

100

1000

 

  • Hit the Select parameters button.

  • Choose the parameters year,month,day,hour,min,sec,gdalt,gdlat,glon,vipn,dvipn,vipe,dvipe 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 answer scripts at the bottom.

globalDownload answers

Python command

globalDownload.py --url=http://cedar.openmadrigal.org --outputDir=/tmp --user_fullname="your name" --user_email=your@email --user_affiliation=your_affiliation --format=hdf5 --inst=10 --kindat=1910 --startDate=1/1/2012 --endDate=12/31/2012 --verbose

 

Matlab command

url = 'http://cedar.openmadrigal.org'; 
outputDir = '/tmp';
user_fullname = 'your name';
user_email = 'your email';
user_affiliation = 'your affiliation';
format = 'hdf5';
startTime = datenum('1-Jan-2012 00:00:00');
endTime = datenum('31-Dec-2012 23:59:59');
inst = 10;
kindats = [1910];


globalDownload(url, ...
    outputDir, ...
    user_fullname, ...
    user_email, ...
    user_affiliation, ...
    format, ...
    startTime, ...
    endTime, ...
    inst, ...
    kindats);

 

IDL command

madglobaldownload, 'http://cedar.openmadrigal.org',  $ 
'/tmp', 'your name', 'your@email', 'your_affliliation', $ 
julday(1,1,2012,0,0,0),  julday(1,31,2012,23,59,59), 10, $
1910, 'hdf5'

 

globalIsprint answers

Python command

globalIsprint.py --verbose --url=http://cedar.openmadrigal.org/.
 
--parms=YEAR,MONTH,DAY,HOUR,MIN,SEC,GDALT,GDLAT,GLON,VIPE,DVIPE,VIPN,DVIPN
 --output=example.txt --user_fullname="Bill Rideout" --user_email=brideout@haystack.mit.edu --user_affiliation="MIT" --startDate="01/01/2012" --endDate="01/31/2012" --inst=10 --filter=vipn2,100.0,1000.0 --kindat=1910

 

Matlab command

globalIsprint('http://cedar.openmadrigal.org/.', ... 
 'YEAR,MONTH,DAY,HOUR,MIN,SEC,GDALT,GDLAT,GLON,VIPE,DVIPE,VIPN,DVIPN', ...
 'example.txt', ...
 'Bill Rideout', ...
 'brideout@haystack.mit.edu', ...
 'MIT', ...
 datenum('01-Jan-2012 00:00:00'), ...
 datenum('31-Jan-2012 23:59:59'), ...
 10, ...
 'filter=vipn2,100.0,1000.0 ', ...
 [1910], ...
 '', ...
 '') 

 

IDL command

madglobalprint, 'http://cedar.openmadrigal.org/.',  $ 
 'YEAR,MONTH,DAY,HOUR,MIN,SEC,GDALT,GDLAT,GLON,VIPE,DVIPE,VIPN,DVIPN',  $
 'example.txt',  $
 'Bill Rideout',  $
 'brideout@haystack.mit.edu',  $
 'MIT',  $
 julday(1,1,2012,0,0,0),  $
 julday(1,31,2012,23,59,59),  $
 10,  $
 'filter=vipn2,100.0,1000.0 ',  $
 [1910],  $
 '',  $
 '' 
  • No labels