I/O#
Input and output functionality.
- aeolus.io.create_dummy_cube(nlat: int | None = None, nlon: int | None = None, n_res: int | None = None, endgame: bool | None = True, grid_type: str | None = 'a', pm180: bool | None = False) Cube [source]#
Create a dummy 2D cube with given resolution compatible with the UM grid.
- Parameters:
nlat (int, optional) – Number of points in latitude. Not needed if n_res is given.
nlon (int, optional) – Number of points in longitude. Not needed if n_res is given.
n_res (int, optional) – N-notation resolution. If given, nlat and nlon are calculated automatically.
endgame (bool, optional) – Use ENDGame grid. If True, “A” grid starts at lat=-90+dlat/2, lon=dlon/2. If False, “A” grid starts at lat=-90, lon=0. ENDGame’s “A” grid is NewDyn “B” grid and vice versa.
grid_type (str, optional) –
- Type of the UM grid.
A is main UM grid
B is staggered lorenz wind grid
Cu is staggered U wind grid
Cv is staggered V wind grid
pm180 (bool, optional) – Use -/+180 instead of 0 to 360 for the longitude span.
- Returns:
cube – A dummy 2D cube of zeros.
- Return type:
Examples
>>> create_dummy_cube(nlat=90, nlon=144) >>> create_dummy_cube(n=96)
- aeolus.io.get_filename_list(path_to_dir: Path, glob_pattern: str | None = 'umglaa*', ts_start: int | None = 0, ts_end: int | None = -1, every: int | None = 1, regex: str | None = 'umglaa.p[b,c,d,e]{1}[0]{6}(?P<timestamp>[0-9]{2,6})_00', regex_key: str | None = 'timestamp', sort: bool | None = True) Sequence[Path] [source]#
Get a list of files with timestamps >= than start in a directory.
- aeolus.io.load_conservation_diag(fnames: Sequence[Path | str], convert_to_iris: bool | None = True, drop_duplicates: bool | None = True) DataFrame | CubeList [source]#
Load UM conservation diagnostics from a series of text files.
- aeolus.io.load_data(files: Sequence, structured: bool | None = False) CubeList [source]#
Use iris.load with optional structured loading for PP files.
- aeolus.io.load_multidir(path_mask: str, labels: Sequence[str], label_name: str | None = 'run') CubeList [source]#
Load cubelists from multiple directories and merge.
- aeolus.io.load_vert_lev(path_to_file: Path, lev_type: str | None = 'theta') array [source]#
Read data from the UM vertical levels file.
- Parameters:
path_to_file (pathlib.Path) – Full path to the vertical levels file.
lev_type (str, optional) – What levels to return: “theta” or “rho”.
- Returns:
levs – Array of height levels.
- Return type:
numpy.array
- aeolus.io.save_cubelist(cubelist: CubeList, path: Path, **aux_attrs: Any | None) None [source]#
Save a cubelist w/o the planet_conf container to a file.
- Parameters:
cubelist (iris.cube.CubeList) – Cube list to write to disk.
path (str or pathlib.Path) – File path.
aux_attrs (dict, optional) – Dictionary of additional attributes to save with the cubes.