pygnss 0.6.0__cp312-cp312-musllinux_1_2_x86_64.whl → 1.0.0__cp312-cp312-musllinux_1_2_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pygnss might be problematic. Click here for more details.

pygnss/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.6.0"
1
+ __version__ = "1.0.0"
pygnss/ionex.py CHANGED
@@ -4,8 +4,10 @@ import math
4
4
  import os
5
5
  from typing import List
6
6
 
7
+ import nequick
7
8
  import numpy as np
8
9
 
10
+
9
11
  from .iono import gim
10
12
  from .decorator import read_contents
11
13
 
@@ -268,14 +270,43 @@ def _parse_ionex_epoch(ionex_line: str) -> datetime.datetime:
268
270
  return datetime.datetime.strptime(ionex_line[:36], _HEADER_EPOCH_FORMAT)
269
271
 
270
272
 
273
+
274
+ class NeQuickGimHandlerArray(gim.GimHandler):
275
+ """
276
+ Handler to store the incoming GIMs in arrays
277
+ """
278
+
279
+ def __init__(self):
280
+ self.vtec_gims: List[gim.Gim] = []
281
+
282
+ def process(self, nequick_gim: nequick.Gim):
283
+ """
284
+ Process a GIM file
285
+ """
286
+
287
+ incoming_gim = gim.Gim(nequick_gim.epoch,
288
+ nequick_gim.longitudes, nequick_gim.latitudes,
289
+ nequick_gim.vtec_values)
290
+
291
+ self.vtec_gims.append(incoming_gim)
292
+
293
+
271
294
  def cli():
272
295
  """
273
296
  This function allows users to compute the difference between two IONEX files
297
+ or between an IONEX file and the NeQuick model (with three coefficients),
274
298
  and save the result in a new IONEX file.
299
+
300
+
301
+ Example:
302
+ Compute the difference between two IONEX files:
303
+ $ python ionex.py file1.ionex file2.ionex output.ionex
304
+
305
+ Compute the difference between an IONEX file and the NeQuick model:
306
+ $ python ionex.py file1.ionex output.ionex --nequick 0.123 0.456 0.789
275
307
  """
276
- parser = argparse.ArgumentParser(
277
- description="Compute the difference between two IONEX files and save the result in a new IONEX file."
278
- )
308
+ parser = argparse.ArgumentParser(description=cli.__doc__,
309
+ formatter_class=argparse.RawDescriptionHelpFormatter )
279
310
 
280
311
  parser.add_argument(
281
312
  "lhs",
@@ -284,19 +315,96 @@ def cli():
284
315
  )
285
316
 
286
317
  parser.add_argument(
287
- "rhs",
318
+ "output",
319
+ type=str,
320
+ help="Path to the output IONEX file where the differences will be saved.",
321
+ )
322
+
323
+ rhs = parser.add_mutually_exclusive_group(required=True)
324
+
325
+ rhs.add_argument(
326
+ "--rhs",
288
327
  type=str,
289
- help="Path to the second IONEX file (right-hand side).",
328
+ help="Path to the second IONEX file (right-hand side). If not provided, --nequick must be specified.",
329
+ )
330
+
331
+ rhs.add_argument(
332
+ "--nequick",
333
+ type=float,
334
+ nargs=3,
335
+ metavar=("AZ0", "AZ1", "AZ2"),
336
+ help="Use the NeQuick model to compare against the 'lhs' IONEX (instead of another IONEX file). "
337
+ "Specify the three NeQuick coefficients (az0, az1, az2).",
290
338
  )
291
339
 
292
340
  parser.add_argument(
293
- "output",
341
+ "--nequick-ionex",
294
342
  type=str,
295
- help="Path to the output IONEX file where the differences will be saved.",
343
+ default=None,
344
+ required=False,
345
+ metavar='<file>',
346
+ help="Specify a filename to store the NeQuick model in IONEX format",
296
347
  )
297
348
 
298
349
  args = parser.parse_args()
299
350
 
300
351
  PGM = "ionex_diff"
301
352
 
302
- diff(args.lhs, args.rhs, args.output, pgm=PGM)
353
+ # Validate input arguments
354
+ if args.rhs is None and args.nequick is None:
355
+ parser.error("Either a second IONEX file (rhs) or the '--nequick' option must be provided.")
356
+
357
+ if args.rhs is not None and args.nequick is not None:
358
+ parser.error("You cannot specify both a second IONEX file (rhs) and the '--nequick' option.")
359
+
360
+ if args.nequick_ionex is not None and args.nequick is None:
361
+ parser.error("Cannot output the IONEX file with the NeQuick model without the '--nequick' option.")
362
+
363
+ # Process the lhs IONEX file
364
+ gim_handler_lhs = gim.GimHandlerArray()
365
+ load(args.lhs, gim_handler=gim_handler_lhs)
366
+
367
+ # Add comments to the output file
368
+ comment_lines = [
369
+ "This IONEX file contains the differences of VTEC values,",
370
+ "computed as vtec_left - vtec_right, where:",
371
+ f"- vtec_left: {os.path.basename(args.lhs)}"
372
+ ]
373
+
374
+ # Process the rhs input (either an IONEX file or NeQuick coefficients)
375
+ gim_handler_rhs = None
376
+ if args.rhs:
377
+ gim_handler_rhs = gim.GimHandlerArray()
378
+ # Load the second IONEX file
379
+ load(args.rhs, gim_handler=gim_handler_rhs)
380
+ comment_lines += [f"- vtec_right: {os.path.basename(args.rhs)}"]
381
+
382
+ else:
383
+ gim_handler_rhs = NeQuickGimHandlerArray()
384
+ # Generate GIMs using NeQuick coefficients
385
+ coeffs = args.nequick
386
+ nequick_desc = ["NeQuick model", f" az0={coeffs[0]}", f" az1={coeffs[1]}", f" az2={coeffs[2]}"]
387
+ comment_lines += [f"- vtec_right: {nequick_desc[0]}"] + nequick_desc[1:]
388
+
389
+ for ionex_gim in gim_handler_lhs.vtec_gims:
390
+
391
+ nequick.to_gim(nequick.Coefficients(*coeffs),
392
+ ionex_gim.epoch,
393
+ latitudes = ionex_gim.latitudes,
394
+ longitudes = ionex_gim.longitudes,
395
+ gim_handler= gim_handler_rhs)
396
+
397
+ # Compute the difference
398
+ gim_diffs = gim.subtract_gims(gim_handler_lhs.vtec_gims, gim_handler_rhs.vtec_gims)
399
+
400
+
401
+ # Write the result to the output file
402
+ write(args.output, gim_diffs, gim.GimType.TEC, pgm=PGM, comment_lines=comment_lines)
403
+
404
+ if args.nequick_ionex is not None:
405
+ comment_lines = [
406
+ "TEC values generated with the " + nequick_desc[0]
407
+ ] + nequick_desc[1:]
408
+
409
+ write(args.nequick_ionex, gim_handler_lhs.vtec_gims, gim.GimType.TEC, pgm=PGM,
410
+ comment_lines=comment_lines )
pygnss/iono/chapman.py ADDED
@@ -0,0 +1,35 @@
1
+ """
2
+ Module to compute the Chapman ionospheric model.
3
+
4
+ This module provides functions to compute the Chapman ionospheric model,
5
+ which is used to estimate the electron density in the ionosphere based on
6
+ solar zenith angle and other parameters.
7
+ """
8
+
9
+ import numpy as np
10
+
11
+ HEIGHTS_KM = np.arange(60, 1000, 10)
12
+
13
+ def compute_chapman_profile(hmF2_km: float, NmF2: float, H_km: float, zenith_angle_deg: float, heights_km: float | np.ndarray =HEIGHTS_KM) -> float | np.ndarray:
14
+ """
15
+ Compute the Chapman ionospheric model.
16
+
17
+ Parameters:
18
+ zenith_angle (float or np.ndarray): Solar zenith angle, the angle between the vertical and the direction to the Sun.
19
+ hmF2_km (float): Height of the F2 layer in kilometers.
20
+ NmF2 (float): Peak electron density at hmF2 in electrons/m^3.
21
+ H_km (float): Scale height in kilometers (typical values between 30 and 50 km).
22
+ heights_km (np.ndarray, optional): Heights at which to compute the electron density.
23
+ If None, defaults to a range from 0 to 100 km.
24
+
25
+ Returns:
26
+ float or np.ndarray: Computed electron density based on the Chapman model.
27
+ """
28
+ # Convert zenith angle from degrees to radians
29
+ zenith_angle_rad = np.radians(zenith_angle_deg)
30
+
31
+ # Include scale height
32
+ z = (heights_km - hmF2_km) / H_km
33
+
34
+ # Compute the Chapman function
35
+ return NmF2 * np.exp( 0.5 * (1 - z - np.exp(-z) / np.cos(zenith_angle_rad)))
pygnss/iono/gim.py CHANGED
@@ -50,8 +50,8 @@ class GimHandlerArray(GimHandler):
50
50
  """
51
51
 
52
52
  def __init__(self):
53
- self.vtec_gims = []
54
- self.rms_gims = []
53
+ self.vtec_gims: List[Gim] = []
54
+ self.rms_gims: List[Gim] = []
55
55
 
56
56
  def process(self, gim: Gim, type: GimType):
57
57
  """
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pygnss
3
- Version: 0.6.0
3
+ Version: 1.0.0
4
4
  Summary: Package with utilities and tools for GNSS data processing
