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 (path-like) – Location of the ARL file on disk.
mode ({"r", "w"}, default "r") – File mode. Read mode scans the file immediately; write mode expects the caller to provide
source,grid, andvertical_axisbefore creating records.source (str, optional) – Four-character ARL source identifier used when writing.
grid (Grid, optional) – Horizontal grid metadata used when writing.
vertical_axis (VerticalAxis, optional) – Vertical axis metadata used when writing.
- path#
Filesystem path for the ARL file.
- Type:
- mode#
Active file mode.
- Type:
{“r”, “w”}
- times#
Sorted valid times discovered in the file.
- Type:
- vertical_axis#
Vertical coordinate metadata.
- Type:
- variables#
Lazy accessor for variable-wise views inherited from RecordCollection.
- Type:
VariableAccessor
- __getitem__(key)[source]#
Get a RecordSet by valid time (Timestamp or string), or by position in
times(int).
- add_record(time, variable, level, \*, forecast, data=None, diff=None)[source]#
Add one writable DataRecord, creating its RecordSet if needed.
- sample_points(points, variables, ...)[source]#
Interpolate fields at arbitrary lon/lat/z sample points.
- extract_subset(dest, ...)[source]#
Write a spatial/vertical subset to a new ARL file and return its path.
Examples
>>> import arlmet >>> with arlmet.File("met.arl") as met: ... met.times[0] Timestamp('2024-07-18 00:00:00')
Methods
|
|
|
Add one writable DataRecord, creating its RecordSet if needed. |
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. |
Attributes
|
|
|
|
|
All DataRecords in the file, in |
|
|
Return a sorted list of timestamps in the file. |
|