FireDynamics / fdsreader

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

Obstructions .get_by_id not working with Integers anymore #58

Closed C-Rogge closed 1 year ago

C-Rogge commented 1 year ago

Today is just a quick one:

When getting an obstructions by the _.get_byid()-Command, only strings seem to work now. For example calling _.get_byid('1') yields the right result, while .get_by_id(1) returns None. Im not sure if this is intended, but at least some versions ago also integers worked.

This should be reproduceable in pretty much any simulations with obstructions right now, but before @lu-kas keeps scolding me: fdsreaderTestcase .fds.txt

JanVogelsang commented 1 year ago

Hm, actually I am not sure if I want to "fix" this. IDs are supposed to be strings as they are not limited to numbers, but can be any alphanumeric character (or whatever the ID-limitations of FDS are).
@lu-kas What do you think? I could of course just check if obstruction ID contains only numeric characters and then compare it to the integer parameter, but at the same time there is nothing stopping you from just going with .get_by_id(str(1)).

If it makes your life easier I can implement that, though, doesn't really hurt.

C-Rogge commented 1 year ago

To be honest it doesn't really matter to me. Like you said, its easy to just convert the integer into a string. I just stumbled over the changed behavior as some of my code did not work anymore since i last updated the fds reader, so i thought i as well just ask if the change was intended or not.

I hope for the next fds/smv version to actually name my obstructions for better recognition while analysing with the reader, as we discussed in another thread, so no need to (re-)implement this for me. Thanks for looking into it anyway ;)