Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

There is a problem with TurbSimFile writing #79

Description

@Relax-in

Dear all
I had some problems when I used the pyFAST library to replace the data with turbsim, I was confused, when I used this function alone, the output file was fine, but when I called it in other programs, the replaced data was not correct

Below is my function code, any help would be greatly appreciated
bts_change .txt
2023-11-23 11-21-53屏幕截图
2023-11-23 11-23-00屏幕截图

Activity

  1. Relax-in commented on Nov 23, 2023

    @Relax-in
    Author

    `class replacement_bts_data(QThread):
    result_signal = pyqtSignal(str)
    result_signal_2 = pyqtSignal(str)

    def __init__(self, big_bts_name, small_bts_name):
        super().__init__()
    
        # 读取数据
        self.big_bts_name = big_bts_name
        self.small_bts_name = small_bts_name
    
    
    def run(self):
    
        self.result_signal_2.emit("开始替换,请等待...")
    
        bts_case = bts_change()
        i = bts_case.bts_big_in_small(self.big_bts_name[0], self.small_bts_name[0])
        self.result_signal_2.emit(i)
        
        self.result_signal_2.emit("执行结束!")
        self.result_signal_2.emit("_____________________________________")`
    

    This is the code that I call the function

  2. ebranlard commented on Nov 23, 2023

    @ebranlard
    Collaborator

    Hi,
    I'm not sure where this behavior comes from. You seem to be using QThread, I'm not too familiar with it. I wonder if you could try to reproduce this behavior with a simple non threaded script at first. I'm enclosing a simple script below that modifies a turbsim file and reads it. It seems to perform as expected. Small errors are expected due to the binary format and internal scaling done.

        ts = TurbSimFile('file.bts')
        ts['u']=np.random.randn(*ts['u'].shape)
        ts['u'][0]+=10
        ts.write('aaaaaa.bts')
        ts2 = TurbSimFile('aaaaaa.bts')
        abs_error = np.abs(ts2['u'].flatten()-ts['u'].flatten())
        print('abs error:',np.max(abs_error), np.mean(abs_error))

    I would advise to simplify your case and see if the problem persists. Let us know if you find out what's happening. Feel free to submit a fix.

  3. self-assigned this
    on Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions