Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading 2d slice files unzipped vs zipped #6

Open
fgi21 opened this issue Aug 8, 2023 · 3 comments
Open

Loading 2d slice files unzipped vs zipped #6

fgi21 opened this issue Aug 8, 2023 · 3 comments

Comments

@fgi21
Copy link

fgi21 commented Aug 8, 2023

Hi,

Many thanks for developing this highly useful tool.

I've noticed a small issue that occurs if I attempt to load the fds results into python from an unzipped folder i.e
"address_results = r'\file\Usersf$\xxx\Home\Desktop\Level_Set_2D/'
grid, data, times = fds.readSLCF2Ddata('Level_Set_2D', address_results, 'TEMPERATURE')"

The code will run for a bit and then output the following error message:
"2-D slice: \file\Usersf$\xxx\Home\Desktop\Level_Set_2D\Level_Set_2D_10_37.sf
2-D slice: \file\Usersf$\xxx\Home\Desktop\Level_Set_2D\Level_Set_2D_10_25.sf
Traceback (most recent call last):

Cell In[17], line 3
grid, data, times = fds.readSLCF2Ddata('Level_Set_2D', address_results, 'TEMPERATURE') ## (File name (chid), file directory, Information request)

File C:\Program Files\Anaconda3\lib\site-packages\pyfdstools\extractPlot3Ddata.py:963 in readSLCF2Ddata
tInd = grids[list(grids.keys())[0]]['datas2D'][0].shape[3]

IndexError: list index out of range"

However, if I zip the file updating the directory '"address_results = r'\file\Usersf$\xxx\Home\Desktop\Level_Set_2D.zip' it runs without a single issue, loading the data.

Any idea why this happens? I can't see what is possibly causing this as the unzipped folder will have the the exact same contents as the zip file. Admittedly, this is a minor problem that I've come across. I only ask as I've noticed this error persists with much larger simulations in which the zipping of the folder can add alot of additional time.

Many thanks

@godisreal
Copy link

Hi, I am also trying to read in 2D slice data, but I notice there is read2dSliceFile(). What is the difference between read2dSliceFile() and readSLCF2Ddata? Now I get sf slice file, no xyz or zip file involved, but it seems that readSLCF2Ddata() reads data from zip or xyz files. I do not get it. Any guidance on this issue?

@johodges
Copy link
Owner

johodges commented Sep 4, 2023

Thanks for reporting this issue. I will take a look into it and give an update.

@johodges
Copy link
Owner

johodges commented Sep 9, 2023

I made some changes to reading the slice files last week. @fgi21 could you see if this fixed your issue? If not could you provide an example case?

@godisreal the main difference between those two functions is that "read2dSliceFile" will only read a single 2-D slice file (i.e., one mesh). However, "readSLCF2Ddata" will read 2-D slice data on a single axis and value location from multiple files (i.e., you have a slice at x=0 that crosses 2-meshes and you want to load all that data).

Both functions currently read the coordinate positions from the xyz files. The SLCF header does not contain this information so it needs to be read in from some external file. I have considered changing it to read the information from the SMV file instead since people do not always output xyz files and it leads to some confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants