Skip to content

[Bug]: Error in .to_global() Method for Slice Files with masked=True #89

@Haukiy

Description

@Haukiy

What happened?

Hi, I encountered an issue when using the .to_global() method for Slice files in fdsreader. When setting masked=True, an error occurs, whereas setting masked=False works as expected. This suggests that the issue is related to handling the masked option.

Since displaying obstructions for better orientation is very useful, I would appreciate it if you could investigate this issue :) I have attached a demo FDS file for reproduction.

TEST_CASE.txt

error:

ValueError Traceback (most recent call last)
Cell In[6], line 9
7 slc=sim.slices
8 slc_soot = slc.get_by_id("SOOT_Z_Decke")
----> 9 data_slc, grid_coords = slc_soot.to_global(masked=True, fill=np.nan, return_coordinates=True)

File ~\AppData\Local\anaconda3\Lib\site-packages\fdsreader\slcf\slice.py:648, in Slice.to_global(self, masked, fill, return_coordinates)
644 if masked:
645 slc_data = np.where(mask, slc_data, fill)
647 grid[:, start_idx['x']: end_idx['x'], start_idx['y']: end_idx['y'],
--> 648 start_idx['z']: end_idx['z']] = slc_data.reshape(
649 (self.n_t, end_idx['x'] - start_idx['x'], end_idx['y'] - start_idx['y'],
650 end_idx['z'] - start_idx['z']))
652 if return_coordinates:
653 coordinates = dict()

ValueError: cannot reshape array of size 0 into shape (76,67,69,1)

Steps to reproduce

import fdsreader as fds
import numpy as np

path=r"-----"

sim=fds.Simulation(path)
slc=sim.slices
slc_soot = slc.get_by_id("SOOT_Z_Decke")
data_slc, grid_coords = slc_soot.to_global(masked=True, fill=np.nan, return_coordinates=True)

FDS version used

FDS-6.9.1-0-g889da6a-release

fdsreader version used

1.11.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions