Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove timestamps in sample merging #270

Merged
merged 3 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 0 additions & 10 deletions eogrow/pipelines/merge_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class Schema(Pipeline.Schema):
features_to_merge: List[Feature] = Field(
description="Dictionary of all features for which samples are to be merged."
)
include_timestamp: bool = Field(False, description="Whether to also prepare an array of merged timestamps.")
id_filename: Optional[str] = Field(
description=(
"Filename of array holding patch ID of concatenated features. The patch ID is the index of the patch in"
Expand Down Expand Up @@ -73,7 +72,6 @@ def build_workflow(self) -> EOWorkflow:
self.storage.get_folder(self.config.input_folder_key),
filesystem=self.storage.filesystem,
features=self.config.features_to_merge,
load_timestamps=True if self.config.include_timestamp else "auto",
)
output_task = OutputTask(name=self._OUTPUT_NAME)
return EOWorkflow(linearly_connect_tasks(load_task, output_task))
Expand All @@ -99,14 +97,6 @@ def merge_and_save_features(self, patches: list[EOPatch]) -> None:
if patch_sample_nums is None:
raise ValueError("Need at least one feature to merge.")

if self.config.include_timestamp:
arrays = []
for patch, sample_num in zip(patches, patch_sample_nums):
arrays.append(np.tile(np.array(patch.get_timestamps()), (sample_num, 1)))
patch.timestamps = []

self._save_array(np.concatenate(arrays, axis=0), "TIMESTAMPS")

if self.config.id_filename:
LOGGER.info("Started merging EOPatch ids")
patch_id_arrays = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"input_folder_key": "features_sampled",
"output_folder_key": "training_data",
"features_to_merge": [["data", "FEATURES"]],
"include_timestamp": true,
"id_filename": "PATCH_IDS",
"suffix": "",
"workers": 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"input_folder_key": "data_sampled",
"output_folder_key": "training_data",
"features_to_merge": [["mask_timeless", "LULC_ID"]],
"include_timestamp": true,
"id_filename": "PATCH_IDS",
"suffix": "",
"workers": 2
Expand Down
7 changes: 0 additions & 7 deletions tests/test_stats/merge_samples/merge_features_samples.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,5 @@
"value": 1
}
]
},
"TIMESTAMPS.npy": {
"array_shape": [
1400,
12
],
"dtype": "object"
}
}
7 changes: 0 additions & 7 deletions tests/test_stats/merge_samples/merge_reference_samples.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,5 @@
"value": 1
}
]
},
"TIMESTAMPS.npy": {
"array_shape": [
1400,
35
],
"dtype": "object"
}
}