Git Product home page Git Product logo

ionfr's Introduction

ionFR

A code that allows you to predict the ionospheric Faraday rotation for a specific line-of-sight, geographic location, and epoch

Introduction

ionFR is a software package that provides an estimate the ionospheric Faraday rotation along a given line-of-sight (LOS) at a specific geographic location. The software uses the International Geomagnetic Reference Field (IGRF12; available at https://www.ngdc.noaa.gov/IAGA/vmod/igrf.html) and global ionospheric maps given in the IONosphere map EXchange format (IONEX) that provide global TEC values (available at https://cddis.nasa.gov/archive/gps/products/ionex/).

ionFR has been written almost entirely in Python. This software package has been proven to work well under the Ubuntu operating system.

Users are encouraged to report bugs or flaws. Suggestions or comments that the users think will improve this code are also welcomed.

Installation

You will need the following modules from python intalled in your machine:

  • numpy
  • scipy
  • future You also need the gcc compiler

The following are a few steps to get this code working:

  1. extract and open the ionFR/ folder

  2. Note: This step should now be redundant. Open the file 'ionFRM.py' and modify the variable 'path' in the first line to <your_path> (the location of the directory on your machine). Example: /home/carlos/Documents/

  3. compile and create an executable of the software that has version 13 of the IGRF (IGRF13.COF). Go to <your_path>/ionFR/IGRF/geomag70_linux/ and type the following:

    gcc -lm geomag70.c -o geomag70.exe

  4. add to your PATH variable in your .bashrc or profile file the following: export PATH=$PATH:<your_path>/ionFR

  5. make the ionFRM.py script located in <your_path>/ionFR executable: chmod +x ionFRM.py

  6. That's it! Have fun :-)

Getting started and testing the code

One you have installed ionFR in your computer, you will be able to run it from the terminal.

To test the package, open a terminal and copy the IONEX file codg2930.11i in the directory ionFR/test, to your current working directory. Then, execute the following command:

ionFRM.py 08h37m05.6s+06d10m14.5s 52d54m54.6sn 6d52m11.7se 2011-10-20T00:00:00 codg2930.11i

ionFR should produce a text file, IonRM.txt, which will contain ionospheric Faraday rotation values and uncertainties along the given LOS in steps of 1 hour during an entire day. For more on the outputs see "ionFR output" below.

Input arguments

ionFRM.py Source_RA±DEC Telescope_Latitude Telescope_Longitude Date Ionex_file

  • Source_RA±DEC (string) Right Ascencion and Declination for a given LOS. Examples: 16h50m04.0s+79d11m25.0s (positive dec.); 16h50m04.0s-79d11m25.0s (negative dec.)

  • Telescope_Latitude (string) Latitude of the location where a given LOS is being observed. Examples: 52d54m54.64sn (lat. north); 52d54m54.64ss (lat. south)

  • Telescope_Longitude (string) Longitude of the location where a given LOS is being observed. Examples: 6d52m11.7se (lon. east); 6d52m11.7sw (lon. west)

  • Date (string) Date when you want to predict the Ionospheric Faraday rotation in format YYYY-MM-DDT00:00:00. Examples: 2004-05-19T00:00:00; 2011-10-20T00:00:00

  • IONEX_file (string) Name of the IONEX file needed. Note: the IONEX file should be from the same date specified above. Example: codg2930.11i; igsg1130.19i

The python script url_download.py allows you to download the correct IONEX file from the website. ftpdownload.py no longer works because https://cddis.nasa.gov/ no longer allow anonymous ftp downloads. You have to create an account at https://urs.earthdata.nasa.gov/ and create a local .netrc file following instructions at https://cddis.nasa.gov/Data_and_Derived_Products/CreateNetrcFile.html The code should then work as follows:

python url_download.py -d DATE (format YYYY-MM-DD) -t IONEX_file_type (string e.g. igsg, codg, etc.)

Example: url_download.py -d 2011-10-20 -t igsg

The IONEX files are downloaded as compressed .Z files. These can be unpacked using e.g. gunzip or other suitable command. Note that ionFR is compatible with IONEX files with 2-hr time resolution. CODE IONEX files (codg) have changed format and will not be immediately compatible with ionFR after ~2014. However, alternative files (igsg) remain compatible with ionFR.

ionFR Output

A file called IonRM.txt will be created in the folder where you ran the test. This file contains five columns:

  1. Hour of the day in Universal Time (UT)
  2. TEC along the LOS
  3. Geomagnetic field along the LOS
  4. Ionospheric Faraday rotation along the LOS
  5. Uncertainties Ionospheric Faraday rotation values in column 4.

ionFR will produce values only for source elevations higher than 0 degrees.

An example python plot showing the output is included as test/plot_ionFR_output.png. A juypiter notebook used to create this plot is included as test/plot_ionFR_output.ipynb

Note: Ionospheric Faraday rotation estimates obtained for southern hemisphere observations (i.e. below the magnetic equator) will require a minus sign to be added (i.e. x-1), in accordance with the definition of Faraday rotation measure. A positive (negative) RM implies a magnetic field pointing towards (away from) the observer.

For more information about the code, we refer you to: Sotomayor-Beltran et al. 2013, Astronomy & Astrophysics, Volume 552, id.A58 https://ui.adsabs.harvard.edu/abs/2013A%26A...552A..58S https://ui.adsabs.harvard.edu/abs/2015A%26A...581C...4S

ionfr's People

Contributors

csobey avatar cjordan avatar

Stargazers

 avatar juntaobai avatar Nihan Pol avatar Ujjwal Panda avatar Pravir Kumar avatar Xiao Xue avatar Sarvesh Mangla avatar Richard Stanley avatar  avatar

Watchers

Richard Stanley avatar  avatar

ionfr's Issues

bug in url_download.py

Hi Charlotte,

Thanks for this code! I just found a bug that prevents the download code from being used on certain dates.

if dayofyear < 10:
        dayofyear = '00'+str(dayofyear)
if dayofyear < 100 and dayofyear >= 10:
        dayofyear = '0'+str(dayofyear)

That 2nd if should be an elif since if the first one is True, it converts dayofyear into a string which can't then be compared to a number for the 2nd one.

Thanks again,

Scott

Correction after 2015

I'm trying to calculate the ionospheric corrections of some pulsars observed in 2021.
However, the code only allows the range 1990 - 2015. Is there a way to bypass this issue since I notice many papers still using ionFR to calculate corrections in years later than 2015.

bug in ippcoor_v1.py

When running the suggested test command in the README (ionFRM.py 08h37m05.6s+06d10m14.5s 52d54m54.6sn 6d52m11.7se 2011-10-20T00:00:00 codg2930.11i), I get the following error:

Traceback (most recent call last):
  File "/Users/william/Software/ionFR/ionFRM.py", line 89, in <module>
    offLat,offLon,AzPunct,ZenPunct = ippcoor.PuncIonOffset(LatO,AzS,ZenS,AltIon)
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/william/Software/ionFR/PunctureIonosphereCoord/ippcoor_v1.py", line 41, in PuncIonOffset
    if AzSou > pi:
               ^^
NameError: name 'pi' is not defined

It seems that in my current, relatively fresh install of python/scipy, from scipy import * does not import scipy.pi. This can be fixed by changing that line to from scipy import pi, since that is all that is needed from scipy here. This reveals a second bug in the same script, but all that is required is to also import math. The command works after I make those changes.

Earthdata now provides 25 maps

I've only just started using this code so I am not sure when the change occurred, but if I use url_download.py to get the latest version of some ionex data, it has 25 TEC and 25 RMS maps. teccalc.py and tecrmscalc.py are only expecting 13 maps. So when they get to this block:

newa = numpy.zeros((totalmaps, int(pointsLat), int(pointsLon)))
inc = 0
for item in range(int(NumberOfMaps)):
        newa[inc,:,:] = a[item,:,:]
        inc = inc + 2

it fails with:

    newa[inc,:,:] = a[item,:,:]
IndexError: index 26 is out of bounds for axis 0 with size 25

This can be alleviated by simply commenting out lines 145 to 162 in teccalc.py and instead write

newa = a

and likewise for tecrmscalc.py.

I suggest making this more robust by testing the size of the input file and then running the interpolation only if needed.

Side note: there is also a python2 print statement on line 50 of url_download.py.

Thanks for providing this useful code!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.