Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/damast/domains/maritime/ais/data_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def generate_trajectory(min_size: int, max_size: int) -> List[List[Any]]:
last_day = datetime.datetime(year=2022, month=12, day=31)
start_time = randint(0, int(last_day.timestamp()))

sog_start = random() * SpeedOverGround.min_value / SpeedOverGround.max_value
sog_start = 0.0 # due to SpeedOverGround.min_value = 0 (?)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed setting to 0 is reflecting the current state, but it should actually be a random sample within the valid SOG range, so I suggest the following:

Suggested change
sog_start = 0.0 # due to SpeedOverGround.min_value = 0 (?)
sog_start = random.uniform(0,0.5)*SpeedOverGround.max_value

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

7011f1b

cog_start = random() * CourseOverGround.min_value / CourseOverGround.max_value
heading_start = cog_start

Expand Down Expand Up @@ -208,4 +208,4 @@ def generate_anchorage_type_data(self) -> DataFrame:

ais_test_data = AISTestData(number_of_trajectories=args.number_of_trajectories)
ais_test_data.dataframe.export_hdf5(args.output)
_log.info("Written: {args.output}")
_log.info(f"Written: {args.output}")
4 changes: 2 additions & 2 deletions src/damast/domains/maritime/ais/vessel_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def get_types(cls) -> List[VesselType]:
return klasses

@classmethod
def get_types_as_str(cls) -> List[VesselType]:
def get_types_as_str(cls) -> List[str]:
return [x.typename() for x in cls.get_types()]

@staticmethod
Expand Down Expand Up @@ -80,7 +80,7 @@ def by_id(cls, *,

@classmethod
def to_id(cls, *,
klass: Union[str, VesselType] = None) -> int:
klass: Optional[Union[str, VesselType]] = None) -> int:
"""
Get the id for a klass name or class type of VesselType.

Expand Down
4 changes: 2 additions & 2 deletions src/damast/domains/maritime/math/spatial.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def bearing(lat_1: npt.NDArray[np.float64],
def reverse_bearing(lat_1: npt.NDArray[np.float64],
lon_1: npt.NDArray[np.float64],
distance: npt.NDArray[np.float64],
bearing: npt.NDArray[np.float64]) -> npt.NDArray[np.float64]:
bearing: npt.NDArray[np.float64]) -> Tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]]:
"""
Compute the position of an object, given its initial position, the initial bearing, and the distance
it will travel.
Expand All @@ -79,7 +79,7 @@ def reverse_bearing(lat_1: npt.NDArray[np.float64],


@njit
def decdeg2dms(dd: npt.NDArray[np.float64]) -> npt.NDArray[np.float64]:
def decdeg2dms(dd: npt.NDArray[np.float64]) -> Tuple[npt.NDArray[np.float64], npt.NDArray[np.float64], npt.NDArray[np.float64]]:
"""
Convert decimal degrees (dd) to sexagesimal degrees (degrees, minutes, seconds)

Expand Down
6 changes: 3 additions & 3 deletions src/damast/domains/maritime/math/statistical.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
]


def N_sigma_limited(x: npt.NDArray[np.float64],
def N_sigma_limited(x: pd.Series,
N: int,
p: float = 0.99) -> npt.NDArray[np.float64]:
p: float = 0.99) -> np.float64:
""" Compute and return the N_sigma given a list without considering the
:math:`100\\cdot(1-p)\\%` highest values

Expand All @@ -26,7 +26,7 @@ def N_sigma_limited(x: npt.NDArray[np.float64],
return x.loc[x < limit].median() + N * x.loc[x < limit].std()


def N_sigma(x: npt.NDArray[np.float64], N: int) -> npt.NDArray[np.float64]:
def N_sigma(x: pd.Series, N: int) -> np.float64:
""" Compute and return the N_sigma given a list
:param x: The input array

Expand Down