From 0731683ea248d089371ff3c3a70f93c913c3b610 Mon Sep 17 00:00:00 2001 From: mlot Date: Fri, 6 Jun 2025 12:58:14 -0400 Subject: initial commit --- README.md | 5 +++++ getsfik.ps1 | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 README.md create mode 100644 getsfik.ps1 diff --git a/README.md b/README.md new file mode 100644 index 0000000..30a4d03 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# GetSfiK + +This Powershell script 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). + +Only really useful to amateur radio operators looking to quickly evaluate HF propagation conditions from a PS command line. \ No newline at end of file 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) -- cgit