Space indices can now be fetch automatically in SatelliteToolbox.jl


#1

Hi guys!

I have just pushed a lot of modifications to SatelliteToolbox.jl. I added the support for fetching space indices that are required to compute atmospheric models. Right now, we have support to get these indices:

Kp, Ap, F10.7, S10, M10, Y10

We also have support to compute the moving average of the last four.

Thus, let’s say you want to compute the daily mean Ap and 81-day average F10.7 at 2017-06-19, then you just need to do:

julia> init_space_indices();
[ Info: Downloading file 'DTCFILE.TXT' from 'http://sol.spacenvironment.net/jb2008/indices/DTCFILE.TXT'.
[ Info: Downloading file 'fluxtable.txt' from 'ftp://ftp.geolab.nrcan.gc.ca/data/solar_flux/daily_flux_values/fluxtable.txt'.
[ Info: Downloading file 'SOLFSMY.TXT' from 'http://sol.spacenvironment.net/jb2008/indices/SOLFSMY.TXT'.
[ Info: Downloading file 'kp2017.wdc' from 'ftp://ftp.gfz-potsdam.de/pub/home/obs/kp-ap/wdc/kp2017.wdc'.
[ Info: Downloading file 'kp2015.wdc' from 'ftp://ftp.gfz-potsdam.de/pub/home/obs/kp-ap/wdc/kp2015.wdc'.
[ Info: Downloading file 'kp2016.wdc' from 'ftp://ftp.gfz-potsdam.de/pub/home/obs/kp-ap/wdc/kp2016.wdc'.
[ Info: Downloading file 'kp2018.wdc' from 'ftp://ftp.gfz-potsdam.de/pub/home/obs/kp-ap/wdc/kp2018.wdc'.

julia> JD = DatetoJD(2017,6,19,0,0,0);

julia> get_space_index(Ap(), JD)
4.5

julia> get_space_index(F10Madj(), JD; window = 81)
77.92962962962966

The good thing is that now we can compute the atmospheric density without needing to manually get the space indices data (for past days of course). For example, if you want to compute the atmospheric density in the following location:

  • Latitude: -23˚
  • Longitude: -45˚
  • Date: 2016-10-19 @ 14:00:00

then you just need to do:

julia> nrlmsise00(DatetoJD(2016,10,19,14,00,00), 750e3, -23*pi/180, -45*pi/180; output_si = false, dversion = false)
NRLMSISE00_Output{Float64}
  den_N: Float64 2860.4183009695835
  den_N2: Float64 12.141431187588672
  den_O: Float64 67781.3862464794
  den_aO: Float64 5044.235371497685
  den_O2: Float64 0.04503651487434012
  den_H: Float64 148814.26555193574
  den_He: Float64 700462.0267827582
  den_Ar: Float64 2.0371887656858425e-6
  den_Total: Float64 6.7654160048712925e-18
  T_exo: Float64 821.1537129687955
  T_alt: Float64 821.1536995447245
  flags: Dict{Symbol,Bool}

Comparing to the online version of NRLMSISE00, we can see that it is really close:

   Selected parameters are:
1 Height, km
2 O, cm-3 
3 N2, cm-3
4 O2, cm-3
5 Mass_density, g/cm-3
6 Temperature_neutral, K
7 Temperature_exospheric, K
8 He, cm-3 
9 Ar, cm-3
10 H, cm-3
11 N, cm-3
12 Anomalous_Oxygen, cm-3

    1          2          3          4         5      6     7          8          9         10         11         12
750.0  6.820E+04  1.227E+01  4.549E-02 6.785E-18  821.6   822  7.017E+05  2.067E-06  1.486E+05  2.875E+03  5.046E+03

Everything is in master and I need to do some testing before releasing a new version. Hence, I would appreciate any feedback!


#2

By the way, this was only possible due to the amazing packages RemoteFiles.jl and OptionalData.jl by @helgee.