Skip to content

Commit

Permalink
📚 Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ronisbr committed May 25, 2024
1 parent 8d2ac25 commit 5a3d56c
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 53 deletions.
5 changes: 2 additions & 3 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
SpaceIndices.jl
===============
# SpaceIndices.jl

This package allows to automatically fetch and parse space indices.

Expand All @@ -15,7 +14,7 @@ The space index sets supported in this version are:

This package can be installed using:

``` julia
```julia-repl
julia> using Pkg
julia> Pkg.add("SpaceIndices")
```
3 changes: 1 addition & 2 deletions docs/src/lib/library.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Library
=======
# Library

Documentation for `SpaceIndices.jl`.

Expand Down
11 changes: 3 additions & 8 deletions docs/src/man/api.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
SpaceIndices.jl API
===================
# SpaceIndices.jl API

```@meta
CurrentModule = SpaceIndices
DocTestSetup = quote
using SpaceIndices
end
```

This package defines an API to allow user to defin new space indices. We describe this API
Expand Down Expand Up @@ -91,8 +87,7 @@ function SpaceIndices.filenames(::Type{T}) where T<:SpaceIndexFile -> Vector{Str
```

This function can return a `Vector{String}` with the names of the remote files. The system
will used this information to save the data in the package scratch space.
For example:
will used this information to save the data in the package scratch space. For example:

```julia
SpaceIndices.filenames(::Type{MySpaceIndex}) = ["my_space_file.txt"]
Expand Down Expand Up @@ -185,4 +180,4 @@ julia> SpaceIndices.init()

julia> space_index(Val(:LeapSeconds), now())
37.0
```
```
29 changes: 14 additions & 15 deletions docs/src/man/get.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
Obtaining the Space Indices
===========================
# Obtaining the Space Indices

```@meta
CurrentModule = SpaceIndices
DocTestSetup = quote
using Dates
using SpaceIndices
end
```

```@repl get
using Dates
using SpaceIndices
using Scratch
Scratch.clear_scratchspaces!(SpaceIndices)
```

After the initialization shown in [Initialization of Space Indices](@ref), the user can
obtain the space index value using the function:

```julia
function space_index(::Val{:index}, jd::Number; kwargs...) -> Number
function space_index(::Val{:index}, instant::DateTime; kwargs...) -> Number
space_index(::Val{:index}, jd::Number; kwargs...) -> Number
space_index(::Val{:index}, instant::DateTime; kwargs...) -> Number
```

where `index` is the desired space index and `jd` is the Julian Day to obtain the
information. The latter can also be specified using `instant`, which is a `DateTime` object.

```julia-repl
julia> SpaceIndices.init()
```@repl get
SpaceIndices.init()
julia> space_index(Val(:F10adj), DateTime(2020, 6, 19))
70.2
space_index(Val(:F10adj), DateTime(2020, 6, 19))
julia> space_index(Val(:F10adj), 2.4590195e6)
70.2
space_index(Val(:F10adj), 2.4590195e6)
```

The following space indices are currently supported:
Expand Down Expand Up @@ -56,4 +56,3 @@ The following space indices are currently supported:
| | `S81a` | 81-day averaged EUV index (26-34 nm) scaled to F10.7 | 10⁻²² W / (M² ⋅ Hz) |
| | `M81a` | 81-day averaged MG2 index scaled to F10.7 | 10⁻²² W / (M² ⋅ Hz) |
| | `Y81a` | 81-day averaged solar X-ray & Lya index scaled to F10.7 | 10⁻²² W / (M² ⋅ Hz) |

23 changes: 11 additions & 12 deletions docs/src/man/initialization.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
Initialization of Space Indices
===============================
# Initialization of Space Indices

```@meta
CurrentModule = SpaceIndices
DocTestSetup = quote
using SpaceIndices
end
```

```@setup init
using SpaceIndices
using Scratch
Scratch.clear_scratchspaces!(SpaceIndices)
```

The files of all the registered space indices can be automatically downloaded using:

```julia
function SpaceIndices.init(; kwargs...) -> Nothing
SpaceIndices.init(; kwargs...) -> Nothing
```

If a file exists, the function checks if its expiry period has passed. If so, it downloads
Expand All @@ -32,7 +34,7 @@ If the user wants to initialize only one space index set, they can pass it to th
function:

```julia
function SpaceIndices.init(::Type{T}; kwargs...) where T<:SpaceIndexSet -> Nothing
SpaceIndices.init(::Type{T}; kwargs...) where T<:SpaceIndexSet -> Nothing
```

where `T` must be the space index set. In this case, the user have access to the following
Expand All @@ -48,11 +50,8 @@ keywords:
in the space index set `T`.
(**Default** = `nothing`)

```julia-repl
julia> SpaceIndices.init()
[ Info: Downloading the file 'DTCFILE.TXT' from 'http://sol.spacenvironment.net/jb2008/indices/DTCFILE.TXT'...
[ Info: Downloading the file 'SOLFSMY.TXT' from 'http://sol.spacenvironment.net/jb2008/indices/SOLFSMY.TXT'...
[ Info: Downloading the file 'SW-All.csv' from 'https://celestrak.org/SpaceData/SW-All.csv'...
```@repl init
SpaceIndices.init()
```

```julia-repl
Expand Down
24 changes: 11 additions & 13 deletions docs/src/man/quick_start.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
Quick Start
===========
# Quick Start

```@meta
CurrentModule = SpaceIndices
DocTestSetup = quote
using SpaceIndices
end
```

```@setup quick_start
using SpaceIndices
using Scratch
Scratch.clear_scratchspaces!(SpaceIndices)
```

This quick tutorial will show how to use **SpaceIndicies.jl** to obtain the F10.7 index at
2020-06-19.

First, we need to initialize all the space indices:

```julia-repl
julia> SpaceIndices.init()
[ Info: Downloading the file 'DTCFILE.TXT' from 'http://sol.spacenvironment.net/jb2008/indices/DTCFILE.TXT'...
[ Info: Downloading the file 'SOLFSMY.TXT' from 'http://sol.spacenvironment.net/jb2008/indices/SOLFSMY.TXT'...
[ Info: Downloading the file 'SW-All.csv' from 'https://celestrak.org/SpaceData/SW-All.csv'...
```@repl quick_start
SpaceIndices.init()
```

Afterward, we can obtain the desired space index using:

```julia-repl
julia> space_index(Val(:F10adj), DateTime(2020, 6, 19))
71.1
```@repl quick_start
space_index(Val(:F10adj), DateTime(2020, 6, 19))
```

0 comments on commit 5a3d56c

Please sign in to comment.