Skip to content

Commit 775b28f

Browse files
committed
Correction on docstring
1 parent 70b7718 commit 775b28f

File tree

5 files changed

+72
-62
lines changed

5 files changed

+72
-62
lines changed

doc/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
"sphinx_gallery.gen_gallery",
3939
]
4040

41+
autoclass_content = 'both'
42+
4143
sphinx_gallery_conf = {
4244
"examples_dirs": "../examples", # path to your example scripts
4345
"gallery_dirs": "python_module",

notebooks/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
python setup.py install
12
python setup.py build_sphinx
2-
rsync -vrltp doc/python_module notebooks/. --include '*/' --include '*.ipynb' --exclude '*' --prune-empty-dirs
3+
rsync -vrltp doc/python_module notebooks/. --include '*/' --include '*.ipynb' --exclude '*' --prune-empty-dirs

src/py_eddy_tracker/dataset/grid.py

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,14 @@ class GridDataset(object):
295295
def __init__(
296296
self, filename, x_name, y_name, centered=None, indexs=None, unset=False
297297
):
298+
"""
299+
:param str filename: Filename to load
300+
:param str x_name: Name of longitude coordinates
301+
:param str y_name: Name of latitude coordinates
302+
:param bool,None centered: Allow to know how coordinates could be used with pixel
303+
:param dict indexs: A dictionary which set indexs to use for non-coordinate dimensions
304+
:param bool unset: Set to True to create an empty grid object without file
305+
"""
298306
self.dimensions = None
299307
self.variables_description = None
300308
self.global_attrs = None
@@ -457,11 +465,9 @@ def units(self, varname):
457465
def copy(self, grid_in, grid_out):
458466
"""
459467
Duplicate a variable
460-
Args:
461-
grid_in:
462-
grid_out:
463468
464-
Returns:
469+
:param grid_in:
470+
:param grid_out:
465471
466472
"""
467473
h_dict = self.variables_description[grid_in]
@@ -580,19 +586,22 @@ def eddy_identification(
580586
force_speed_unit=None,
581587
):
582588
"""
583-
584-
Args:
585-
grid_height:
586-
uname:
587-
vname:
588-
date:
589-
step: must be in meter (m)
590-
shape_error: must be in percent (%)
591-
sampling:
592-
pixel_limit:
593-
precision: must be in meter(m)
594-
595-
Returns:
589+
Compute eddy identification on specified grid
590+
591+
:param str grid_height: Grid name of height
592+
:param str uname: Grid name of u speed component
593+
:param str vname: Grid name of v speed component
594+
:param datetime.datetime date: Date which will be store in object to date data
595+
:param float,int step: Height between two layers in m
596+
:param float,int shape_error: Maximal error allow for outter contour in %
597+
:param int sampling: Sampling of contour and speed profile
598+
:param (int,int),None pixel_limit: Min and max of pixel which must be inside inner and outer contour to be considered like an eddy
599+
:param float,None precision: Truncate value at the defined precision in m
600+
:param str force_height_unit: Unit to used for height unit
601+
:param str force_speed_unit: Unit to used for speed unit
602+
603+
:return: Return a list of 2 elements: Anticyclone and Cyclone
604+
:rtype: py_eddy_tracker.observations.observation.EddiesObservations
596605
597606
"""
598607
if not isinstance(date, datetime):
@@ -1752,16 +1761,19 @@ def display(self, ax, name, factor=1, **kwargs):
17521761
def interp(self, grid_name, lons, lats):
17531762
"""
17541763
Compute z over lons, lats
1755-
Args:
1756-
grid_name: Grid which will be interp
1757-
lons: new x
1758-
lats: new y
17591764
1760-
Returns:
1761-
new z
1765+
:param str grid_name: Grid which will be interp
1766+
:param lons: new x
1767+
:param lats: new y
1768+
1769+
:return: new z
17621770
"""
17631771
g = self.grid(grid_name)
1764-
return interp2d_geo(self.x_c, self.y_c, g, g.mask, lons, lats)
1772+
if len(g.mask.shape):
1773+
m = g.mask
1774+
else:
1775+
m = ones(g.shape) if g.mask else zeros(g.shape)
1776+
return interp2d_geo(self.x_c, self.y_c, g, m, lons, lats)
17651777

17661778

17671779
@njit(cache=True, fastmath=True)

src/py_eddy_tracker/observations/observation.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -668,16 +668,15 @@ def propagate(
668668
):
669669
"""
670670
Filled virtual obs (C)
671-
Args:
672-
previous_obs: previous obs from current (A)
673-
current_obs: previous obs from virtual (B)
674-
obs_to_extend:
675-
dead_track:
676-
nb_next:
677-
model:
678-
679-
Returns:
680-
New position C = B + AB
671+
672+
:param previous_obs: previous obs from current (A)
673+
:param current_obs: previous obs from virtual (B)
674+
:param obs_to_extend:
675+
:param dead_track:
676+
:param nb_next:
677+
:param model:
678+
679+
:return: New position C = B + AB
681680
"""
682681
next_obs = VirtualEddiesObservations(
683682
size=nb_next,
@@ -742,12 +741,11 @@ def match(self, other, intern=False, cmin=0):
742741
@classmethod
743742
def cost_function_common_area(cls, xy_in, xy_out, distance, intern=False):
744743
""" How does it work on x bound ?
745-
Args:
746-
xy_in:
747-
xy_out:
748-
distance:
749-
intern:
750-
Returns:
744+
745+
:param xy_in:
746+
:param xy_out:
747+
:param distance:
748+
:param bool intern:
751749
752750
"""
753751
x_name, y_name = cls.intern(intern)

src/py_eddy_tracker/observations/tracking.py

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,8 @@ def set_global_attr_netcdf(self, h_nc):
161161
def extract_with_area(self, area, **kwargs):
162162
"""
163163
Extract with a bounding box
164-
Args:
165-
area: 4 coordinates in a dictionary to specify bounding box (lower left corner and upper right corner)
166-
**kwargs:
167164
168-
Returns:
165+
:param dict area: 4 coordinates in a dictionary to specify bounding box (lower left corner and upper right corner)
169166
170167
"""
171168
mask = (self.latitude > area["llcrnrlat"]) * (self.latitude < area["urcrnrlat"])
@@ -177,12 +174,10 @@ def extract_with_area(self, area, **kwargs):
177174
def extract_with_period(self, period, **kwargs):
178175
"""
179176
Extract with a period
180-
Args:
181-
period: two date to define period, must be specify from 1/1/1950
182-
**kwargs: directly give to __extract_with_mask
183177
184-
Returns:
185-
same object with selected data
178+
:param (datetime.datetime,datetime.datetime) period: two date to define period, must be specify from 1/1/1950
179+
180+
:return: same object with selected data
186181
"""
187182
dataset_period = self.period
188183
p_min, p_max = period
@@ -511,13 +506,14 @@ def compute_mask_from_id(tracks, first_index, number_of_obs, mask):
511506
def track_loess_filter(half_window, x, y, track):
512507
"""
513508
Apply a loess filter on y field
514-
Args:
515-
window: parameter of smoother
516-
x: must be growing for each track but could be irregular
517-
y: field to smooth
518-
track: field which allow to separate path
519509
520-
Returns:
510+
:param int,float window: parameter of smoother
511+
:param array_like x: must be growing for each track but could be irregular
512+
:param array_like y: field to smooth
513+
:param array_like track: field which allow to separate path
514+
515+
:return: Array smoothed
516+
:rtype: array_like
521517
522518
"""
523519
nb = y.shape[0]
@@ -555,13 +551,14 @@ def track_loess_filter(half_window, x, y, track):
555551
def track_median_filter(half_window, x, y, track):
556552
"""
557553
Apply a loess filter on y field
558-
Args:
559-
window: parameter of smoother
560-
x: must be growing for each track but could be irregular
561-
y: field to smooth
562-
track: field which allow to separate path
563554
564-
Returns:
555+
:param int,float half_window: parameter of smoother
556+
:param array_like x: must be growing for each track but could be irregular
557+
:param array_like y: field to smooth
558+
:param array_like track: field which allow to separate path
559+
560+
:return: Array smoothed
561+
:rtype: array_like
565562
566563
"""
567564
nb = y.shape[0]

0 commit comments

Comments
 (0)