예제 #1
0
class RaTiffTestCase(unittest.TestCase):
    """Test for (honeybee/radiance/command/ra_tiff.py)."""

    # test prep
    def setUp(self):
        ra_tiff_para = RaTiffParameters()
        ra_tiff_para.exposure = '-4'
        ra_tiff_para.compression_type = 'L'

        self.ra_tiff = RaTiff()
        self.ra_tiff.input_hdr_file = 'assets/sample.hdr'
        self.ra_tiff.ra_tiff_parameters = ra_tiff_para
        self.ra_tiff.output_tiff_file = 'assets/sample.tiff'

    def tearDown(self):
        # cleanup
        os.remove('assets/sample.tiff')

    def test_default_values(self):
        # Two tests will be conducted:
        #   First one checks if ra_tiff created the file correctly.
        #   Second one checks if the file size is greater than zero.
        self.ra_tiff.execute()
        self.assertTrue(os.path.exists('assets/sample.tiff'),
                        'The file that should have been created by ra_tiff was not'
                        'found.')

        file_size = os.stat('assets/sample.tiff').st_size

        self.assertGreater(file_size, 10,
                           'The size of the file created by ra_tiff does not appear to'
                           ' be correct')
예제 #2
0
    def setUp(self):
        ra_tiff_para = RaTiffParameters()
        ra_tiff_para.exposure = '-4'
        ra_tiff_para.compression_type = 'L'

        self.ra_tiff = RaTiff()
        self.ra_tiff.input_hdr_file = 'assets/sample.hdr'
        self.ra_tiff.ra_tiff_parameters = ra_tiff_para
        self.ra_tiff.output_tiff_file = 'assets/sample.tiff'
    def setUp(self):
        raTiffPara = RaTiffParameters()
        raTiffPara.exposure = '-4'
        raTiffPara.compressionType = 'L'

        self.raTiff = RaTiff()
        self.raTiff.inputHdrFile='assets/sample.hdr'
        self.raTiff.raTiffParameters = raTiffPara
        self.raTiff.outputTiffFile = 'assets/sample.tiff'
"""
Convert hdr files to tiff files.

-

    Args:
        _hdrs: A list of hdr files.
        _convert: Set to True to start the converting process.
    Returns:
        report: Reports, errors, warnings, etc.
        tiff: List of full path to output tiff images.
"""

ghenv.Component.Name = "HoneybeePlus_HDR to Tiff"
ghenv.Component.NickName = 'hdr2tiff'
ghenv.Component.Message = 'VER 0.0.05\nOCT_22_2018'
ghenv.Component.Category = "HoneybeePlus"
ghenv.Component.SubCategory = '04 :: Daylight :: Daylight'
ghenv.Component.AdditionalHelpFromDocStrings = "5"

try:
    from honeybee.radiance.command.raTiff import RaTiff
except ImportError as e:
    raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))

if _convert == True:
    tiff = []
    for fp in _hdrs:
        output = fp[:-4] + '.tiff'
        RaTiff(fp, output).execute()
        tiff.append(output)