Skip to content
Snippets Groups Projects

Draft: Develop

Open Raphael Sturgis requested to merge develop into main
2 files
+ 49
30
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -62,7 +62,7 @@ def apply_time_sequence(dat, time, func):
def __get_image_value__(features, bounds):
value = []
for f, b in zip(features, bounds):
value.append(1 - (b[1] - f) / b[1])
value.append(1 - (b[1] - f - b[0]) / (b[1] - b[0]))
return value
@@ -236,12 +236,11 @@ class AISTrajectory(AISPoints):
node_size=0):
nb_channels = 1
positions = self.df[['longitude', 'latitude']].to_numpy()
if bounding_box == 'fit':
positions = self.df[['longitude', 'latitude']].to_numpy()
lower_lon, upper_lon = (min(positions[:, 0]), max(positions[:, 0]))
lower_lat, upper_lat = (min(positions[:, 1]), max(positions[:, 1]))
elif bounding_box == 'centered':
positions = self.df[['longitude', 'latitude']].to_numpy()
center_lon, center_lat = positions[-1]
min_lon, max_lon = (min(positions[:, 0]), max(positions[:, 0]))
min_lat, max_lat = (min(positions[:, 1]), max(positions[:, 1]))
@@ -253,7 +252,11 @@ class AISTrajectory(AISPoints):
lower_lat = center_lat - distance_to_center
upper_lon = center_lon + distance_to_center
lower_lon = center_lon - distance_to_center
elif type(bounding_box) is list:
upper_lon = bounding_box[1][0]
lower_lon = bounding_box[0][0]
upper_lat = bounding_box[1][1]
lower_lat = bounding_box[0][1]
else:
raise ValueError(f"Option not supported: {bounding_box}")
@@ -291,17 +294,23 @@ class AISTrajectory(AISPoints):
data[x, y] = [1]
else:
bounds = []
if type(features) is list:
nb_channels = len(features)
features_vectors = self.df[features].to_numpy()
for c in features_vectors.T:
bounds.append((0, max(c)))
elif type(features) is str:
features = [features]
features_vectors = self.df[[features]].to_numpy()
for c in features_vectors.T:
bounds.append((0, max(c)))
elif type(features) is dict:
bounds = list(features.values())
features_vectors = self.df[features.keys()].to_numpy()
else:
raise TypeError("Type not supported")
data = np.zeros((height, width, nb_channels), dtype=np.float)
features_vectors = self.df[features].to_numpy()
bounds = []
for c in features_vectors.T:
bounds.append((min(c), max(c)))
for pos, f in zip(positions, features_vectors):
latitude = pos[1]
Loading