arlmet.File#
- class arlmet.File(path, mode='r', *, source=None, grid=None, vertical_axis=None)[source]#
Read or write an ARL meteorology file.
- Parameters:
path (
str|PathLike[str]) – Location of the ARL file on disk.mode (
Literal['r','w']) – File mode. Read mode scans the file immediately; write mode expects the caller to providesource,grid, andvertical_axisbefore creating records.source (
str|None) – Four-character ARL source identifier used when writing.grid (
Grid|None) – Horizontal grid metadata used when writing.vertical_axis (
VerticalAxis|None) – Vertical axis metadata used when writing: the surface and at most 99 levels above it, the most a record’s header numbers.
- Variables:
path (pathlib.Path) – Filesystem path for the ARL file.
mode ({"r", "w"}) – Active file mode.
variables (VariableAccessor) – Lazy accessor for variable-wise views inherited from RecordCollection.
Examples
>>> import arlmet >>> with arlmet.File("met.arl") as met: ... met.times[0] Timestamp('2024-07-18 00:00:00')
Attributes
Horizontal grid metadata; set it in write mode before creating records. |
|
Open binary handle to the file, reopened if the file cache closed it. |
|
Length in bytes of each record in the file, from the grid. |
|
All DataRecords in the file, in |
|
Size of the file on disk, in bytes. |
|
ARL source identifier; set it in write mode before creating records. |
|
Return a sorted list of timestamps in the file. |
|
Vertical coordinate metadata; set it in write mode before creating records. |
Methods
|
Add one writable DataRecord, creating its RecordSet if needed. |
|
Return what is wrong with this file that opening it does not catch. |
|
Flush pending writes and close the managed binary file handle. |
|
Create and attach the horizontal grid metadata for a writable file. |
|
Create a writable RecordSet for one valid time. |
|
Write a spatial/vertical subset of this file to a new ARL file. |
|
Write pending record sets to disk and release their in-memory data. |
|
Sample fields from this file at arbitrary lon/lat/z points. |
|
Project this file into the simplified analysis Dataset representation. |