FlowModelingControl / flowtorch

flowTorch - a Python library for analysis and reduced-order modeling of fluid flows
GNU General Public License v3.0
131 stars 45 forks source link

CSVDataloader problem #33

Closed yujiangsenior closed 1 year ago

yujiangsenior commented 1 year ago

Hi there, I am trying to follow an example of DMD, as follows. https://github.com/AndreWeiner/ofw2022_dmd_training/blob/main/dmd_flowtorch.ipynb But the CSVDataloader could never be able to load any dataset successfully as the helping document of CSVDataloader suggests, with the error as follows. Thanks for helping.


ValueError Traceback (most recent call last) Cell In[36], line 2 1 path = r'datasets\csv_naca0012_alpha4_surface' ----> 2 loader = CSVDataloader.from_foam_surface(path, "total(p)_coeff_airfoil.raw") 3 times = loader.write_times

File E:\softwares\Anaconda3\envs\pyflowt\lib\site-packages\flowtorch\data\csv_dataloader.py:200, in CSVDataloader.from_foam_surface(cls, path, file_name, header, dtype) 180 """Create CSVDataloader instance to load OpenFOAM surface sample data. 181 182 The class method simplifies to load data generated by OpenFOAM's (...) 197 198 """ 199 folders = glob(f"{path}/*") --> 200 times = sorted( 201 [folder.split("/")[-1] for folder in folders], key=float 202 ) 203 filepath = join(path, times[0], file_name) 204 with open(filepath, "r") as surface:

ValueError: could not convert string to float: 'datasets\csv_naca0012_alpha4_surface\0.001'

AndreWeiner commented 1 year ago

Hi @yujiangsenior, I did not design the code for execution on Windows. Therefore, the dataloaders are not working for you. I think it shouldn't be too much work to adapt the paths to Windows, but I have no means to test the code. I'll have a look later today. Best, Andre

yujiangsenior commented 1 year ago

Thanks Andre. I also did not make it run on Ubuntu, maybe I will reinstall the packages again both on Ubuntu and Windows. I don't know how to make adjustments on Windows to make it run still, but I'll give it a try. Thanks again. Yu

AndreWeiner commented 1 year ago

The OS dependency of the CSVDataloader should be fixed by this commit. The easiest way to get the fix:

pip3 uninstall flowtorch
pip3 install git+https://github.com/FlowModelingControl/flowtorch.git@aweiner

Best regards, Andre