From 44cdacaac72483d0334d81e37dfe3aeadb89498b Mon Sep 17 00:00:00 2001 From: Mikkel Pedersen Date: Sat, 2 Sep 2023 10:53:51 +0200 Subject: [PATCH] fix(falsecolor): Add odim option --- .../options/falsecolor.py | 22 +++++++++++++++++-- tests/falsecolor_test.py | 10 +++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/honeybee_radiance_command/options/falsecolor.py b/honeybee_radiance_command/options/falsecolor.py index e380a83e..01b7b55a 100644 --- a/honeybee_radiance_command/options/falsecolor.py +++ b/honeybee_radiance_command/options/falsecolor.py @@ -6,7 +6,8 @@ NumericOption, StringOption, IntegerOption, - FileOption + FileOption, + TupleOption ) @@ -31,7 +32,8 @@ class FalsecolorOptions(OptionCollection): "_e", "_r", "_g", - "_b" + "_b", + "_odim" ) def __init__(self): @@ -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): @@ -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 diff --git a/tests/falsecolor_test.py b/tests/falsecolor_test.py index c0b2a96d..b7376baa 100644 --- a/tests/falsecolor_test.py +++ b/tests/falsecolor_test.py @@ -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'