Skip to content

Commit

Permalink
Add converter to turn upsample/downsample into Coordinates for easy…
Browse files Browse the repository at this point in the history
… multiplication
  • Loading branch information
pattonw committed Jan 2, 2025
1 parent c09df8c commit dbf7ac2
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ class ResampledArrayConfig(ArrayConfig):
metadata={"help_text": "The Array that you want to upsample or downsample."}
)

upsample: Coordinate = attr.ib(
_upsample: Coordinate = attr.ib(
metadata={"help_text": "The amount by which to upsample!"}
)
downsample: Coordinate = attr.ib(
_downsample: Coordinate = attr.ib(
metadata={"help_text": "The amount by which to downsample!"}
)
interp_order: bool = attr.ib(
Expand Down Expand Up @@ -109,6 +109,14 @@ def preprocess(self, array: Array) -> Array:
axis_names=array.axis_names,
units=array.units,
)

@property
def upsample(self) -> Coordinate:
return Coordinate(self._upsample)

@property
def downsample(self) -> Coordinate:
return Coordinate(self._downsample)

def array(self, mode: str = "r") -> Array:
source_array = self.source_array_config.array(mode)
Expand Down

0 comments on commit dbf7ac2

Please sign in to comment.