Writing¶
The bin.Field and bin.Series objects both provide a write() method to save the field data to a MICRESS binary file. The write() method expects a file path as an argument, and writes the field data to the specified file. Per default, the data is compressed and a geometry file is created alongside the binary file. You can disable compression and geometry file creation by setting the compress and geometry arguments to False, respectively.
The following example demonstrates how to write a series of fields to a new binary file.
from micpy import bin
with bin.File("A001_Delta_Gamma.conc1") as file:
series = file.read([0, 1, -2, -1])
series.write("My_A001_Delta_Gamma.conc1")
Reference¶
micpy.bin.Field ¶
Bases: ndarray
A field.
write(filename, compressed=True, geometry=True) ¶
Write the field to a binary file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename | str | Filename of the binary file. | required |
compressed | bool |
| True |
geometry | bool |
| True |
micpy.bin.Series ¶
Bases: ndarray
write(filename, compressed=True, geometry=True) ¶
Write the series to a binary file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename | str | Filename of the binary file. | required |
compressed | bool |
| True |
geometry | bool |
| True |