-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvalidate_dvoacap.py
More file actions
162 lines (142 loc) · 5.53 KB
/
Copy pathvalidate_dvoacap.py
File metadata and controls
162 lines (142 loc) · 5.53 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
"""
DVOACAP Validation Script
Validates installation and tests core functionality
Run this AFTER running install_dvoacap.py
"""
import sys
def validate_installation():
"""Validate DVOACAP installation and basic functionality."""
print("=" * 60)
print("DVOACAP Validation Script")
print("=" * 60)
print("\nThis script will test your DVOACAP installation")
print("and run a basic HF propagation prediction.\n")
# Test 1: Import dvoacap
print("=" * 60)
print("[1/4] Testing package import...")
print("=" * 60)
try:
import dvoacap
version = getattr(dvoacap, '__version__', 'unknown')
print(f"✓ Successfully imported dvoacap (version {version})")
except ImportError as e:
print(f"✗ FAILED: Cannot import dvoacap")
print(f" Error: {e}")
print("\nPlease run install_dvoacap.py first")
return False
# Test 2: Import core components
print("\n" + "=" * 60)
print("[2/4] Testing core components...")
print("=" * 60)
try:
from dvoacap import FourierMaps, ControlPoint, IonoPoint, compute_iono_params
print("✓ Core components available:")
print(" - FourierMaps (ionospheric data)")
print(" - ControlPoint (location/time)")
print(" - IonoPoint (geographic coordinates)")
print(" - compute_iono_params (calculation engine)")
except ImportError as e:
print(f"✗ FAILED: Cannot import core components")
print(f" Error: {e}")
return False
# Test 3: Load ionospheric maps
print("\n" + "=" * 60)
print("[3/4] Loading ionospheric maps...")
print("=" * 60)
print("Loading CCIR/URSI coefficients...")
try:
maps = FourierMaps()
print("✓ Ionospheric maps loaded successfully")
# Set conditions
print("\nSetting conditions:")
print(" - Month: June")
print(" - Sunspot Number (SSN): 100 (moderate solar activity)")
print(" - UTC Time: 12:00 (noon)")
maps.set_conditions(month=6, ssn=100, utc_fraction=0.5)
print("✓ Conditions set successfully")
except Exception as e:
print(f"✗ FAILED: Cannot load ionospheric maps")
print(f" Error: {e}")
return False
# Test 4: Run basic computation
print("\n" + "=" * 60)
print("[4/4] Running HF propagation prediction...")
print("=" * 60)
print("Computing ionospheric conditions at Halifax, Nova Scotia")
print("Location: 44.65°N, 63.57°W\n")
try:
import math
# Create control point at Halifax, NS
pnt = ControlPoint(
location=IonoPoint.from_degrees(44.65, -63.57),
east_lon=-63.57 * math.pi/180,
distance_rad=0.0,
local_time=0.5,
zen_angle=0.3,
zen_max=1.5,
mag_lat=50.0 * math.pi/180,
mag_dip=60.0 * math.pi/180,
gyro_freq=1.2
)
# Compute ionospheric parameters
compute_iono_params(pnt, maps)
print("✓ Prediction calculation successful!\n")
# Display results
print("=" * 60)
print("IONOSPHERIC PREDICTION RESULTS")
print("=" * 60)
print("\nLocation: Halifax, Nova Scotia (44.65°N, 63.57°W)")
print("Date: June")
print("Time: 12:00 UTC (Noon)")
print("Solar Activity: SSN 100 (moderate)")
print("\n" + "-" * 60)
print("IONOSPHERIC LAYERS:")
print("-" * 60)
print(f"E Layer: foE = {pnt.e.fo:5.2f} MHz at {pnt.e.hm:4.0f} km altitude")
print(f"F1 Layer: foF1 = {pnt.f1.fo:5.2f} MHz at {pnt.f1.hm:4.0f} km altitude")
print(f"F2 Layer: foF2 = {pnt.f2.fo:5.2f} MHz at {pnt.f2.hm:4.0f} km altitude")
print("-" * 60)
print("\nWhat these numbers mean:")
print(f" • E Layer (110 km): Supports frequencies up to {pnt.e.fo:.1f} MHz")
print(f" • F1 Layer (200 km): Supports frequencies up to {pnt.f1.fo:.1f} MHz")
print(f" • F2 Layer (300 km): Supports frequencies up to {pnt.f2.fo:.1f} MHz")
print(f"\n Maximum Usable Frequency (MUF): ~{pnt.f2.fo * 3.0:.1f} MHz")
print(f" (for this location and time)")
except Exception as e:
print(f"✗ FAILED: Prediction calculation error")
print(f" Error: {e}")
import traceback
traceback.print_exc()
return False
# Success!
print("\n" + "=" * 60)
print("✓ ALL TESTS PASSED!")
print("=" * 60)
print("\nDVOACAP is installed correctly and ready to use.")
print("\nFor more examples and documentation, visit:")
print("https://github.com/skyelaird/dvoacap-python")
print("https://skyelaird.github.io/dvoacap-python/")
return True
def main():
"""Main entry point."""
print("\n" + "=" * 60)
print("DVOACAP-Python - HF Propagation Prediction Engine")
print("=" * 60)
print("https://github.com/skyelaird/dvoacap-python\n")
success = validate_installation()
print("\n" + "=" * 60)
if success:
print("Status: ✓ VALIDATION SUCCESSFUL")
else:
print("Status: ✗ VALIDATION FAILED")
print("\nTroubleshooting:")
print("1. Make sure you ran install_dvoacap.py first")
print("2. Check that Python 3.11+ is installed")
print("3. Try: pip install --upgrade dvoacap")
print("\nFor help, create an issue at:")
print("https://github.com/skyelaird/dvoacap-python/issues")
print("=" * 60)
input("\nPress Enter to exit...")
return 0 if success else 1
if __name__ == "__main__":
sys.exit(main())