33Note:
44 These functions are low level utilities. You should not use these unless
55 you know what you are doing. To access StagYY output data, use an instance
6- of :class:`~ stagpy.stagyydata.StagyyData` .
6+ of [`StagyyData`][ stagpy.stagyydata.StagyyData] .
77"""
88
99from __future__ import annotations
@@ -54,18 +54,17 @@ def _tidy_names(
5454def time_series (timefile : Path , colnames : list [str ]) -> Optional [DataFrame ]:
5555 """Read temporal series text file.
5656
57- If :data: `colnames` is too long, it will be truncated. If it is too short,
57+ If `colnames` is too long, it will be truncated. If it is too short,
5858 additional numeric column names from 0 to N-1 will be attributed to the N
59- extra columns present in :data: `timefile`.
59+ extra columns present in `timefile`.
6060
6161 Args:
6262 timefile: path of the time.dat file.
63- colnames: names of the variables expected in :data:`timefile` (may be
64- modified).
63+ colnames: names of the variables expected in `timefile` (may be modified).
6564
6665 Returns:
67- A :class: `pandas.DataFrame` containing the time series, organized by
68- variables in columns and time steps in rows.
66+ A `pandas.DataFrame` containing the time series, organized by
67+ variables in columns and time steps in rows.
6968 """
7069 if not timefile .is_file ():
7170 return None
@@ -105,17 +104,16 @@ def time_series(timefile: Path, colnames: list[str]) -> Optional[DataFrame]:
105104def time_series_h5 (timefile : Path , colnames : list [str ]) -> Optional [DataFrame ]:
106105 """Read temporal series HDF5 file.
107106
108- If :data: `colnames` is too long, it will be truncated. If it is too short,
107+ If `colnames` is too long, it will be truncated. If it is too short,
109108 additional column names will be deduced from the content of the file.
110109
111110 Args:
112111 timefile: path of the TimeSeries.h5 file.
113- colnames: names of the variables expected in :data:`timefile` (may be
114- modified).
112+ colnames: names of the variables expected in `timefile` (may be modified).
115113
116114 Returns:
117- A :class: `pandas.DataFrame` containing the time series, organized by
118- variables in columns and the time steps in rows.
115+ A `pandas.DataFrame` containing the time series, organized by
116+ variables in columns and the time steps in rows.
119117 """
120118 if not timefile .is_file ():
121119 return None
@@ -172,18 +170,17 @@ def rprof(
172170) -> tuple [dict [int , DataFrame ], Optional [DataFrame ]]:
173171 """Extract radial profiles data.
174172
175- If :data: `colnames` is too long, it will be truncated. If it is too short,
173+ If `colnames` is too long, it will be truncated. If it is too short,
176174 additional numeric column names from 0 to N-1 will be attributed to the N
177- extra columns present in :data: `timefile`.
175+ extra columns present in `timefile`.
178176
179177 Args:
180178 rproffile: path of the rprof.dat file.
181- colnames: names of the variables expected in :data: `rproffile`.
179+ colnames: names of the variables expected in `rproffile`.
182180
183181 Returns:
184- A tuple (profs, times). :data:`profs` is a dict mapping istep to radial
185- profiles (:class:`pandas.DataFrame`). :data:`times` is the time indexed
186- by time steps.
182+ profs: a dict mapping istep to radial profiles.
183+ times: the time indexed by time steps.
187184 """
188185 if not rproffile .is_file ():
189186 return {}, None
@@ -221,17 +218,16 @@ def rprof_h5(
221218) -> tuple [dict [int , DataFrame ], Optional [DataFrame ]]:
222219 """Extract radial profiles data.
223220
224- If :data: `colnames` is too long, it will be truncated. If it is too short,
221+ If `colnames` is too long, it will be truncated. If it is too short,
225222 additional column names will be deduced from the content of the file.
226223
227224 Args:
228225 rproffile: path of the rprof.h5 file.
229- colnames: names of the variables expected in :data: `rproffile`.
226+ colnames: names of the variables expected in `rproffile`.
230227
231228 Returns:
232- A tuple (profs, times). :data:`profs` is a dict mapping istep to radial
233- profiles (:class:`pandas.DataFrame`). :data:`times` is the time indexed
234- by time steps.
229+ profs: a dict mapping istep to radial profiles.
230+ times: the time indexed by time steps.
235231 """
236232 if not rproffile .is_file ():
237233 return {}, None
@@ -275,15 +271,11 @@ def refstate(
275271 ncols: number of columns.
276272
277273 Returns:
278- tuple (syst, adia).
279-
280- :data:`syst` is a list of list of
281- :class:`pandas.DataFrame` containing the reference state profiles for
282- each system and each phase in these systems.
283-
284- :data:`adia` is a list of :class:`pandas.DataFrame` containing
285- the adiabatic reference state profiles for each system, the last
286- item being the combined adiabat.
274+ syst: list of list of `pandas.DataFrame` containing the reference
275+ state profiles for each system and each phase in these systems.
276+ adia: list of `pandas.DataFrame` containing the adiabatic reference
277+ state profiles for each system, the last item being the combined
278+ adiabat.
287279 """
288280 if not reffile .is_file ():
289281 return None
@@ -489,14 +481,10 @@ def fields(fieldfile: Path) -> Optional[tuple[dict[str, Any], NDArray]]:
489481
490482 Args:
491483 fieldfile: path of the binary field file.
492- only_header: when True (and :data:`only_istep` is False), only
493- :data:`header` is returned.
494- only_istep: when True, only :data:`istep` is returned.
495484
496485 Returns:
497- the tuple :data:`(header, fields)`. :data:`fields` is an array of
498- scalar fields indexed by variable, x-direction, y-direction,
499- z-direction, block.
486+ the tuple `(header, fields)`. `fields` is an array of scalar fields
487+ indexed by variable, x-direction, y-direction, z-direction, block.
500488 """
501489 if not fieldfile .is_file ():
502490 return None
@@ -570,7 +558,7 @@ def tracers(tracersfile: Path) -> Optional[dict[str, list[NDArray]]]:
570558 """Extract tracers data.
571559
572560 Args:
573- tracersfile (:class:`pathlib.Path`) : path of the binary tracers file.
561+ tracersfile: path of the binary tracers file.
574562
575563 Returns:
576564 Tracers data organized by attribute names and blocks.
@@ -620,6 +608,7 @@ def _read_group_h5(filename: Path, groupname: str) -> NDArray:
620608 Args:
621609 filename: path of hdf5 file.
622610 groupname: name of group to read.
611+
623612 Returns:
624613 content of group.
625614 """
@@ -639,6 +628,7 @@ def _make_3d(field: NDArray, twod: Optional[str]) -> NDArray:
639628 Args:
640629 field: the field that needs to be 3d.
641630 twod: 'XZ', 'YZ' or None depending on what is relevant.
631+
642632 Returns:
643633 reshaped field.
644634 """
@@ -866,8 +856,9 @@ def read_geom_h5(xdmf: FieldXmf, snapshot: int) -> dict[str, Any]:
866856 """Extract geometry information from hdf5 files.
867857
868858 Args:
869- xdmf_file: path of the xdmf file.
859+ xdmf: xdmf file parser .
870860 snapshot: snapshot number.
861+
871862 Returns:
872863 geometry information.
873864 """
@@ -995,13 +986,14 @@ def read_field_h5(
995986 """Extract field data from hdf5 files.
996987
997988 Args:
998- xdmf_file: path of the xdmf file.
989+ xdmf: xdmf file parser .
999990 fieldname: name of field to extract.
1000991 snapshot: snapshot number.
1001992 header: geometry information.
993+
1002994 Returns:
1003995 geometry information and field data. None is returned if data is
1004- unavailable.
996+ unavailable.
1005997 """
1006998 if header is None :
1007999 header = read_geom_h5 (xdmf , snapshot )
@@ -1159,9 +1151,10 @@ def read_tracers_h5(xdmf: TracersXmf, infoname: str, snapshot: int) -> list[NDAr
11591151 """Extract tracers data from hdf5 files.
11601152
11611153 Args:
1162- xdmf_file: path of the xdmf file.
1154+ xdmf: xdmf file parser .
11631155 infoname: name of information to extract.
11641156 snapshot: snapshot number.
1157+
11651158 Returns:
11661159 Tracers data organized by attribute and block.
11671160 """
@@ -1181,6 +1174,7 @@ def read_time_h5(h5folder: Path) -> Iterator[tuple[int, int]]:
11811174
11821175 Args:
11831176 h5folder: directory of HDF5 output files.
1177+
11841178 Yields:
11851179 tuple (isnap, istep).
11861180 """
0 commit comments