Skip to content

Commit

Permalink
Merge pull request #559 from 3dgeo-heidelberg/gps_time_for_survey
Browse files Browse the repository at this point in the history
GPS time property for survey
  • Loading branch information
dokempf authored Feb 12, 2025
2 parents d861ae4 + 5255a69 commit b06a615
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
8 changes: 3 additions & 5 deletions python/helios/survey.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class Survey(Model, cpp_class=_helios.Survey):
scene: StaticScene = Property(cpp="scene", wraptype=StaticScene)
legs: list[Leg] = Property(cpp="legs", wraptype=Leg, iterable=True, default=[])
name: str = Property(cpp="name", default="")
gps_time: datetime = Property(default=datetime.now(timezone.utc))

@validate_call
def run(
Expand All @@ -49,7 +50,7 @@ def run(
# Ensure that the scene has been finalized
self.scene.finalize(execution_settings)

if output is None:
if output_settings.format == OutputFormat.NPY:
# TODO: Implement approach where we don't need to write to disk
las_output, zip_output = False, False
temp_dir_obj = tempfile.TemporaryDirectory()
Expand Down Expand Up @@ -78,9 +79,6 @@ def run(
str(output), 1.0, las_output, False, zip_output, False, self._cpp_object
)

# Use the current time as GPS time (will be argument later)
current_time = datetime.now(timezone.utc).isoformat(timespec="seconds")

# Set up internal data structures for the execution

accuracy = self.scanner._cpp_object.detector.accuracy
Expand All @@ -98,7 +96,7 @@ def run(
execution_settings.parallelization,
pulse_thread_pool,
execution_settings.chunk_size,
current_time,
str(self.gps_time),
True,
True,
)
Expand Down
9 changes: 9 additions & 0 deletions tests/python/test_survey.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,12 @@ def test_add_leg_parameters():

with pytest.raises(ValueError):
survey.add_leg(foobar=12)


def test_set_gpstime():
survey = Survey.from_xml("data/surveys/toyblocks/als_toyblocks.xml")

survey.gps_time = datetime.now(timezone.utc)
survey.gps_time = "2021-01-01T00:00:00Z"
with pytest.raises(ValueError):
survey.gps_time = "foobar"

0 comments on commit b06a615

Please sign in to comment.