FireDynamics / fdsreader

Python reader for FDS data
GNU General Public License v3.0
44 stars 18 forks source link

Global slice example redefine #46

Closed fliszer closed 1 year ago

fliszer commented 1 year ago

Hi,

I think it's worth to extend global slice example to better show obsts mask (examples/slcf)/slcf_example_global.py). For less experienced users it can be helpful:

def main():
    sim = fds.Simulation("./fds_multimesh")

    # Get the first slice
    slc = sim.slices[1]
    # Set fill value larger than vmax below
    data = slc.to_global(masked=True, fill=50)

    # Set colormap
    cmap = cm.get_cmap('rainbow')
    # Set obsts color
    cmap.set_over('white')

    # Plot the slice
    plt.imshow(data[-1].T,
               vmin=0,
               vmax=2,
               cmap=cmap,
               origin="lower")
    plt.colorbar()
    plt.show()

if __name__ == "__main__":
    main()
JanVogelsang commented 1 year ago

Thanks for your input, I modified the example to now use "np.nan" as fill value and hence also changed set_over to set_bad.