5
5
  Author-email: Miquel Garcia-Fernandez <miquel@mgfernan.com>
6
6
  License: MIT
7
7
  Requires-Python: >=3.10
8
8
  Description-Content-Type: text/markdown
9
9
  License-File: LICENSE
10
- Requires-Dist: nequick
10
+ Requires-Dist: nequick>=0.2.0
11
11
  Requires-Dist: numpy
12
12
  Requires-Dist: pandas>=2.2
13
13
  Requires-Dist: pyarrow>=18.0.0
@@ -1,12 +1,12 @@
1
- pygnss/__init__.py,sha256=cID1jLnC_vj48GgMN6Yb1FA3JsQ95zNmCHmRYE8TFhY,22
2
- pygnss/_c_ext.cpython-312-x86_64-linux-musl.so,sha256=ctqHTTBBdSAmNdjEjiY4tm7dgr5yDsZfDqepX3tb1Lc,83816
1
+ pygnss/__init__.py,sha256=J-j-u0itpEFT6irdmWmixQqYMadNl1X91TxUmoiLHMI,22
2
+ pygnss/_c_ext.cpython-312-x86_64-linux-musl.so,sha256=DG4vxh2TrbC-g7RuCcQAvm3zUig_pO5xcVg45l0ljUw,83816
3
3
  pygnss/cl.py,sha256=ISmd2RjikUMmj3nLPN0VSjvQLG5rLizp2X2ajeBkoDE,4509
4
4
  pygnss/constants.py,sha256=1hF6K92X6E6Ofo0rAuCBCgrwln9jxio26RV2a6vyURk,133
5
5
  pygnss/decorator.py,sha256=qB-0jl2GTEHJdvmDruNll5X3RrdySssv94u9Hok5-lA,1438
6
6
  pygnss/file.py,sha256=kkMBWjoTPkxJD1UgH0mXJT2fxnhU8u7_l2Ph5Xz2-hY,933
7
7
  pygnss/geodetic.py,sha256=3q8Rpl4b5CxGlhdn1nQRBHHSW1v-0PBFz54zOeVyO74,33633
8
8
  pygnss/hatanaka.py,sha256=P9XG6bZwUzfAPYn--6-DXfFQIEefeimE7fMJm_DF5zE,1951
9
- pygnss/ionex.py,sha256=Sk0U_hRyYE7cEwLyMIgiY-2bBs6wktzKmZdI92HrU7c,10422
9
+ pygnss/ionex.py,sha256=WcY6PVwjzATjqyC0Htc5Jh_cv2a7yz4TZIcD723TpsY,14325
10
10
  pygnss/logger.py,sha256=4kvcTWXPoiG-MlyP6B330l4Fu7MfCuDjuIlIiLA8f1Y,1479
11
11
  pygnss/nequick.py,sha256=tSsUw3FoRWS-TBKKVb0_c90DFz_2jUTkUvNPsGQOLA8,1722
12
12
  pygnss/rinex.py,sha256=LsOOh3Fc263kkM8KOUBNeMeIAmbOn2ASSBO4rAUJWj8,68783
@@ -27,14 +27,15 @@ pygnss/gnss/observables.py,sha256=0x0NLkTjxf8cO9F_f_Q1b-1hEeoNjWB2x-53ecUEv0M,16
27
27
  pygnss/gnss/residuals.py,sha256=8qKGNOYkrqxHGOSjIfH21K82PAqEh2068kf78j5usL8,1244
28
28
  pygnss/gnss/types.py,sha256=lmL15KRckRiTwVkYvGzF4c1BrojnQlegrYCXSz1hGaI,10377
29
29
  pygnss/iono/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
- pygnss/iono/gim.py,sha256=bJ-1jRIrkZj790fuCk3np72NrPaG_Qvx-EVZsvWMfsk,3521
30
+ pygnss/iono/chapman.py,sha256=u2XTQgEkQxhazfPGNdH5hEZ5YjPvATgMz4eIF4Adsfg,1396
31
+ pygnss/iono/gim.py,sha256=khKzClxLf46mVO6BCDk9u9DgS_50d-sbWEyoUQu7Jng,3543
31
32
  pygnss/orbit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
33
  pygnss/orbit/kepler.py,sha256=QORTgg5yBtsQXxLWSzoZ1pmh-CwPiZlFdIYqhQhv1a0,1745
33
34
  pygnss/orbit/tle.py,sha256=6CIEielPgui3DXNv46XxOGlig31ROIwjH42xLGaeE5M,5905
34
35
  pygnss/parsers/rtklib/stats.py,sha256=YV6yadxMeQMQYZvsUCaSf4ZTpK8Bbv3f2xgu0l4PekA,5449
35
- pygnss-0.6.0.dist-info/METADATA,sha256=0gGj855FG6F9WGYHCsZ3gbEPX8avn7JP_P5r3QNExa4,1659
36
- pygnss-0.6.0.dist-info/WHEEL,sha256=ENczIf-GYPIfQ0_PXY8w5mFbOCUfjnGClbW6hbN_vLc,112
37
- pygnss-0.6.0.dist-info/entry_points.txt,sha256=awWUCMfX3uMIAPPZqZfSUuw7Kd7defip8L7GtthKqgg,292
38
- pygnss-0.6.0.dist-info/top_level.txt,sha256=oZRSR-qOv98VW2PRRMGCVNCJmewcJjyJYmxzxfeimtg,7
39
- pygnss-0.6.0.dist-info/RECORD,,
40
- pygnss-0.6.0.dist-info/licenses/LICENSE,sha256=Wwany6RAAZ9vVHjFLA9KBJ0HE77d52s2NOUA1CPAEug,1067
36
+ pygnss-1.0.0.dist-info/METADATA,sha256=sDTBwqqNfXkPm03E0EEnHedlYv86Gwt1lc-SNlH5mOA,1666
37
+ pygnss-1.0.0.dist-info/WHEEL,sha256=AwHYJA1Do1jwgPIoLQR4DiHSeYY_vU6Ht9Vljq5Yt_M,112
38
+ pygnss-1.0.0.dist-info/entry_points.txt,sha256=awWUCMfX3uMIAPPZqZfSUuw7Kd7defip8L7GtthKqgg,292
39
+ pygnss-1.0.0.dist-info/top_level.txt,sha256=oZRSR-qOv98VW2PRRMGCVNCJmewcJjyJYmxzxfeimtg,7
40
+ pygnss-1.0.0.dist-info/RECORD,,
41
+ pygnss-1.0.0.dist-info/licenses/LICENSE,sha256=Wwany6RAAZ9vVHjFLA9KBJ0HE77d52s2NOUA1CPAEug,1067
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (77.0.3)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp312-cp312-musllinux_1_2_x86_64
5
5