blob: 469afbd52504e55f961dc957d989e1c096747a72 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
function Get-CurrentSFIK {
<#
.SYNOPSIS
Retrieves current Solor Flux Index and K Index information in JSON format from NOAA. It then returns the two
most current variables (SFI first and K-Index second).
.EXAMPLE
$SFI, $K_INDEX = Get-CurrentSFIK
.NOTES
https://www.arrl.org/files/file/Technology/tis/info/pdf/0209038.pdf
#>
try {
$flux = Invoke-RestMethod -Uri "https://services.swpc.noaa.gov/json/f107_cm_flux.json"
$kindex = Invoke-RestMethod -Uri "https://services.swpc.noaa.gov/json/boulder_k_index_1m.json"
} catch {
$PSCmdlet.ThrowTerminatingError($_)
}
Return [int]$flux.flux[0], [int]$kindex.k_index[0]
}
$sfi, $kindex = Get-CurrentSFIK
Write-Host "Current SFI: $sfi`nCurrent K Index: $kindex"
if ( ($sfi -gt 149) -and ($kindex -lt 3) ) {
Write-Host -ForegroundColor Yellow "Good HF Propagation Conditions!"
} elseif ( ($sfi -gt 199) -and ($kindex -lt 3) ) {
Write-Host -ForegroundColor Green "Excellent HF Propagation Conditions!"
}
Exit(0)
|