Skip to content

Commit

Permalink
fix: issue 155 (#158)
Browse files Browse the repository at this point in the history
* fix: simple fix for #155

* fix: decimation factor allows floats

* fix: decimation int
  • Loading branch information
AngRodrigues authored Dec 9, 2024
1 parent add4692 commit 227e59a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions map2loop/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,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

0 comments on commit 227e59a

Please sign in to comment.