Skip to content

Utility Functions

utils

Utility functions for SatKit

update_datafiles(**kwargs)

Download & store data files needed for "satkit" computations

Keyword Args:

overwrite (bool): Download and overwrite files if they already exist dir(string): Target directory for files. Uses existing data directory if not specified. (see "datadir" function)

Notes
  • Files include:

    • EGM96.gfc : EGM-96 Gravity Model Coefficients
    • JGM3.gfc : JGM-3 Gravity Model Coefficients
    • JGM2.gfc : JGM-2 Gravity Model Coefficients
    • ITU_GRACE16.gfc : ITU Grace 16 Gravity
    • tab5.2a.txt : Coefficients for GCRS to GCRF conversion
    • tab5.2b.txt : Coefficients for GCRS to GCRF conversion
    • tab5.2d.txt : Coefficients for GCRS to GCRF conversion
    • SW-ALL.csv : Space weather data, updated daily
    • leap-seconds.txt : Leap seconds (UTC vs TAI)
    • EOP-All.csv : Earth orientation parameters, updated daily
    • linux_p1550p2650.440 : JPL Ephemeris version 440 (~ 100 MB)
  • The space weather and earth orientation parameters files are updated daily and will always be downloaded regardless of the overwrite flag

Example
# Download all data files to the default data directory
satkit.utils.update_datafiles()

# Force re-download of all files
satkit.utils.update_datafiles(overwrite=True)

datadir()

Return directory currently used to hold necessary data files for the directory

Data directory is 1st of following directories search that contains the data files listed in "update_datafiles"

  • MacOS:

    1. Directory pointed to by SATKIT_DATA environment variable
    2. $DYLIB/satkit-data where $DYLIB is location of compiled python satkit library
    3. $HOME/LIBRARY/Application Support/satkit-data
    4. $HOME/.astro-data
    5. $HOME
    6. /usr/share/astro-data
    7. /Library/Application Support/astro-data
  • Linux:

    1. Directory pointed to by SATKIT_DATA environment variable
    2. $DYLIB/satkit-data where $DYLIB is location of compiled python satkit library
    3. $HOME/.astro-data
    4. $HOME
    5. /usr/share/astro-data
  • Windows:

    1. Directory pointed to by SATKIT_DATA environment variable
    2. $DYLIB/satkit-data where $DYLIB is location of compiled python satkit library
    3. $HOME/.astro-data
    4. $HOME
Example
print(satkit.utils.datadir())
# /Users/user/.astro-data

set_datadir(datadir)

Set the data directory

Parameters:

Name Type Description Default
datadir str

Path to the data directory

required

Raises:

Type Description
RuntimeError

If the directory does not exist

datafiles_exist()

Check if data files are found

Returns:

Name Type Description
bool bool

True if data files are found, False otherwise

dylib_path()

Return path to the compiled satkit library

Returns:

Name Type Description
str str

Path to the compiled library

githash()

Return git hash of this satkit build

Returns:

Name Type Description
str str

Git hash of this satkit build

build_date()

Return build date of this satkit library as a string

Returns:

Name Type Description
str str

Build date of this satkit library

version()

Return version of this satkit library as a string

Returns:

Name Type Description
str str

Version of this satkit library