pysgems.io package
Submodules
pysgems.io.sgio module
- class pysgems.io.sgio.PointSet(project, pointset_path: Optional[str] = None, force_2d: bool = False)[source]
Bases:
Package- __init__(project, pointset_path: Optional[str] = None, force_2d: bool = False)[source]
Handles the creation of a PointSet object.
- Parameters
project – Project instance
pointset_path – Path to the pointset file
force_2d – If True, the pointset is forced to be 2D
- pysgems.io.sgio.datread(file: Optional[str] = None, start: int = 0, end: Optional[int] = None)[source]
Reads space separated dat file
- Parameters
file – path to the file to be read
start – start index
end – end index
- Returns
numpy array of the data
- pysgems.io.sgio.export_eas(dataframe: DataFrame, filename: str = 'dataset')[source]
Exports a Pandas DataFrame to geo-eas format
- Parameters
dataframe – Pandas DataFrame to be exported
filename – name of the file to be written
- pysgems.io.sgio.write_point_set(file_name: str, sub_dataframe: DataFrame, nodata: int = -999)[source]
Function to write sgems binary point set files.
The Simulacre_input_filter class is a filter that can read the default file format of GsTLAppli. The format is a binary format, with big endian byte order. Following are a description of the file formats for the pointset and the cartesian grid objects. All file formats begin with magic number 0xB211175D, a string indicating the type of object stored in the file, the name of the object, and a version number (Q_INT32). The rest is specific to the object stored:
- point-set:
a Q_UINT32 indicating the number of points in the object. a Q_UINT32 indicating the number of properties in the object strings containing the names of the properties the x,y,z coordinates of each point, as floats all the property values, one property at a time, in the order specified by the strings of names, as floats. For each property there are as many values as points in the point-set.
- cartesian grid:
3 Q_UINT32 indicating the number of cells in the x,y,z directions 3 floats for the dimensions of a single cell 3 floats for the origin of the grid a Q_UINT32 indicating the number of properties all the property values, one property at a time, in the order specified by the strings of names, as floats. For each property, there are nx*ny*nz values (nx,ny,nz are the number of cells in the x,y,z directions).
- Parameters
nodata – nodata value, rows containing this value are omitted.
file_name – name of the file to be written.
sub_dataframe – Sub-frame of the feature to be exported [x, y, feature value]