microcombustion / ctwrap

Python wrapper for batch simulations (e.g. Cantera)
https://microcombustion.github.io/ctwrap/
MIT License
6 stars 5 forks source link

Address NaturalNameWarning #1

Closed ischoegl closed 3 years ago

ischoegl commented 5 years ago

In the current implementation, HDF groups are named by simulation tasks, which may include a period ('.') or other characters that prevent names from being used as attributes. E.g. a name upstream.phi_2.4<mix> triggers the following warning:

NaturalNameWarning: object name is not a valid Python identifier: 
'upstream.phi_2.4<mix>'; it does not match the pattern ``^[a-zA-Z_][a-zA-Z0-9_]*$``; 
you will not be able to use natural naming to access this object; 
using ``getattr()`` will still work, though

The warning is inconsequential but annoying ...

ischoegl commented 3 years ago

Once the code is migrated to Cantera 2.5, this warning will likely be triggered from upstream cantera (write_hdf). It may be better to enter conditions as description and avoid the warning.