gnome.utilities.file_tools.haz_files ==================================== .. py:module:: gnome.utilities.file_tools.haz_files .. autoapi-nested-parse:: A module that did contain various functions for reading and writing assorted HAZMAT file formats. Now it's just BNA format Other stuff is now maintained in either the ood_utils package and/or libgoods Functions --------- .. autoapisummary:: gnome.utilities.file_tools.haz_files.GetNextBNAPolygon gnome.utilities.file_tools.haz_files.ReadBNA Module Contents --------------- .. py:function:: GetNextBNAPolygon(f, dtype=np.float64) Utility function that returns the next polygon from a BNA file returns: (points, poly_type, name, sname) where: points: Nx2numpy array of floats with the points poly_type: one of "point", "line", "poly" name: name defined in the BNA sname: secondary name defined in the BNA NOTE: It is the BNA standard to duplicate the first and last points. In that case, the duplicated last point is removed. "holes" in polygons are not supported in this code. See: http://www.softwright.com/faq/support/boundary_file_bna_format.html NOTE: This code doesn't allow extra spaces around the commas in the header line. If there are no commas allowed in the name, it would be easier to simply split on the commas (or march through the line looking for the quotes -- regex?) .. py:function:: ReadBNA(filename, polytype='list', dtype=np.float64) Read a bna file. :param filename: A filename to write to. :param polytype: The type of polygon structure to return. :type polytype: one of: ("list", "PolygonSet", "BNADataClass") :return: returns the BNA data contents :rtype: Results are returned as one of: :list: A list of tuples (points, poly_type, name, secondary name) :PolygonSet: A geometry.polygons.PolygonSet object, with metadata (poly_type, name, secondary name) :BNADataClass: A BNAData class object. This may be broken now! The dtype parameter specifies what numpy data type you want the points data in -- it defaults to float (C double)