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

fix: issue 155 #158

Merged
merged 3 commits into from
Dec 9, 2024
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
15 changes: 15 additions & 0 deletions map2loop/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,21 @@ def set_sampler(self, datatype: Datatype, sampler: Sampler):
sampler (Sampler):
The sampler to use
"""
allowed_samplers = {
Datatype.STRUCTURE: SamplerDecimator,
Datatype.GEOLOGY: SamplerSpacing,
Datatype.FAULT: SamplerSpacing,
Datatype.FOLD: SamplerSpacing,
Datatype.DTM: SamplerSpacing,
}

# Check for wrong sampler
if datatype in allowed_samplers:
allowed_sampler_type = allowed_samplers[datatype]
if not isinstance(sampler, allowed_sampler_type):
raise ValueError(
f"Got wrong argument for this datatype: {type(sampler).__name__}, please use {allowed_sampler_type.__name__} instead"
)
## does the enum print the number or the label?
logger.info(f"Setting sampler for {datatype} to {sampler.sampler_label}")
self.samplers[datatype] = sampler
Expand Down
2 changes: 1 addition & 1 deletion map2loop/sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import pandas
import shapely
import numpy
from typing import Optional
from typing import Optional, Union


class Sampler(ABC):
Expand Down
Loading