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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
// Python bindings for the datasets module.
/// Load groundstation locations for a specific provider
///
/// Loads groundstation locations from embedded data. The data is compiled into
/// the binary and does not require external files or internet connection.
///
/// Args:
/// provider (str): Provider name (case-insensitive). Available providers:
/// - "atlas": Atlas Space Operations
/// - "aws": Amazon Web Services Ground Station
/// - "ksat": Kongsberg Satellite Services
/// - "leaf": Leaf Space
/// - "ssc": Swedish Space Corporation
/// - "viasat": Viasat
///
/// Returns:
/// list[PointLocation]: List of PointLocation objects with properties:
/// - name: Groundstation name
/// - provider: Provider name
/// - frequency_bands: List of supported frequency bands
///
/// Raises:
/// RuntimeError: If provider is unknown or data cannot be loaded.
///
/// Example:
/// ```python
/// import brahe as bh
///
/// # Load KSAT groundstations
/// ksat_stations = bh.datasets.groundstations.load("ksat")
///
/// for station in ksat_stations:
/// print(f"{station.name}: ({station.lon():.2f}, {station.lat():.2f})")
///
/// # Check properties
/// props = ksat_stations[0].properties()
/// print(f"Frequency bands: {props['frequency_bands']}")
/// ```
/// Load groundstations from a custom GeoJSON file
///
/// Loads groundstation locations from a user-provided GeoJSON file.
/// The file must be a FeatureCollection with Point geometries.
///
/// Args:
/// filepath (str): Path to GeoJSON file.
///
/// Returns:
/// list[PointLocation]: List of PointLocation objects.
///
/// Raises:
/// RuntimeError: If file cannot be read or parsed.
///
/// Example:
/// ```python
/// import brahe as bh
///
/// # Load custom groundstations
/// stations = bh.datasets.groundstations.load_from_file("my_stations.geojson")
/// ```
/// Load all groundstations from all providers
///
/// Convenience function to load groundstations from all available providers.
///
/// Returns:
/// list[PointLocation]: Combined list of all groundstations.
///
/// Raises:
/// RuntimeError: If no groundstations can be loaded.
///
/// Example:
/// ```python
/// import brahe as bh
///
/// all_stations = bh.datasets.groundstations.load_all()
/// print(f"Loaded {len(all_stations)} total groundstations")
/// ```
/// Get list of available groundstation providers
///
/// Returns:
/// list[str]: List of provider names that can be used with load().
///
/// Example:
/// ```python
/// import brahe as bh
///
/// providers = bh.datasets.groundstations.list_providers()
/// print(f"Available: {', '.join(providers)}")
/// ```
/// Download a DE kernel from NAIF with caching support
///
/// Downloads the specified DE (Development Ephemeris) kernel file from NASA JPL's NAIF
/// archive and caches it locally. If the kernel is already cached, returns the cached
/// path without re-downloading. Optionally copies the kernel to a user-specified location.
///
/// Args:
/// name (str): Kernel name. Supported kernels: "de430", "de432s", "de435", "de438",
/// "de440", "de440s", "de442", "de442s".
/// output_path (str, optional): Optional path to copy the kernel to after download/cache retrieval.
/// If not specified, returns the cache location.
///
/// Returns:
/// str: Path to the kernel file (cache location or output_path if specified).
///
/// Raises:
/// RuntimeError: If kernel name is unsupported, download fails, or file operations fail.
///
/// Example:
/// ```python
/// import brahe as bh
///
/// # Download and cache de440s kernel
/// kernel_path = bh.datasets.naif.download_de_kernel("de440s")
/// print(f"Kernel cached at: {kernel_path}")
///
/// # Download and copy to specific location
/// kernel_path = bh.datasets.naif.download_de_kernel("de440s", "/path/to/my_kernel.bsp")
/// print(f"Kernel saved to: {kernel_path}")
/// ```
///
/// Note:
/// - DE kernels are long-term stable products and are not refreshed once cached
/// - Files are cached to ~/.cache/brahe/naif/ (or $BRAHE_CACHE/naif/ if set)
/// - Kernel files are large (de440s: ~17MB, de440: ~114MB)
/// - Available at: https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/
// Functions are registered in mod.rs via add_function() calls