Code covered by the BSD License  

Highlights from
International Reference Ionosphere (IRI) Model


5.0 | 3 ratings Rate this file 69 Downloads (last 30 days) File Size: 12 KB File ID: #34863
image thumbnail

International Reference Ionosphere (IRI) Model



31 Jan 2012 (Updated )

Get the International Reference Ionosphere (IRI) output parameters.

| Watch this File

File Information

Computes the International Reference Ionosphere (IRI), which is an internationally recognized model for various ionospheric properties. I would call it more of a hack than a true IRI implementation as it works by querying the online interface at using the curl command on an operating system terminal. Because of this, it requires an internet connection and is pretty slow, but if high speed is not an important issue for you, this can be an easy way to get IRI data into MATLAB.

An example script for how to use the function is given as iritest.m. This is also the script that generated the attached screenshot. It took a little less than 15 minutes to run on my computer.

As stated, the query is made using the command curl in an operating system terminal. This program is built-in to Unix (and Mac I believe) but not Windows. Windows users can download cURL from You'll have to download the appropriate executable for your operating system, and I recommend putting it in the same directory as iri.m.


This file inspired Msis E 90.

Required Products MATLAB
MATLAB release MATLAB 7.5 (R2007b)
Other requirements curl.exe (can be downloaded at if not included in your operating system).
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (12)
03 Apr 2014 Drew Compston

Guanyi, The IRI 2007 model online interface I have been using for this function does not allow for inputting the 10.7 indices (just Rz12 and IG12). But it looks like they have an updated model (IRI 2012) that does incorporate that. I'll provide an updated version soon that utilizes the new model.

03 Apr 2014 Guanyi

I tried the iritest. Many thanks for such a powerful programs. However, when I tried to input F10.7 in the program, I found that it is in the output. Can I use the observed 10.7 index as an input? How should I modified the program? Thanks!

04 Apr 2013 Derek

Drew, thank you! That fixed my problems! Thanks again for this awesome code!

01 Apr 2013 Drew Compston

Derek, there were some problems in some of the time sweeps (unrelated to number of points) which I just fixed and uploaded. Longitude sweeps can also be tricky: First of all, they only work for altitude = 100, and something like [-2 -1 0 1 2] will not work because the negative numbers wrap around to near 360, resulting in a big gap. Please feel free to post any other specific examples where maybe it should calculate a linear sweep but doesn't.

27 Mar 2013 Derek

Actually, I retract my statement saying "I believe this is because sweepstop = min([sweep(end) + sweepstep/10, sweepmax]); should be sweepstop = [sweep(end) + sweepstep/10, sweepmax];"

27 Mar 2013 Derek

Thank you for submitting this code and updating it. On that note, I believe there is an issue with sweeping linear arrays greater than 500 elements. The program should enter into case {1 2 3 4 5 6 7} however, it instead moves to case 8. If the adjustment is made to force the program into case {1 2 3 4 5 6 7}, sweeping still fails. I believe this is because sweepstop = min([sweep(end) + sweepstep/10, sweepmax]); should be sweepstop = [sweep(end) + sweepstep/10, sweepmax];

11 Oct 2012 Brandon

On line 496 in iri.m, there is a conversion from time into hours (in decimal form), and I think there is a mistake. The conversion divides seconds by 360 when I think it should be 3600.

22 May 2012 Drew Compston

Krishna, as you pointed out, there was a bug in my geocentric coordinate conversion which might have caused your confusion. Look at it when the new version I just uploaded gets approved. When the input COORD is 'geoc', input LATITUDE is elevation, input LONGITUDE is azimuth, and input ALTITUDE is range.

22 May 2012 Krishna Prasad

Hi This is a great piece of code.But I have a small doubt.When the input is geocentric coordinate system we need azimuth,elevation and range to convert it to geodetic coordinates your code converts does this conversion but where does you give elevation,azimuth and range as input.And there is minor bug in the code where you used sph2cart function.Have a look at it.May be I am wrong I am not sure.But this is really awesome stuff it helped me a lot..

13 Feb 2012 Allen Kummer  
13 Feb 2012 Allen Kummer  
13 Feb 2012 Allen Kummer

For robustness, I would suggest updating the definition for endcmd at line 386 with below. As written, if your path has a space in it, curl gets confused, so adding quotes around the path name helps.

Otherwise the file seems to work great!

Also, for your information, at least my mac has curl built in.

endcmd = [Rz12 IG12 tec_hmax ...
'&ne_top=' ne_top ...
'&imap=' fpeak ...
'&ffof2=' storm ...
'&ib0=' bottom ...
'&probab=' f1prob ...
'&dreg=' d_reg ...
'&tset=' Te_top ...
'&icomp=' ioncomp ...
sprintf('&nmf2=%g.', f2peak_N) ...
sprintf('&f2=%g.', f2peak_M) ...
sprintf('&vars=%i', 11:50) ...
'" > "' ...
fullfile(fpath, 'temp.html"')];

02 Feb 2012

Fixed typo in title/description.

13 Feb 2012

Fixed some more typos in the comments of the files and made the changes suggested in Allen Kummer's comments.

13 Feb 2012

Fixed a problem where the online interface didn't do a full sweep for fractional steps and added an error check on reading temp.html from the interface.

22 May 2012

Fixed geocentric coordinate conversion bug.

07 Aug 2012

Updated initial comment block, added an error check on calling curl, fixed/updated some of the other error checks, and added capability to run example script without Mapping Toolbox.

11 Oct 2012

Fixed bug pointed out by Brandon (old line 459 actually I believe, not 496) and also fixed an odd issue with the online interface output for longitude sweeps and non-default altitude (first noticed by John H.).

18 Jan 2013

Fixed problem where online interface would hang without returning anything for some inputs (including in iritest.m).

01 Apr 2013

Fixed some problems in sweeping day of year/month/etc.

Contact us