Skip to content

Commit

Permalink
fix(falsecolor): Add odim option
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkelkp committed Sep 2, 2023
1 parent aeea0db commit 44cdaca
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
22 changes: 20 additions & 2 deletions honeybee_radiance_command/options/falsecolor.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
NumericOption,
StringOption,
IntegerOption,
FileOption
FileOption,
TupleOption
)


Expand All @@ -31,7 +32,8 @@ class FalsecolorOptions(OptionCollection):
"_e",
"_r",
"_g",
"_b"
"_b",
"_odim"
)

def __init__(self):
Expand All @@ -56,6 +58,10 @@ def __init__(self):
self._r = StringOption("r", "Red channel mapping (expression of 'v')")
self._g = StringOption("g", "Green channel mapping (expression of 'v')")
self._b = StringOption("b", "Blue channel mapping (expression of 'v')")
self._odim = TupleOption(
"odim", "X and Y grid dimensions for value overlay", length=2,
numtype=int
)
self._on_setattr_check = True

def _on_setattr(self):
Expand Down Expand Up @@ -258,3 +264,15 @@ def b(self):
@b.setter
def b(self, value):
self._b.value = value

@property
def odim(self):
""""X and Y grid dimensions for value overlay.
The expression must be a tuple with two integer values.
"""
return self._odim

@odim.setter
def odim(self, value):
self._odim.value = value
10 changes: 10 additions & 0 deletions tests/falsecolor_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,13 @@ def test_validation():
falsecolor.to_radiance()
falsecolor.input = 'image.hdr'
assert falsecolor.to_radiance() == 'falsecolor -i image.hdr'


def test_odim():
"""Test odim option."""
falsecolor = Falsecolor()

falsecolor.input = 'image.hdr'
falsecolor.output = 'image_odim.hdr'
falsecolor.options.odim = (5, 5)
assert falsecolor.to_radiance() == 'falsecolor -odim 5 5 -i image.hdr > image_odim.hdr'

0 comments on commit 44cdaca

Please sign in to comment.