diff options
Diffstat (limited to 'getsfik.ps1')
-rw-r--r-- | getsfik.ps1 | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/getsfik.ps1 b/getsfik.ps1 new file mode 100644 index 0000000..469afbd --- /dev/null +++ b/getsfik.ps1 @@ -0,0 +1,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) |