Skip to content
Snippets Groups Projects
  • Mikkel Friis-Møller's avatar
    23c475e5
    fixing test_path · 23c475e5
    Mikkel Friis-Møller authored
    updated a few more test references
    
    Update .gitlab-ci.yml
    
    Updated readme
    
    small fix to yml and readme
    
    Specify the test machine to ignore Colonel dir
    
    correcting ignore statement
    23c475e5
    History
    fixing test_path
    Mikkel Friis-Møller authored
    updated a few more test references
    
    Update .gitlab-ci.yml
    
    Updated readme
    
    small fix to yml and readme
    
    Specify the test machine to ignore Colonel dir
    
    correcting ignore statement
test_wind_resource.py 975 B
'''
Created on 17. maj 2018

@author: mmpe
'''
import unittest
import numpy as np
from topfarm.cost_models.utils.wind_resource import WindResource


class TestWindResource(unittest.TestCase):

    def test_WindResource(self):
        f = [0.035972, 0.039487, 0.051674, 0.070002, 0.083645, 0.064348, 0.086432, 0.117705, 0.151576, 0.147379, 0.10012, 0.05166]
        A = [9.176929, 9.782334, 9.531809, 9.909545, 10.04269, 9.593921, 9.584007, 10.51499, 11.39895, 11.68746, 11.63732, 10.08803]
        k = [2.392578, 2.447266, 2.412109, 2.591797, 2.755859, 2.595703, 2.583984, 2.548828, 2.470703, 2.607422, 2.626953, 2.326172]
        ti = np.zeros_like(f) + .1
        wr = WindResource(f, A, k, ti)

        wdir, ws, ti, weight = wr([0], [0], [4, 5])
        np.testing.assert_array_almost_equal(weight, np.array([[0.071381703], [0.088361194]]) * 0.035972 * (12 / 360))


if __name__ == "__main__":
    #import sys;sys.argv = ['', 'Test.testWindResource']
    unittest.main()