aacgmv2._aacgmv2

This submodule contains the interface to the AACGM-v2 C library. For the user-friendly wrapper, see the functions in aacgmv2.wrapper.

Interface to the AACGM-v2 C library.

aacgmv2._aacgmv2.convert(in_lat, in_lon, height, code)

Converts between geographic/dedic and magnetic coordinates.

Parameters:
  • in_lat ((float)) – Input latitude in degrees N (code specifies type of latitude)
  • in_lon ((float)) – Input longitude in degrees E (code specifies type of longitude)
  • height ((float)) – Altitude above the surface of the earth in km
  • code ((int)) – Bitwise code for passing options into converter (default=0) 0 - G2A - geographic (geodetic) to AACGM-v2 1 - A2G - AACGM-v2 to geographic (geodetic) 2 - TRACE - use field-line tracing, not coefficients 4 - ALLOWTRACE - use trace only above 2000 km 8 - BADIDEA - use coefficients above 2000 km 16 - GEOCENTRIC - assume inputs are geocentric w/ RE=6371.2
Returns:

  • out_lat ((float)) – Output latitude in degrees
  • out_lon ((float)) – Output longitude in degrees
  • out_r ((float)) – Geocentric radial distance in Re

aacgmv2._aacgmv2.convert_arr(in_lat, in_lon, height, code)

Converts between geographic/dedic and magnetic coordinates.

Parameters:
  • in_lat ((list)) – Input latitudes in degrees N (code specifies type of latitude)
  • in_lon ((list)) – Input longitudes in degrees E (code specifies type of longitude)
  • height ((list)) – Altitudes above the surface of the earth in km
  • code ((int)) – Bitwise code for passing options into converter (default=0) 0 - G2A - geographic (geodetic) to AACGM-v2 1 - A2G - AACGM-v2 to geographic (geodetic) 2 - TRACE - use field-line tracing, not coefficients 4 - ALLOWTRACE - use trace only above 2000 km 8 - BADIDEA - use coefficients above 2000 km 16 - GEOCENTRIC - assume inputs are geocentric w/ RE=6371.2
Returns:

  • out_lat ((list)) – Output latitudes in degrees
  • out_lon ((list)) – Output longitudes in degrees
  • out_r ((list)) – Geocentric radial distances in Re
  • out_bad ((list)) – Indices at or greater than zero indicate filler data in previous outputs

Notes

Return values of -666 are used as filler values for lat/lon/r, while filler values of -1 are used in out_bad if the output in out_lat/lon/r is good

aacgmv2._aacgmv2.inv_mlt_convert(yr, mo, dy, hr, mt, sc, mlt)

Converts from universal time and magnetic local time to magnetic longitude.

Parameters:
  • yr ((int)) – 4 digit integer year (1900-2020)
  • mo ((int)) – Month of year (1-12)
  • dy ((int)) – Day of month (1-31)
  • hr ((int)) – hours of day (0-23)
  • mt ((int)) – Minutes of hour (0-59)
  • sc ((int)) – Seconds of minute (0-59)
  • mlt ((float)) – Magnetic local time
Returns:

mlon – Magnetic longitude (degrees)

Return type:

(float)

aacgmv2._aacgmv2.inv_mlt_convert_arr(yr, mo, dy, hr, mt, sc, mlt)

Converts from universal time and magnetic local time to magnetic longitude.

Parameters:
  • yr ((list)) – 4 digit integer year (1900-2020)
  • mo ((list)) – Month of year (1-12)
  • dy ((list)) – Day of month (1-31)
  • hr ((list)) – hours of day (0-23)
  • mt ((list)) – Minutes of hour (0-59)
  • sc ((list)) – Seconds of minute (0-59)
  • mlt ((list)) – Magnetic local time
Returns:

mlon – Magnetic longitude (degrees)

Return type:

(list)

aacgmv2._aacgmv2.inv_mlt_convert_yrsec(yr, yr_sec, mlt)

Converts from universal time and magnetic local time to magnetic longitude.

Parameters:
  • yr ((int)) – 4 digit integer year (1900-2020)
  • yr_sec ((int)) – Seconds of year (0-31622400)
  • mlt ((float)) – Magnetic local time
Returns:

mlon – Magnetic longitude (degrees)

Return type:

(float)

aacgmv2._aacgmv2.mlt_convert(yr, mo, dy, hr, mt, sc, mlon)

Converts from universal time to magnetic local time.

Parameters:
  • yr ((int)) – 4 digit integer year (1900-2020)
  • mo ((int)) – Month of year (1-12)
  • dy ((int)) – Day of month (1-31)
  • hr ((int)) – hours of day (0-23)
  • mt ((int)) – Minutes of hour (0-59)
  • sc ((int)) – Seconds of minute (0-59)
  • mlon ((float)) – Magnetic longitude
Returns:

mlt – Magnetic local time (hours)

Return type:

(float)

aacgmv2._aacgmv2.mlt_convert_arr(yr, mo, dy, hr, mt, sc, mlon)

Converts from universal time to magnetic local time.

Parameters:
  • yr ((list)) – 4 digit integer year (1900-2020)
  • mo ((list)) – Month of year (1-12)
  • dy ((list)) – Day of month (1-31)
  • hr ((list)) – hours of day (0-23)
  • mt ((list)) – Minutes of hour (0-59)
  • sc ((list)) – Seconds of minute (0-59)
  • mlon ((list)) – Magnetic longitude
Returns:

mlt – Magnetic local time (hours)

Return type:

(list)

aacgmv2._aacgmv2.mlt_convert_yrsec(yr, yr_sec, mlon)

Converts from universal time to magnetic local time.

Parameters:
  • yr ((int)) – 4 digit integer year (1900-2020)
  • yr_sec ((int)) – Seconds of year (0-31622400)
  • mlon ((float)) – Magnetic longitude
Returns:

mlt – Magnetic local time (hours)

Return type:

(float)

aacgmv2._aacgmv2.set_datetime(year, month, day, hour, minute, second)

Sets the date and time for the IGRF magnetic field.

Parameters:
  • year ((int)) – Four digit year starting from 1900, ending 2020
  • month ((int)) – Month of year ranging from 1-12
  • day ((int)) – Day of month (1-31)
  • hour ((int)) – Hour of day (0-23)
  • minute ((int)) – Minute of hour (0-59)
  • second ((int)) – Seconds of minute (0-59)
Returns:

Return type:

Void