Skip to content

Commit d05c59f

Browse files
authored
velin docstring fixes (#168)
1 parent 19b5d20 commit d05c59f

File tree

3 files changed

+27
-34
lines changed

3 files changed

+27
-34
lines changed

cf_xarray/accessor.py

Lines changed: 24 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,9 @@ def _get_groupby_time_accessor(var: Union[DataArray, Dataset], key: str) -> List
222222
223223
Parameters
224224
----------
225-
var: DataArray, Dataset
225+
var : DataArray, Dataset
226226
DataArray belonging to the coordinate to be checked
227-
key: str, [e.g. "T.month"]
227+
key : str, [e.g. "T.month"]
228228
key to check for.
229229
230230
Returns
@@ -255,14 +255,14 @@ def _get_axis_coord(var: Union[DataArray, Dataset], key: str) -> List[str]:
255255
256256
Parameters
257257
----------
258-
var: DataArray, Dataset
258+
var : DataArray, Dataset
259259
DataArray belonging to the coordinate to be checked
260-
key: str, ["X", "Y", "Z", "T", "longitude", "latitude", "vertical", "time"]
260+
key : str, ["X", "Y", "Z", "T", "longitude", "latitude", "vertical", "time"]
261261
key to check for.
262-
error: bool
262+
error : bool
263263
raise errors when key is not found or interpretable. Use False and provide default
264264
to replicate dict.get(k, None).
265-
default: Any
265+
default : Any
266266
default value to return when error is False.
267267
268268
Returns
@@ -330,9 +330,9 @@ def _get_measure(obj: Union[DataArray, Dataset], key: str) -> List[str]:
330330
331331
Parameters
332332
----------
333-
obj: DataArray, Dataset
333+
obj : DataArray, Dataset
334334
DataArray belonging to the coordinate to be checked
335-
key: str
335+
key : str
336336
key to check for.
337337
338338
Returns
@@ -471,18 +471,17 @@ def _getattr(
471471
472472
Parameters
473473
----------
474-
475474
obj : DataArray, Dataset
476475
attr : Name of attribute in obj that will be shadowed.
477476
accessor : High level accessor object: CFAccessor
478477
key_mappers : dict
479478
dict(key_name: mapper)
480-
wrap_classes: bool
479+
wrap_classes : bool
481480
Should we wrap the return value with _CFWrappedClass?
482481
Only True for the high level CFAccessor.
483482
Facilitates code reuse for _CFWrappedClass and _CFWrapppedPlotMethods
484483
For both of those, wrap_classes is False.
485-
extra_decorator: Callable (optional)
484+
extra_decorator : Callable (optional)
486485
An extra decorator, if necessary. This is used by _CFPlotMethods to set default
487486
kwargs based on CF attributes.
488487
"""
@@ -555,9 +554,9 @@ def _getitem(
555554
556555
Parameters
557556
----------
558-
accessor: CFAccessor
559-
key: str, List[str]
560-
skip: str, optional
557+
accessor : CFAccessor
558+
key : str, List[str]
559+
skip : str, optional
561560
One of ["coords", "measures"], avoid clashes with special coord names
562561
"""
563562

@@ -889,12 +888,12 @@ def _rewrite_values(
889888
890889
Parameters
891890
----------
892-
kwargs: Mapping
891+
kwargs : Mapping
893892
Mapping from kwarg name to value
894-
key_mappers: Mapping
893+
key_mappers : Mapping
895894
Mapping from kwarg name to a Mapper function that will convert a
896895
given CF "special" name to an xarray name.
897-
var_kws: List[str]
896+
var_kws : List[str]
898897
List of variable kwargs that need special treatment.
899898
e.g. **indexers_kwargs in isel
900899
@@ -1188,8 +1187,7 @@ def standard_names(self) -> Dict[str, List[str]]:
11881187
11891188
Parameters
11901189
----------
1191-
1192-
obj: DataArray, Dataset
1190+
obj : DataArray, Dataset
11931191
Xarray object to process
11941192
11951193
Returns
@@ -1222,14 +1220,10 @@ def get_associated_variable_names(
12221220
12231221
Parameters
12241222
----------
1225-
1226-
name: Hashable
1227-
1228-
skip_bounds: bool, optional
1229-
1223+
name : Hashable
1224+
skip_bounds : bool, optional
12301225
Returns
12311226
------
1232-
12331227
Dict with keys "ancillary_variables", "cell_measures", "coordinates", "bounds"
12341228
"""
12351229
keys = ["ancillary_variables", "cell_measures", "coordinates", "bounds"]
@@ -1306,7 +1300,7 @@ def rename_like(
13061300
13071301
Parameters
13081302
----------
1309-
other: DataArray, Dataset
1303+
other : DataArray, Dataset
13101304
Variables will be renamed to match variable names in this xarray object
13111305
13121306
Returns
@@ -1351,7 +1345,7 @@ def guess_coord_axis(self, verbose: bool = False) -> Union[DataArray, Dataset]:
13511345
13521346
Parameters
13531347
----------
1354-
verbose: bool
1348+
verbose : bool
13551349
Print extra info to screen
13561350
13571351
Returns
@@ -1420,7 +1414,7 @@ def get_bounds(self, key: str) -> DataArray:
14201414
14211415
Parameters
14221416
----------
1423-
key: str
1417+
key : str
14241418
Name of variable whose bounds are desired
14251419
14261420
Returns
@@ -1462,7 +1456,7 @@ def add_bounds(self, dims: Union[Hashable, Iterable[Hashable]]):
14621456
14631457
Parameters
14641458
----------
1465-
dims: Hashable or Iterable[Hashable]
1459+
dims : Hashable or Iterable[Hashable]
14661460
Either a single dimension name or a list of dimension names.
14671461
14681462
Returns
@@ -1584,7 +1578,7 @@ def decode_vertical_coords(self, prefix="z"):
15841578
15851579
Parameters
15861580
----------
1587-
prefix: str, optional
1581+
prefix : str, optional
15881582
Prefix for newly created z variables.
15891583
E.g. ``s_rho`` becomes ``z_rho``
15901584
@@ -1594,7 +1588,6 @@ def decode_vertical_coords(self, prefix="z"):
15941588
15951589
Notes
15961590
-----
1597-
15981591
Will only decode when the ``formula_terms`` and ``standard_name`` attributes
15991592
are set on the parameter (e.g ``s_rho`` )
16001593

cf_xarray/helpers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def bounds_to_vertices(
1717
1818
Parameters
1919
----------
20-
bounds: DataArray
20+
bounds : DataArray
2121
The bounds to convert. Must be of shape (N, 2) or (N, M, 4).
2222
bounds_dim : str
2323
The name of the bounds dimension of `bounds` (the one of length 2 or 4).
@@ -93,7 +93,7 @@ def vertices_to_bounds(
9393
9494
Parameters
9595
----------
96-
bounds: DataArray
96+
bounds : DataArray
9797
The bounds to convert. Must be of shape (N, 2) or (N, M, 4).
9898
out_dims : Sequence[str],
9999
The name of the dimension in the output. The first is the 'bounds'

cf_xarray/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def parse_cell_methods_attr(attr: str) -> Dict[str, str]:
2929
3030
Parameters
3131
----------
32-
attr: str
32+
attr : str
3333
String to parse
3434
3535
Returns

0 commit comments

Comments
 (0)