4
4
"""
5
5
6
6
import enum
7
+ from datetime import datetime as Datetime
7
8
from typing import Dict , Any , Generic , Iterable , Optional , Set , TypeVar , cast
8
9
9
10
import pystac
12
13
PropertiesExtension ,
13
14
)
14
15
from pystac .extensions .hooks import ExtensionHooks
15
- from pystac .utils import map_opt
16
+ from pystac .utils import str_to_datetime , datetime_to_str , map_opt
16
17
17
18
T = TypeVar ("T" , pystac .Item , pystac .Asset )
18
19
19
20
SCHEMA_URI = "https://stac-extensions.github.io/sat/v1.0.0/schema.json"
20
21
21
22
PREFIX : str = "sat:"
22
- ORBIT_STATE : str = PREFIX + "orbit_state"
23
- RELATIVE_ORBIT : str = PREFIX + "relative_orbit"
23
+ PLATFORM_INTERNATIONAL_DESIGNATOR_PROP : str = (
24
+ PREFIX + "platform_international_designator"
25
+ )
26
+ ABSOLUTE_ORBIT_PROP : str = PREFIX + "absolute_orbit"
27
+ ORBIT_STATE_PROP : str = PREFIX + "orbit_state"
28
+ RELATIVE_ORBIT_PROP : str = PREFIX + "relative_orbit"
29
+ ANX_DATETIME_PROP : str = PREFIX + "anx_datetime"
24
30
25
31
26
32
class OrbitState (str , enum .Enum ):
@@ -51,6 +57,9 @@ def apply(
51
57
self ,
52
58
orbit_state : Optional [OrbitState ] = None ,
53
59
relative_orbit : Optional [int ] = None ,
60
+ absolute_orbit : Optional [int ] = None ,
61
+ platform_international_designator : Optional [str ] = None ,
62
+ anx_datetime : Optional [Datetime ] = None ,
54
63
) -> None :
55
64
"""Applies ext extension properties to the extended :class:`~pystac.Item` or
56
65
class:`~pystac.Asset`.
@@ -66,26 +75,58 @@ def apply(
66
75
the time of acquisition.
67
76
"""
68
77
78
+ self .platform_international_designator = platform_international_designator
69
79
self .orbit_state = orbit_state
80
+ self .absolute_orbit = absolute_orbit
70
81
self .relative_orbit = relative_orbit
82
+ self .anx_datetime = anx_datetime
83
+
84
+ @property
85
+ def platform_international_designator (self ) -> Optional [str ]:
86
+ """Gets or sets the International Designator, also known as COSPAR ID, and
87
+ NSSDCA ID."""
88
+ return self ._get_property (PLATFORM_INTERNATIONAL_DESIGNATOR_PROP , str )
89
+
90
+ @platform_international_designator .setter
91
+ def platform_international_designator (self , v : Optional [str ]) -> None :
92
+ self ._set_property (PLATFORM_INTERNATIONAL_DESIGNATOR_PROP , v )
71
93
72
94
@property
73
95
def orbit_state (self ) -> Optional [OrbitState ]:
74
96
"""Get or sets an orbit state of the object."""
75
- return map_opt (lambda x : OrbitState (x ), self ._get_property (ORBIT_STATE , str ))
97
+ return map_opt (
98
+ lambda x : OrbitState (x ), self ._get_property (ORBIT_STATE_PROP , str )
99
+ )
76
100
77
101
@orbit_state .setter
78
102
def orbit_state (self , v : Optional [OrbitState ]) -> None :
79
- self ._set_property (ORBIT_STATE , map_opt (lambda x : x .value , v ))
103
+ self ._set_property (ORBIT_STATE_PROP , map_opt (lambda x : x .value , v ))
104
+
105
+ @property
106
+ def absolute_orbit (self ) -> Optional [int ]:
107
+ """Get or sets a absolute orbit number of the item."""
108
+ return self ._get_property (ABSOLUTE_ORBIT_PROP , int )
109
+
110
+ @absolute_orbit .setter
111
+ def absolute_orbit (self , v : Optional [int ]) -> None :
112
+ self ._set_property (ABSOLUTE_ORBIT_PROP , v )
80
113
81
114
@property
82
115
def relative_orbit (self ) -> Optional [int ]:
83
116
"""Get or sets a relative orbit number of the item."""
84
- return self ._get_property (RELATIVE_ORBIT , int )
117
+ return self ._get_property (RELATIVE_ORBIT_PROP , int )
85
118
86
119
@relative_orbit .setter
87
120
def relative_orbit (self , v : Optional [int ]) -> None :
88
- self ._set_property (RELATIVE_ORBIT , v )
121
+ self ._set_property (RELATIVE_ORBIT_PROP , v )
122
+
123
+ @property
124
+ def anx_datetime (self ) -> Optional [Datetime ]:
125
+ return map_opt (str_to_datetime , self ._get_property (ANX_DATETIME_PROP , str ))
126
+
127
+ @anx_datetime .setter
128
+ def anx_datetime (self , v : Optional [Datetime ]) -> None :
129
+ self ._set_property (ANX_DATETIME_PROP , map_opt (datetime_to_str , v ))
89
130
90
131
@classmethod
91
132
def get_schema_uri (cls ) -> str :
0 commit comments