tatc 3.2.1__tar.gz → 3.2.2__tar.gz

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.
Files changed (30) hide show
  1. {tatc-3.2.1/src/tatc.egg-info → tatc-3.2.2}/PKG-INFO +11 -10
  2. {tatc-3.2.1 → tatc-3.2.2}/README.md +7 -8
  3. {tatc-3.2.1 → tatc-3.2.2}/pyproject.toml +4 -2
  4. {tatc-3.2.1 → tatc-3.2.2}/src/tatc/__init__.py +1 -1
  5. {tatc-3.2.1 → tatc-3.2.2}/src/tatc/analysis/coverage.py +2 -2
  6. {tatc-3.2.1 → tatc-3.2.2}/src/tatc/analysis/latency.py +1 -1
  7. {tatc-3.2.1 → tatc-3.2.2}/src/tatc/analysis/track.py +36 -27
  8. {tatc-3.2.1 → tatc-3.2.2}/src/tatc/utils.py +60 -55
  9. {tatc-3.2.1 → tatc-3.2.2/src/tatc.egg-info}/PKG-INFO +11 -10
  10. {tatc-3.2.1 → tatc-3.2.2}/src/tatc.egg-info/requires.txt +2 -0
  11. {tatc-3.2.1 → tatc-3.2.2}/LICENSE +0 -0
  12. {tatc-3.2.1 → tatc-3.2.2}/setup.cfg +0 -0
  13. {tatc-3.2.1 → tatc-3.2.2}/src/tatc/analysis/__init__.py +0 -0
  14. {tatc-3.2.1 → tatc-3.2.2}/src/tatc/analysis/dop.py +0 -0
  15. {tatc-3.2.1 → tatc-3.2.2}/src/tatc/analysis/ro_coverage.py +0 -0
  16. {tatc-3.2.1 → tatc-3.2.2}/src/tatc/constants.py +0 -0
  17. {tatc-3.2.1 → tatc-3.2.2}/src/tatc/generation/__init__.py +0 -0
  18. {tatc-3.2.1 → tatc-3.2.2}/src/tatc/generation/cells.py +0 -0
  19. {tatc-3.2.1 → tatc-3.2.2}/src/tatc/generation/points.py +0 -0
  20. {tatc-3.2.1 → tatc-3.2.2}/src/tatc/resources/de421.bsp +0 -0
  21. {tatc-3.2.1 → tatc-3.2.2}/src/tatc/schemas/__init__.py +0 -0
  22. {tatc-3.2.1 → tatc-3.2.2}/src/tatc/schemas/architecture.py +0 -0
  23. {tatc-3.2.1 → tatc-3.2.2}/src/tatc/schemas/instrument.py +0 -0
  24. {tatc-3.2.1 → tatc-3.2.2}/src/tatc/schemas/orbit.py +0 -0
  25. {tatc-3.2.1 → tatc-3.2.2}/src/tatc/schemas/point.py +0 -0
  26. {tatc-3.2.1 → tatc-3.2.2}/src/tatc/schemas/satellite.py +0 -0
  27. {tatc-3.2.1 → tatc-3.2.2}/src/tatc.egg-info/SOURCES.txt +0 -0
  28. {tatc-3.2.1 → tatc-3.2.2}/src/tatc.egg-info/dependency_links.txt +0 -0
  29. {tatc-3.2.1 → tatc-3.2.2}/src/tatc.egg-info/top_level.txt +0 -0
  30. {tatc-3.2.1 → tatc-3.2.2}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tatc
3
- Version: 3.2.1
3
+ Version: 3.2.2
4
4
  Summary: Tradespace Analysis Toolkit for Constellations (TAT-C)
5
5
  Author-email: "Paul T. Grogan" <paul.grogan@asu.edu>
6
6
  License: BSD License
@@ -11,7 +11,7 @@ Project-URL: Issues, https://github.com/code-lab-org/tatc/issues
11
11
  Classifier: Programming Language :: Python :: 3
12
12
  Classifier: Operating System :: OS Independent
13
13
  Classifier: Development Status :: 4 - Beta
14
- Requires-Python: <3.11,>=3.8
14
+ Requires-Python: <3.13,>=3.8
15
15
  Description-Content-Type: text/markdown
16
16
  License-File: LICENSE
17
17
  Requires-Dist: geopandas>=0.13.2
@@ -20,9 +20,11 @@ Requires-Dist: numba
20
20
  Requires-Dist: numpy
21
21
  Requires-Dist: pandas
22
22
  Requires-Dist: pydantic>=2.6
23
+ Requires-Dist: pyproj
23
24
  Requires-Dist: shapely>=2
24
25
  Requires-Dist: skyfield>=1.48
25
26
  Requires-Dist: sgp4
27
+ Requires-Dist: typing-extensions
26
28
  Provides-Extra: dev
27
29
  Requires-Dist: black[jupyter]>=24.2; extra == "dev"
28
30
  Requires-Dist: coverage; extra == "dev"
@@ -52,9 +54,9 @@ The Tradespace Analysis Toolkit for Constellations (TAT-C) provides low-level
52
54
  data structures and functions for systems engineering analysis and design of
53
55
  Earth-observing space missions suitable for pre-Phase A concept studies.
54
56
 
55
- Documentation: https://tatc.readthedocs.io
57
+ Documentation: [https://tatc.readthedocs.io](https://tatc.readthedocs.io)
56
58
 
57
- Repository: https://github.com/code-lab-org/tatc
59
+ Repository: [https://github.com/code-lab-org/tatc](https://github.com/code-lab-org/tatc)
58
60
 
59
61
  ## Installation
60
62
 
@@ -68,8 +70,6 @@ Note: the following optional dependencies are available with bracket notation:
68
70
  * `pip install -e ".[docs]"`: for generating documentation
69
71
  * `pip install -e ".[examples]"`: for running optional examples
70
72
  * `pip install -e ".[osse]"`: for running optional observing system simulation experiment (OSSE) examples
71
- * `pip install -e ".[app]"`: for running the [web application](https://github.com/code-lab-org/tatc-app)
72
- * `pip install -e ".[appdev]"`: for development (unit testing) of the web application
73
73
 
74
74
  Multiple optional dependencies can be installed with a comma-separated list (e.g., `pip install -e ".[dev,examples]"`)
75
75
 
@@ -115,10 +115,11 @@ Paul T. Grogan <paul.grogan@asu.edu>
115
115
 
116
116
  This project was supported in part by the National Aeronautics and Space
117
117
  Administration (NASA) Earth Science Division (ESD) Earth Science Technology
118
- Office (ESTO) Advanced Information Systems Technology (AIST) program under
119
- grant numbers: NNX17AE06G, 80NSSC17K0586, 80NSSC20K1118, 80NSSC21K1515,
120
- 80NSSC22K1705 and 80NSSC24K0575 and NASA Jet Propulsion Laboratory
121
- contracts: 1074657, 1689594, 1686623, 1705655.
118
+ Office (ESTO) Advanced Information Systems Technology (AIST) program.
119
+ Financial support is acknowledged under NASA grant numbers: NNX17AE06G,
120
+ 80NSSC17K0586, 80NSSC20K1118, 80NSSC21K1515, 80NSSC22K1705, 80NSSC24K0575,
121
+ 80NSSC24K0921; NASA Jet Propulsion Laboratory subcontracts: 1689594, 1686623,
122
+ 1704657, 1705655; Texas A \& M University subaward M2403907.
122
123
 
123
124
  Current Project Team
124
125
  * PI: Paul T. Grogan <paul.grogan@asu.edu>
@@ -4,9 +4,9 @@ The Tradespace Analysis Toolkit for Constellations (TAT-C) provides low-level
4
4
  data structures and functions for systems engineering analysis and design of
5
5
  Earth-observing space missions suitable for pre-Phase A concept studies.
6
6
 
7
- Documentation: https://tatc.readthedocs.io
7
+ Documentation: [https://tatc.readthedocs.io](https://tatc.readthedocs.io)
8
8
 
9
- Repository: https://github.com/code-lab-org/tatc
9
+ Repository: [https://github.com/code-lab-org/tatc](https://github.com/code-lab-org/tatc)
10
10
 
11
11
  ## Installation
12
12
 
@@ -20,8 +20,6 @@ Note: the following optional dependencies are available with bracket notation:
20
20
  * `pip install -e ".[docs]"`: for generating documentation
21
21
  * `pip install -e ".[examples]"`: for running optional examples
22
22
  * `pip install -e ".[osse]"`: for running optional observing system simulation experiment (OSSE) examples
23
- * `pip install -e ".[app]"`: for running the [web application](https://github.com/code-lab-org/tatc-app)
24
- * `pip install -e ".[appdev]"`: for development (unit testing) of the web application
25
23
 
26
24
  Multiple optional dependencies can be installed with a comma-separated list (e.g., `pip install -e ".[dev,examples]"`)
27
25
 
@@ -67,10 +65,11 @@ Paul T. Grogan <paul.grogan@asu.edu>
67
65
 
68
66
  This project was supported in part by the National Aeronautics and Space
69
67
  Administration (NASA) Earth Science Division (ESD) Earth Science Technology
70
- Office (ESTO) Advanced Information Systems Technology (AIST) program under
71
- grant numbers: NNX17AE06G, 80NSSC17K0586, 80NSSC20K1118, 80NSSC21K1515,
72
- 80NSSC22K1705 and 80NSSC24K0575 and NASA Jet Propulsion Laboratory
73
- contracts: 1074657, 1689594, 1686623, 1705655.
68
+ Office (ESTO) Advanced Information Systems Technology (AIST) program.
69
+ Financial support is acknowledged under NASA grant numbers: NNX17AE06G,
70
+ 80NSSC17K0586, 80NSSC20K1118, 80NSSC21K1515, 80NSSC22K1705, 80NSSC24K0575,
71
+ 80NSSC24K0921; NASA Jet Propulsion Laboratory subcontracts: 1689594, 1686623,
72
+ 1704657, 1705655; Texas A \& M University subaward M2403907.
74
73
 
75
74
  Current Project Team
76
75
  * PI: Paul T. Grogan <paul.grogan@asu.edu>
@@ -12,7 +12,7 @@ authors = [
12
12
  {name = "Paul T. Grogan", email = "paul.grogan@asu.edu"}
13
13
  ]
14
14
  readme = "README.md"
15
- requires-python = ">=3.8, <3.11"
15
+ requires-python = ">=3.8, <3.13"
16
16
  license = {text = "BSD License"}
17
17
  classifiers = [
18
18
  "Programming Language :: Python :: 3",
@@ -26,9 +26,11 @@ dependencies = [
26
26
  "numpy",
27
27
  "pandas",
28
28
  "pydantic >= 2.6",
29
+ "pyproj",
29
30
  "shapely >= 2",
30
31
  "skyfield >= 1.48",
31
- "sgp4"
32
+ "sgp4",
33
+ "typing-extensions",
32
34
  ]
33
35
  dynamic = ["version"]
34
36
 
@@ -9,4 +9,4 @@ from . import constants
9
9
  from . import utils
10
10
  from . import resources
11
11
 
12
- __version__ = "3.2.1"
12
+ __version__ = "3.2.2"
@@ -345,8 +345,8 @@ def collect_observations(
345
345
  gdf["sat_sunlit"] = _get_satellite_sunlit_series(gdf, sat)
346
346
  # append solar altitude/azimuth columns
347
347
  sun_altaz = _get_solar_altaz_series(gdf)
348
- gdf["sun_alt"] = sun_altaz.apply(lambda r: r[0].degrees)
349
- gdf["sun_az"] = sun_altaz.apply(lambda r: r[1].degrees)
348
+ gdf["solar_alt"] = sun_altaz.apply(lambda r: r[0].degrees)
349
+ gdf["solar_az"] = sun_altaz.apply(lambda r: r[1].degrees)
350
350
  # append local solar time column
351
351
  gdf["solar_time"] = _get_solar_time_series(gdf)
352
352
  else:
@@ -200,7 +200,7 @@ def compute_latencies(
200
200
 
201
201
  # set CRS if observations is a GeoDataFrame and has a defined CRS
202
202
  if isinstance(observations, gpd.GeoDataFrame) and observations.crs:
203
- obs.crs = observations.crs
203
+ obs.set_crs(observations.crs)
204
204
 
205
205
  # sort observations by observed time
206
206
  obs.sort_values(by="observed", inplace=True)
@@ -21,7 +21,7 @@ from shapely.geometry import (
21
21
  Point,
22
22
  LineString,
23
23
  )
24
- from shapely.ops import split, transform, unary_union
24
+ from shapely.ops import clip_by_rect, split, transform, unary_union
25
25
  import pyproj
26
26
 
27
27
  from ..schemas.satellite import Satellite
@@ -30,7 +30,7 @@ from ..utils import (
30
30
  split_polygon,
31
31
  field_of_regard_to_swath_width,
32
32
  )
33
- from ..constants import timescale
33
+ from ..constants import timescale, EARTH_MEAN_RADIUS
34
34
 
35
35
 
36
36
  def _get_empty_orbit_track() -> gpd.GeoDataFrame:
@@ -185,29 +185,33 @@ def collect_orbit_track(
185
185
  return gpd.clip(gdf, mask).reset_index(drop=True)
186
186
 
187
187
 
188
- def _get_utm_epsg_code(point: Point) -> str:
188
+ def _get_utm_epsg_code(point: Point, swath_width: float) -> str:
189
189
  """
190
- Get the Universal Transverse Mercator (UTM) EPSG code for a geodetic point.
190
+ Get the Universal Transverse Mercator (UTM) EPSG code for a ground track.
191
191
 
192
192
  Args:
193
- point (Point): the geodetic point
193
+ point (Point): the geodetic sub-satellite point
194
+ swath_width (float): the observation swath width (meters)
194
195
 
195
196
  Returns:
196
- str: the UTM EPSG code
197
+ str: the EPSG code
197
198
  """
199
+ # approximate footprint
200
+ polygon = point.buffer(np.degrees(swath_width / 2 / EARTH_MEAN_RADIUS))
198
201
  results = pyproj.database.query_utm_crs_info(
199
202
  datum_name="WGS 84",
200
- area_of_interest=pyproj.aoi.AreaOfInterest(point.x, point.y, point.x, point.y),
203
+ area_of_interest=pyproj.aoi.AreaOfInterest(
204
+ *clip_by_rect(polygon, -180, -90, 180, 90).bounds
205
+ ),
201
206
  )
202
- # return the first code if exists; otherwise return a default value
203
- # 5041 is UPS North; 5042 is UPS South; 4087 is the default
207
+ # return 5041 for UPS North; 5042 for UPS South; UTM zone, or 4087 for default
204
208
  return (
205
- "EPSG:" + results[0].code
206
- if len(results) > 0
209
+ "EPSG:5041"
210
+ if polygon.bounds[3] > 84
207
211
  else (
208
- "EPSG:5041"
209
- if point.y > 84
210
- else "EPSG:5042" if point.y < -80 else "EPSG:4087"
212
+ "EPSG:5042"
213
+ if polygon.bounds[1] < -80
214
+ else "EPSG:" + results[0].code if len(results) > 0 else "EPSG:4087"
211
215
  )
212
216
  )
213
217
 
@@ -248,7 +252,9 @@ def collect_ground_track(
248
252
  # at each point, draw a buffer equivalent to the swath radius
249
253
  if crs == "utm":
250
254
  # do the swath projection in the matching utm zone
251
- utm_crs = gdf.geometry.apply(_get_utm_epsg_code)
255
+ utm_crs = gdf.apply(
256
+ lambda r: _get_utm_epsg_code(r.geometry, r.swath_width), axis=1
257
+ )
252
258
  for code in utm_crs.unique():
253
259
  to_crs = pyproj.Transformer.from_crs(
254
260
  gdf.crs, pyproj.CRS(code), always_xy=True
@@ -257,24 +263,22 @@ def collect_ground_track(
257
263
  pyproj.CRS(code), gdf.crs, always_xy=True
258
264
  ).transform
259
265
  if code in ("EPSG:5041", "EPSG:5042"):
260
- # keep polygons 500km away from UPS poles and apply zero buffer
261
- # to mitigate invalid polygons near poles in EPSG:4087
266
+ # keep polygons away from UPS poles to encourage proper geometry
262
267
  gdf.loc[utm_crs == code, "geometry"] = gdf[utm_crs == code].apply(
263
268
  lambda r: transform(
264
269
  from_crs,
265
270
  transform(to_crs, r.geometry)
266
271
  .buffer(r.swath_width / 2)
267
- .difference(Point(2e6, 2e6, 0).buffer(5e5)),
268
- ).buffer(0),
272
+ .difference(Point(2e6, 2e6, 0).buffer(r.swath_width / 5)),
273
+ ),
269
274
  axis=1,
270
275
  )
271
276
  else:
272
- # apply zero buffer to mitigate invalid polygons in EPSG:4087
273
277
  gdf.loc[utm_crs == code, "geometry"] = gdf[utm_crs == code].apply(
274
278
  lambda r: transform(
275
279
  from_crs,
276
280
  transform(to_crs, r.geometry).buffer(r.swath_width / 2),
277
- ).buffer(0),
281
+ ),
278
282
  axis=1,
279
283
  )
280
284
  else:
@@ -317,9 +321,9 @@ def collect_ground_track(
317
321
  # split polygons to wrap over the anti-meridian and poles
318
322
  gdf.geometry = gdf.apply(lambda r: split_polygon(r.geometry), axis=1)
319
323
 
320
- if mask is None:
321
- return gdf
322
- return gpd.clip(gdf, mask).reset_index(drop=True)
324
+ if mask is not None:
325
+ gdf = gpd.clip(gdf, mask).reset_index(drop=True)
326
+ return gdf
323
327
 
324
328
 
325
329
  def compute_ground_track(
@@ -355,11 +359,14 @@ def compute_ground_track(
355
359
  GeoDataFrame: The data frame of aggregated ground track results.
356
360
  """
357
361
  if method == "point":
358
- track = collect_ground_track(satellite, instrument, times, elevation, mask, crs)
362
+ track = collect_ground_track(satellite, instrument, times, elevation, None, crs)
359
363
  # filter to valid observations and dissolve
360
- return track[track.valid_obs].dissolve()
364
+ track = track[track.valid_obs].dissolve()
365
+ if mask is not None:
366
+ track = gpd.clip(track, mask).reset_index(drop=True)
367
+ return track
361
368
  if method == "line":
362
- track = collect_orbit_track(satellite, instrument, times, elevation, mask)
369
+ track = collect_orbit_track(satellite, instrument, times, elevation, None)
363
370
  # assign track identifiers to group contiguous observation periods
364
371
  track["track_id"] = (
365
372
  (track.valid_obs != track.valid_obs.shift()).astype("int").cumsum()
@@ -442,5 +449,7 @@ def compute_ground_track(
442
449
  track = track.dissolve()
443
450
  # and replace the geometry with the union of computed polygons
444
451
  track.geometry = [unary_union(polygons)]
452
+ if mask is not None:
453
+ track = gpd.clip(track, mask).reset_index(drop=True)
445
454
  return track
446
455
  raise ValueError("Invalid method: " + str(method))
@@ -306,6 +306,8 @@ def _wrap_polygon_over_north_pole(
306
306
  Wraps polygon coordinates over the North pole. Due to buffering and projection,
307
307
  sometimes latitudes exceed 90 degrees. This method wraps them to the correct
308
308
  latitude between -90 and 90 degrees and adjusts the longitude by 180 degrees.
309
+ This method requires a polygon above 90 degrees latitude to be only on one
310
+ side of the prime meridian.
309
311
 
310
312
  Note: this method only changes coordinates: it does not create a MultiPolygon.
311
313
 
@@ -316,14 +318,15 @@ def _wrap_polygon_over_north_pole(
316
318
  Polygon, or MultiPolygon: The wrapped polygon.
317
319
  """
318
320
  if isinstance(polygon, Polygon):
319
- if np.all([c[1] <= 90 for c in polygon.exterior.coords]):
321
+ if all(c[1] <= 90 for c in polygon.exterior.coords):
320
322
  # no wrapping necessary
321
323
  return polygon
322
324
  # map latitudes from [90, 180) to [90, -90), adjusting longitude by 180 degrees
323
- polygon = Polygon(
325
+ lat_shift = 180 if all(c[0] <= 0 for c in polygon.exterior.coords) else -180
326
+ pgon = Polygon(
324
327
  [
325
328
  [
326
- (c[0] + 180 if c[0] <= 0 else c[0] - 180) if c[1] >= 90 else c[0],
329
+ c[0] + lat_shift if c[1] >= 90 else c[0],
327
330
  180 - c[1] if c[1] >= 90 else c[1],
328
331
  ]
329
332
  for c in polygon.exterior.coords
@@ -331,11 +334,7 @@ def _wrap_polygon_over_north_pole(
331
334
  [
332
335
  [
333
336
  [
334
- (
335
- (c[0] + 180 if c[0] <= 0 else c[0] - 180)
336
- if c[1] >= 90
337
- else c[0]
338
- ),
337
+ c[0] + lat_shift if c[1] >= 90 else c[0],
339
338
  180 - c[1] if c[1] >= 90 else c[1],
340
339
  ]
341
340
  for c in i.coords
@@ -343,10 +342,10 @@ def _wrap_polygon_over_north_pole(
343
342
  for i in polygon.interiors
344
343
  ],
345
344
  )
346
- # attempt to fix invalid polygon using a zero buffer
347
- if not polygon.is_valid:
348
- polygon = polygon.buffer(0)
349
- return polygon
345
+ # give up and return original polygon if invalid
346
+ if not pgon.is_valid:
347
+ return polygon
348
+ return pgon
350
349
  if isinstance(polygon, MultiPolygon):
351
350
  # recursive call for each polygon
352
351
  polygons = [_wrap_polygon_over_north_pole(p) for p in polygon.geoms]
@@ -373,11 +372,18 @@ def _split_polygon_north_pole(
373
372
  Polygon, or MultiPolygon: The split polygon.
374
373
  """
375
374
  if isinstance(polygon, Polygon):
376
- lat = np.array([c[1] for c in polygon.exterior.coords])
377
- if np.all(lat <= 90):
375
+ if all(c[1] <= 90 for c in polygon.exterior.coords):
376
+ # no splitting necessary
378
377
  return polygon
379
378
  # split polygon along north pole
380
379
  parts = split(polygon, LineString([(-360, 90), (360, 90)]))
380
+ # check and split part over prime meridian if necessary
381
+ for part in parts.geoms:
382
+ if part.crosses(LineString([(0, 90), (0, 180)])):
383
+ parts = GeometryCollection(
384
+ [g for g in parts.geoms if g != part]
385
+ + [g for g in split(part, LineString([(0, 90), (0, 180)])).geoms]
386
+ )
381
387
  # convert to a multi polygon
382
388
  if isinstance(parts, GeometryCollection):
383
389
  parts = _convert_collection_to_polygon(parts)
@@ -385,11 +391,11 @@ def _split_polygon_north_pole(
385
391
  return _wrap_polygon_over_north_pole(parts)
386
392
  if isinstance(polygon, MultiPolygon):
387
393
  # recursive call for each polygon
388
- polygons = [_split_polygon_north_pole(p) for p in polygon.geoms]
394
+ pgons = [_split_polygon_north_pole(p) for p in polygon.geoms]
389
395
  return MultiPolygon(
390
396
  [
391
397
  g
392
- for p in polygons
398
+ for p in pgons
393
399
  for g in (p.geoms if isinstance(p, MultiPolygon) else [p])
394
400
  ]
395
401
  )
@@ -403,6 +409,8 @@ def _wrap_polygon_over_south_pole(
403
409
  Wraps polygon coordinates over the South pole. Due to buffering and projection,
404
410
  sometimes latitudes exceed -90 degrees. This method wraps them to the correct
405
411
  latitude between -90 and 90 degrees and adjusts the longitude by 180 degrees.
412
+ This method requires a polygon above 90 degrees latitude to be only on one
413
+ side of the prime meridian.
406
414
 
407
415
  Note: this method only changes coordinates: it does not create a MultiPolygon.
408
416
 
@@ -413,14 +421,15 @@ def _wrap_polygon_over_south_pole(
413
421
  Polygon, or MultiPolygon: The wrapped polygon.
414
422
  """
415
423
  if isinstance(polygon, Polygon):
416
- if np.all([c[1] >= -90 for c in polygon.exterior.coords]):
417
- # no wrapping necessary
424
+ if all(c[1] >= -90 for c in polygon.exterior.coords):
425
+ # no splitting necessary
418
426
  return polygon
419
427
  # map latitudes from [-90, -180) to [-90, 90), adjusting longitude by 180 degrees
420
- polygon = Polygon(
428
+ lat_shift = 180 if all(c[0] <= 0 for c in polygon.exterior.coords) else -180
429
+ pgon = Polygon(
421
430
  [
422
431
  [
423
- (c[0] + 180 if c[0] <= 0 else c[0] - 180) if c[1] <= -90 else c[0],
432
+ c[0] + lat_shift if c[1] <= -90 else c[0],
424
433
  -180 - c[1] if c[1] <= -90 else c[1],
425
434
  ]
426
435
  for c in polygon.exterior.coords
@@ -428,11 +437,7 @@ def _wrap_polygon_over_south_pole(
428
437
  [
429
438
  [
430
439
  [
431
- (
432
- (c[0] + 180 if c[0] <= 0 else c[0] - 180)
433
- if c[1] <= -90
434
- else c[0]
435
- ),
440
+ (c[0] + lat_shift if c[1] <= -90 else c[0],),
436
441
  -180 - c[1] if c[1] <= -90 else c[1],
437
442
  ]
438
443
  for c in i.coords
@@ -440,10 +445,10 @@ def _wrap_polygon_over_south_pole(
440
445
  for i in polygon.interiors
441
446
  ],
442
447
  )
443
- # attempt to fix invalid polygon using a zero buffer
444
- if not polygon.is_valid:
445
- polygon = polygon.buffer(0)
446
- return polygon
448
+ # give up and return original polygon if invalid
449
+ if not pgon.is_valid:
450
+ return polygon
451
+ return pgon
447
452
  if isinstance(polygon, MultiPolygon):
448
453
  # recursive call for each polygon
449
454
  polygons = [_wrap_polygon_over_south_pole(p) for p in polygon.geoms]
@@ -475,6 +480,13 @@ def _split_polygon_south_pole(
475
480
  return polygon
476
481
  # split polygon along south pole
477
482
  parts = split(polygon, LineString([(-360, -90), (360, -90)]))
483
+ # check and split part over prime meridian if necessary
484
+ for part in parts.geoms:
485
+ if part.crosses(LineString([(0, -90), (0, -180)])):
486
+ parts = GeometryCollection(
487
+ [g for g in parts.geoms if g != part]
488
+ + [g for g in split(part, LineString([(0, -90), (0, -180)])).geoms]
489
+ )
478
490
  # convert to a multi polygon
479
491
  if isinstance(parts, GeometryCollection):
480
492
  parts = _convert_collection_to_polygon(parts)
@@ -482,11 +494,11 @@ def _split_polygon_south_pole(
482
494
  return _wrap_polygon_over_south_pole(parts)
483
495
  if isinstance(polygon, MultiPolygon):
484
496
  # recursive call for each polygon
485
- polygons = [_split_polygon_south_pole(p) for p in polygon.geoms]
497
+ pgons = [_split_polygon_south_pole(p) for p in polygon.geoms]
486
498
  return MultiPolygon(
487
499
  [
488
500
  g
489
- for p in polygons
501
+ for p in pgons
490
502
  for g in (p.geoms if isinstance(p, MultiPolygon) else [p])
491
503
  ]
492
504
  )
@@ -510,32 +522,32 @@ def _wrap_polygon_over_antimeridian(
510
522
  Polygon, or MultiPolygon: The wrapped polygon.
511
523
  """
512
524
  if isinstance(polygon, Polygon):
513
- if np.all([c[0] >= -180 and c[0] <= 180 for c in polygon.exterior.coords]):
525
+ if all(c[0] >= -180 and c[0] <= 180 for c in polygon.exterior.coords):
514
526
  # no wrapping necessary
515
527
  return polygon
516
- if np.all([c[0] <= -180 for c in polygon.exterior.coords]):
528
+ if all(c[0] <= -180 for c in polygon.exterior.coords):
517
529
  # map longitudes from (-540, -180] to (-180, 180]
518
- polygon = Polygon(
530
+ pgon = Polygon(
519
531
  [[c[0] + 360, c[1]] for c in polygon.exterior.coords],
520
532
  [[[c[0] + 360, c[1]] for c in i.coords] for i in polygon.interiors],
521
533
  )
522
- if np.all([c[0] >= 180 for c in polygon.exterior.coords]):
534
+ if all(c[0] >= 180 for c in polygon.exterior.coords):
523
535
  # map longitudes from [180, 540) to [-180, 180)
524
- polygon = Polygon(
536
+ pgon = Polygon(
525
537
  [[c[0] - 360, c[1]] for c in polygon.exterior.coords],
526
538
  [[[c[0] - 360, c[1]] for c in i.coords] for i in polygon.interiors],
527
539
  )
528
- # attempt to fix invalid polygon using a zero buffer
529
- if not polygon.is_valid:
530
- polygon = polygon.buffer(0)
531
- return polygon
540
+ # give up and return original polygon if invalid
541
+ if not pgon.is_valid:
542
+ return polygon
543
+ return pgon
532
544
  if isinstance(polygon, MultiPolygon):
533
545
  # recursive call for each polygon
534
- polygons = [_wrap_polygon_over_antimeridian(p) for p in polygon.geoms]
546
+ pgons = [_wrap_polygon_over_antimeridian(p) for p in polygon.geoms]
535
547
  return MultiPolygon(
536
548
  [
537
549
  g
538
- for p in polygons
550
+ for p in pgons
539
551
  for g in (p.geoms if isinstance(p, MultiPolygon) else [p])
540
552
  ]
541
553
  )
@@ -583,13 +595,13 @@ def _split_polygon_antimeridian(
583
595
  lon = np.array([c[0] for c in polygon.exterior.coords])
584
596
  # check if any longitudes cross the anti-meridian
585
597
  # (adjacent coordinate longitude differs by more than 180 degrees)
586
- if np.all(np.abs(np.diff(lon)) < 180):
598
+ if all(np.abs(np.diff(lon)) < 180):
587
599
  return polygon
588
600
  # find anti-meridian crossings and calculate shift direction
589
601
  # coords from W -> E (shift < 0) will add 360 degrees to E component
590
602
  # coords from E -> W (shift > 0) will subtract 360 degrees from W component
591
603
  shift = np.insert(np.cumsum(np.around(np.diff(lon) / 360)), 0, 0)
592
- polygon = Polygon(
604
+ pgon = Polygon(
593
605
  [
594
606
  (c[0] - 360 * shift[i], c[1])
595
607
  for i, c in enumerate(polygon.exterior.coords)
@@ -606,12 +618,9 @@ def _split_polygon_antimeridian(
606
618
  for i in polygon.interiors
607
619
  ],
608
620
  )
609
- # attempt to fix invalid polygon using a zero buffer
610
- if not polygon.is_valid:
611
- polygon = polygon.buffer(0)
612
621
  # split along the anti-meridian (-180 for shift > 0; 180 for shift < 0)
613
622
  shift_dir = -180 if shift.max() >= 1 else 180
614
- parts = split(polygon, LineString([(shift_dir, -180), (shift_dir, 180)]))
623
+ parts = split(pgon, LineString([(shift_dir, -180), (shift_dir, 180)]))
615
624
  # convert to multi polygon
616
625
  if isinstance(parts, GeometryCollection):
617
626
  parts = _convert_collection_to_polygon(parts)
@@ -619,11 +628,11 @@ def _split_polygon_antimeridian(
619
628
  return _wrap_polygon_over_antimeridian(parts)
620
629
  if isinstance(polygon, MultiPolygon):
621
630
  # recursive call for each polygon
622
- polygons = [_split_polygon_antimeridian(p) for p in polygon.geoms]
631
+ pgons = [_split_polygon_antimeridian(p) for p in polygon.geoms]
623
632
  return MultiPolygon(
624
633
  [
625
634
  g
626
- for p in polygons
635
+ for p in pgons
627
636
  for g in (p.geoms if isinstance(p, MultiPolygon) else [p])
628
637
  ]
629
638
  )
@@ -645,13 +654,9 @@ def split_polygon(
645
654
  Returns:
646
655
  Polygon, or MultiPolygon: The split polygon.
647
656
  """
648
- polygon = _split_polygon_north_pole(
657
+ return _split_polygon_north_pole(
649
658
  _split_polygon_south_pole(_split_polygon_antimeridian(polygon))
650
659
  )
651
- # attempt to fix invalid polygon using a zero buffer
652
- if not polygon.is_valid:
653
- polygon = polygon.buffer(0)
654
- return polygon
655
660
 
656
661
 
657
662
  def normalize_geometry(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tatc
3
- Version: 3.2.1
3
+ Version: 3.2.2
4
4
  Summary: Tradespace Analysis Toolkit for Constellations (TAT-C)
5
5
  Author-email: "Paul T. Grogan" <paul.grogan@asu.edu>
6
6
  License: BSD License
@@ -11,7 +11,7 @@ Project-URL: Issues, https://github.com/code-lab-org/tatc/issues
11
11
  Classifier: Programming Language :: Python :: 3
12
12
  Classifier: Operating System :: OS Independent
13
13
  Classifier: Development Status :: 4 - Beta
14
- Requires-Python: <3.11,>=3.8
14
+ Requires-Python: <3.13,>=3.8
15
15
  Description-Content-Type: text/markdown
16
16
  License-File: LICENSE
17
17
  Requires-Dist: geopandas>=0.13.2
@@ -20,9 +20,11 @@ Requires-Dist: numba
20
20
  Requires-Dist: numpy
21
21
  Requires-Dist: pandas
22
22
  Requires-Dist: pydantic>=2.6
23
+ Requires-Dist: pyproj
23
24
  Requires-Dist: shapely>=2
24
25
  Requires-Dist: skyfield>=1.48
25
26
  Requires-Dist: sgp4
27
+ Requires-Dist: typing-extensions
26
28
  Provides-Extra: dev
27
29
  Requires-Dist: black[jupyter]>=24.2; extra == "dev"
28
30
  Requires-Dist: coverage; extra == "dev"
@@ -52,9 +54,9 @@ The Tradespace Analysis Toolkit for Constellations (TAT-C) provides low-level
52
54
  data structures and functions for systems engineering analysis and design of
53
55
  Earth-observing space missions suitable for pre-Phase A concept studies.
54
56
 
55
- Documentation: https://tatc.readthedocs.io
57
+ Documentation: [https://tatc.readthedocs.io](https://tatc.readthedocs.io)
56
58
 
57
- Repository: https://github.com/code-lab-org/tatc
59
+ Repository: [https://github.com/code-lab-org/tatc](https://github.com/code-lab-org/tatc)
58
60
 
59
61
  ## Installation
60
62
 
@@ -68,8 +70,6 @@ Note: the following optional dependencies are available with bracket notation:
68
70
  * `pip install -e ".[docs]"`: for generating documentation
69
71
  * `pip install -e ".[examples]"`: for running optional examples
70
72
  * `pip install -e ".[osse]"`: for running optional observing system simulation experiment (OSSE) examples
71
- * `pip install -e ".[app]"`: for running the [web application](https://github.com/code-lab-org/tatc-app)
72
- * `pip install -e ".[appdev]"`: for development (unit testing) of the web application
73
73
 
74
74
  Multiple optional dependencies can be installed with a comma-separated list (e.g., `pip install -e ".[dev,examples]"`)
75
75
 
@@ -115,10 +115,11 @@ Paul T. Grogan <paul.grogan@asu.edu>
115
115
 
116
116
  This project was supported in part by the National Aeronautics and Space
117
117
  Administration (NASA) Earth Science Division (ESD) Earth Science Technology
118
- Office (ESTO) Advanced Information Systems Technology (AIST) program under
119
- grant numbers: NNX17AE06G, 80NSSC17K0586, 80NSSC20K1118, 80NSSC21K1515,
120
- 80NSSC22K1705 and 80NSSC24K0575 and NASA Jet Propulsion Laboratory
121
- contracts: 1074657, 1689594, 1686623, 1705655.
118
+ Office (ESTO) Advanced Information Systems Technology (AIST) program.
119
+ Financial support is acknowledged under NASA grant numbers: NNX17AE06G,
120
+ 80NSSC17K0586, 80NSSC20K1118, 80NSSC21K1515, 80NSSC22K1705, 80NSSC24K0575,
121
+ 80NSSC24K0921; NASA Jet Propulsion Laboratory subcontracts: 1689594, 1686623,
122
+ 1704657, 1705655; Texas A \& M University subaward M2403907.
122
123
 
123
124
  Current Project Team
124
125
  * PI: Paul T. Grogan <paul.grogan@asu.edu>
@@ -4,9 +4,11 @@ numba
4
4
  numpy
5
5
  pandas
6
6
  pydantic>=2.6
7
+ pyproj
7
8
  shapely>=2
8
9
  skyfield>=1.48
9
10
  sgp4
11
+ typing-extensions
10
12
 
11
13
  [dev]
12
14
  black[jupyter]>=24.2
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes