summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormlot <petri-rush-curvy@duck.com>2025-06-06 12:58:14 -0400
committermlot <petri-rush-curvy@duck.com>2025-06-06 12:58:14 -0400
commit0731683ea248d089371ff3c3a70f93c913c3b610 (patch)
tree8bbd186944d123353dacd262aee315ac947d55c2
initial commitHEADmain
-rw-r--r--README.md5
-rw-r--r--getsfik.ps133
2 files changed, 38 insertions, 0 deletions
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)