FireDynamics / FireDynamics/fdsreader

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

Open
#89 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
75
Forks
28
PR merge metrics
No merged PRs in 30d

Description

### 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](https://github.com/user-attachments/files/19182198/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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.