Skip to content

Commit

Permalink
Correction on docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
AntSimi committed Sep 16, 2020
1 parent 70b7718 commit 775b28f
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 62 deletions.
2 changes: 2 additions & 0 deletions doc/conf.py
Expand Up @@ -38,6 +38,8 @@
"sphinx_gallery.gen_gallery",
]

autoclass_content = 'both'

sphinx_gallery_conf = {
"examples_dirs": "../examples", # path to your example scripts
"gallery_dirs": "python_module",
Expand Down
3 changes: 2 additions & 1 deletion notebooks/README.md
@@ -1,2 +1,3 @@
python setup.py install
python setup.py build_sphinx
rsync -vrltp doc/python_module notebooks/. --include '*/' --include '*.ipynb' --exclude '*' --prune-empty-dirs
rsync -vrltp doc/python_module notebooks/. --include '*/' --include '*.ipynb' --exclude '*' --prune-empty-dirs
60 changes: 36 additions & 24 deletions src/py_eddy_tracker/dataset/grid.py
Expand Up @@ -295,6 +295,14 @@ class GridDataset(object):
def __init__(
self, filename, x_name, y_name, centered=None, indexs=None, unset=False
):
"""
:param str filename: Filename to load
:param str x_name: Name of longitude coordinates
:param str y_name: Name of latitude coordinates
:param bool,None centered: Allow to know how coordinates could be used with pixel
:param dict indexs: A dictionary which set indexs to use for non-coordinate dimensions
:param bool unset: Set to True to create an empty grid object without file
"""
self.dimensions = None
self.variables_description = None
self.global_attrs = None
Expand Down Expand Up @@ -457,11 +465,9 @@ def units(self, varname):
def copy(self, grid_in, grid_out):
"""
Duplicate a variable
Args:
grid_in:
grid_out:
Returns:
:param grid_in:
:param grid_out:
"""
h_dict = self.variables_description[grid_in]
Expand Down Expand Up @@ -580,19 +586,22 @@ def eddy_identification(
force_speed_unit=None,
):
"""
Args:
grid_height:
uname:
vname:
date:
step: must be in meter (m)
shape_error: must be in percent (%)
sampling:
pixel_limit:
precision: must be in meter(m)
Returns:
Compute eddy identification on specified grid
:param str grid_height: Grid name of height
:param str uname: Grid name of u speed component
:param str vname: Grid name of v speed component
:param datetime.datetime date: Date which will be store in object to date data
:param float,int step: Height between two layers in m
:param float,int shape_error: Maximal error allow for outter contour in %
:param int sampling: Sampling of contour and speed profile
: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
:param float,None precision: Truncate value at the defined precision in m
:param str force_height_unit: Unit to used for height unit
:param str force_speed_unit: Unit to used for speed unit
:return: Return a list of 2 elements: Anticyclone and Cyclone
:rtype: py_eddy_tracker.observations.observation.EddiesObservations
"""
if not isinstance(date, datetime):
Expand Down Expand Up @@ -1752,16 +1761,19 @@ def display(self, ax, name, factor=1, **kwargs):
def interp(self, grid_name, lons, lats):
"""
Compute z over lons, lats
Args:
grid_name: Grid which will be interp
lons: new x
lats: new y
Returns:
new z
:param str grid_name: Grid which will be interp
:param lons: new x
:param lats: new y
:return: new z
"""
g = self.grid(grid_name)
return interp2d_geo(self.x_c, self.y_c, g, g.mask, lons, lats)
if len(g.mask.shape):
m = g.mask
else:
m = ones(g.shape) if g.mask else zeros(g.shape)
return interp2d_geo(self.x_c, self.y_c, g, m, lons, lats)


@njit(cache=True, fastmath=True)
Expand Down
30 changes: 14 additions & 16 deletions src/py_eddy_tracker/observations/observation.py
Expand Up @@ -668,16 +668,15 @@ def propagate(
):
"""
Filled virtual obs (C)
Args:
previous_obs: previous obs from current (A)
current_obs: previous obs from virtual (B)
obs_to_extend:
dead_track:
nb_next:
model:
Returns:
New position C = B + AB
:param previous_obs: previous obs from current (A)
:param current_obs: previous obs from virtual (B)
:param obs_to_extend:
:param dead_track:
:param nb_next:
:param model:
:return: New position C = B + AB
"""
next_obs = VirtualEddiesObservations(
size=nb_next,
Expand Down Expand Up @@ -742,12 +741,11 @@ def match(self, other, intern=False, cmin=0):
@classmethod
def cost_function_common_area(cls, xy_in, xy_out, distance, intern=False):
""" How does it work on x bound ?
Args:
xy_in:
xy_out:
distance:
intern:
Returns:
:param xy_in:
:param xy_out:
:param distance:
:param bool intern:
"""
x_name, y_name = cls.intern(intern)
Expand Down
39 changes: 18 additions & 21 deletions src/py_eddy_tracker/observations/tracking.py
Expand Up @@ -161,11 +161,8 @@ def set_global_attr_netcdf(self, h_nc):
def extract_with_area(self, area, **kwargs):
"""
Extract with a bounding box
Args:
area: 4 coordinates in a dictionary to specify bounding box (lower left corner and upper right corner)
**kwargs:
Returns:
:param dict area: 4 coordinates in a dictionary to specify bounding box (lower left corner and upper right corner)
"""
mask = (self.latitude > area["llcrnrlat"]) * (self.latitude < area["urcrnrlat"])
Expand All @@ -177,12 +174,10 @@ def extract_with_area(self, area, **kwargs):
def extract_with_period(self, period, **kwargs):
"""
Extract with a period
Args:
period: two date to define period, must be specify from 1/1/1950
**kwargs: directly give to __extract_with_mask
Returns:
same object with selected data
:param (datetime.datetime,datetime.datetime) period: two date to define period, must be specify from 1/1/1950
:return: same object with selected data
"""
dataset_period = self.period
p_min, p_max = period
Expand Down Expand Up @@ -511,13 +506,14 @@ def compute_mask_from_id(tracks, first_index, number_of_obs, mask):
def track_loess_filter(half_window, x, y, track):
"""
Apply a loess filter on y field
Args:
window: parameter of smoother
x: must be growing for each track but could be irregular
y: field to smooth
track: field which allow to separate path
Returns:
:param int,float window: parameter of smoother
:param array_like x: must be growing for each track but could be irregular
:param array_like y: field to smooth
:param array_like track: field which allow to separate path
:return: Array smoothed
:rtype: array_like
"""
nb = y.shape[0]
Expand Down Expand Up @@ -555,13 +551,14 @@ def track_loess_filter(half_window, x, y, track):
def track_median_filter(half_window, x, y, track):
"""
Apply a loess filter on y field
Args:
window: parameter of smoother
x: must be growing for each track but could be irregular
y: field to smooth
track: field which allow to separate path
Returns:
:param int,float half_window: parameter of smoother
:param array_like x: must be growing for each track but could be irregular
:param array_like y: field to smooth
:param array_like track: field which allow to separate path
:return: Array smoothed
:rtype: array_like
"""
nb = y.shape[0]
Expand Down

0 comments on commit 775b28f

Please sign in to comment.