Skip to content

Commit

Permalink
fix docString
Browse files Browse the repository at this point in the history
  • Loading branch information
Sakshamgupta90 committed Jul 23, 2024
1 parent 09c7862 commit 0d3d811
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 45 deletions.
8 changes: 4 additions & 4 deletions ioos_qc/argo.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ def pressure_increasing_test(inp):
Ref: ARGO QC Manual: 8. Pressure increasing test
Args:
Args
----
inp: Pressure values as a numeric numpy array or a list of numbers.
Returns:
Returns
-------
A masked array of flag values equal in size to that of the input.
Expand Down Expand Up @@ -72,7 +72,7 @@ def speed_test(
Ref: ARGO QC Manual: 5. Impossible speed test
Args:
Args
----
lon: Longitudes as a numeric numpy array or a list of numbers.
lat: Latitudes as a numeric numpy array or a list of numbers.
Expand All @@ -85,7 +85,7 @@ def speed_test(
fail_threshold: A float value representing a speed, in meters per second.
Speeds exceeding this will be flagged as FAIL.
Returns:
Returns
-------
A masked array of flag values equal in size to that of the input.
Expand Down
4 changes: 2 additions & 2 deletions ioos_qc/axds.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def valid_range_test(
treated as inclusive and the second span valid is treated as exclusive. To change this
behavior you can use the parameters `start_inclusive` and `end_inclusive`.
Args:
Args
----
inp (Sequence[any]): Data as a sequence of objects compatible with the fail_span objects
fail_span (Tuple[any, any]): 2-tuple range which to flag outside data as FAIL. Objects
Expand All @@ -52,7 +52,7 @@ def valid_range_test(
end_inclusive (bool): Optional. If the ending span value should be inclusive (True) or
exclusive (False).
Returns:
Returns
-------
np.ma.core.MaskedArray: A masked array of flag values equal in size to that of the input.
Expand Down
12 changes: 6 additions & 6 deletions ioos_qc/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def run(self, **passedkwargs):
def extract_calls(source) -> List[Call]:
"""Extracts call objects from a source object.
Args:
Args
----
source ([any]): The source of Call objects, this can be a:
* Call object
Expand All @@ -191,7 +191,7 @@ def extract_calls(source) -> List[Call]:
* NewConfig object
* Object with the 'calls' attribute
Returns:
Returns
-------
List[Call]: List of extracted Call objects
Expand Down Expand Up @@ -234,7 +234,7 @@ def __init__(
version=None,
default_stream_key="_stream",
) -> None:
"""Args:
"""Args
----
source: The QC configuration representation in one of the following formats:
python dict or odict
Expand Down Expand Up @@ -349,7 +349,7 @@ def add(self, source) -> None:
types of objects accepted as the source parameter. The changes the internal .calls
attribute and returns None.
Args:
Args
----
source ([any]): The source of Call objects, this can be a:
* Call object
Expand Down Expand Up @@ -489,7 +489,7 @@ def add(self, source) -> None:
types of objects accepted as the source parameter. The changes the internal .calls
attribute and returns None.
Args:
Args
----
source ([any]): The source of Call objects, this can be a:
* Call object
Expand Down Expand Up @@ -522,7 +522,7 @@ def __init__(self, source, default_stream_key="_stream") -> None:
stream. This just sets up a stream with the name passed in as the "default_stream_key"
parameter.
Args:
Args
----
source: The QC configuration representation in one of the following formats:
python dict or odict
Expand Down
10 changes: 5 additions & 5 deletions ioos_qc/config_creator/config_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def __str__(self) -> str:
class QcVariableConfig(dict):
"""Used to generate a QcConfig for a specific variable.
Args:
Args
----
path_or_dict: QcVariableConfig configuration, one of the following formats:
python dict
Expand Down Expand Up @@ -253,11 +253,11 @@ def __str__(self) -> str:
class QcConfigCreator:
"""Creates level-0 configuration to create QcQonfig.
Arguments:
Arguments
---------
creator_config (QcCreatorConfig): Configuration for datasets and variables used to create qc_config.
Attributes:
Attributes
----------
allowed_stats (list): Specific statistics allowed to be used to configure each test.
allowed_operators (list): Operators allowed to used to configure each test.
Expand All @@ -272,11 +272,11 @@ def __init__(self, creator_config) -> None:
def create_config(self, variable_config):
"""Create QARTOD QC config given QcVariableConfig.
Args:
Args
----
variable_config (QcVariableConfig): Config for variable to be quality controlled
Returns:
Returns
-------
qc_config (dict): Config for ioos_qc
Expand Down
53 changes: 26 additions & 27 deletions ioos_qc/qartod.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ def qartod_compare(
) -> np.ma.MaskedArray:
"""Aggregates an array of flags by precedence into a single array.
Args:
Args
----
vectors: An array of uniform length arrays representing individual flags
Returns:
Returns
-------
A masked array of aggregated flag data.
Expand Down Expand Up @@ -114,14 +114,14 @@ def location_test(
also use a unit from the quantities library. Missing and masked data is
flagged as UNKNOWN.
Args:
Args
----
lon: Longitudes as a numeric numpy array or a list of numbers.
lat: Latitudes as a numeric numpy array or a list of numbers.
bbox: A length 4 tuple expressed in (minx, miny, maxx, maxy) [optional].
range_max: Maximum allowed range expressed in geodesic curve distance (meters).
Returns:
Returns
-------
A masked array of flag values equal in size to that of the input.
Expand Down Expand Up @@ -192,13 +192,13 @@ def gross_range_test(
range as FAIL data. Optionally also flag data which falls outside of a user
defined range as SUSPECT. Missing and masked data is flagged as UNKNOWN.
Args:
Args
----
inp: Input data as a numeric numpy array or a list of numbers.
fail_span: 2-tuple range which to flag outside data as FAIL.
suspect_span: 2-tuple range which to flag outside data as SUSPECT. [optional]
Returns:
Returns
-------
A masked array of flag values equal in size to that of the input.
Expand Down Expand Up @@ -241,7 +241,7 @@ def gross_range_test(
class ClimatologyConfig:
"""Objects to hold the config for a Climatology test.
Args:
Args
----
tspan: 2-tuple range.
If period is defined, then this is a numeric range.
Expand Down Expand Up @@ -283,7 +283,7 @@ def members(self):
return self._members

def values(self, tind: pd.Timestamp, zind=None):
"""Args:
"""Args
----
tind: Value to test for inclusion between time bounds
Expand Down Expand Up @@ -469,7 +469,7 @@ def climatology_test(
Data for which no ClimatologyConfig member exists is marked as UNKNOWN.
Args:
Args
----
config: A ClimatologyConfig object or a list of dicts containing tuples
that can be used to create a ClimatologyConfig object. See ClimatologyConfig
Expand All @@ -481,7 +481,7 @@ def climatology_test(
If anything else is passed in the format is assumed to be seconds since the unix epoch.
zinp: Z (depth) data, in meters positive down, as a numeric numpy array or a list of numbers.
Returns:
Returns
-------
A masked array of flag values equal in size to that of the input.
Expand Down Expand Up @@ -520,7 +520,7 @@ def spike_test(
method: str = "average",
) -> np.ma.core.MaskedArray:
"""Check for spikes by checking neighboring data against thresholds.
Determine if there is a spike at data point n-1 by subtracting
the midpoint of n and n-2 and taking the absolute value of this
quantity, and checking if it exceeds a low or high threshold (default).
Expand All @@ -529,21 +529,20 @@ def spike_test(
and values which exceed the high threshold are flagged FAIL.
Missing and masked data is flagged as UNKNOWN.
Args:
Args
----
inp: Input data as a numeric numpy array or a list of numbers.
suspect_threshold: The SUSPECT threshold value, in observations units.
fail_threshold: The SUSPECT threshold value, in observations units.
method: ['average'(default),'differential'] optional input to assign the method used to detect spikes.
* "average": Determine if there is a spike at data point n-1 by subtracting
the midpoint of n and n-2 and taking the absolute value of this
quantity, and checking if it exceeds a low or high threshold.
-
the midpoint of n and n-2 and taking the absolute value of this
quantity, and checking if it exceeds a low or high threshold.
* "differential": Determine if there is a spike at data point n by calculating the difference
between n and n-1 and n+1 and n variation. To considered, (n - n-1)*(n+1 - n) should
be smaller than zero (in opposite direction).
between n and n-1 and n+1 and n variation. To considered, (n - n-1)*(n+1 - n) should
be smaller than zero (in opposite direction).
Returns:
Returns
-------
A masked array of flag values equal in size to that of the input.
Expand Down Expand Up @@ -620,17 +619,17 @@ def rate_of_change_test(
exceed. Threshold is expressed as a rate in observations units per second.
Missing and masked data is flagged as UNKNOWN.
Args:
Args
----
inp: Input data as a numeric numpy array or a list of numbers.
tinp: Time data as a sequence of datetime objects compatible with pandas DatetimeIndex.
This includes numpy datetime64, python datetime objects and pandas Timestamp object.
ie. pd.DatetimeIndex([datetime.utcnow(), np.datetime64(), pd.Timestamp.now()]
ie. pd.DatetimeIndex([datetime.utcnow(), np.datetime64(), pd.Timestamp.now()])
If anything else is passed in the format is assumed to be seconds since the unix epoch.
threshold: A float value representing a rate of change over time,
in observation units per second.
Returns:
Returns
-------
A masked array of flag values equal in size to that of the input.
Expand Down Expand Up @@ -678,7 +677,7 @@ def flat_line_test(
Missing and masked data is flagged as UNKNOWN.
More information: https://github.com/ioos/ioos_qc/pull/11.
Args:
Args
----
inp: Input data as a numeric numpy array or a list of numbers.
tinp: Time data as a sequence of datetime objects compatible with pandas DatetimeIndex.
Expand All @@ -694,7 +693,7 @@ def flat_line_test(
point `n`, and calculate the range of values in the window. If that range is less than `tolerance`,
then the point is flagged.
Returns:
Returns
-------
A masked array of flag values equal in size to that of the input.
Expand Down Expand Up @@ -778,7 +777,7 @@ def attenuated_signal_test(
Missing and masked data is flagged as UNKNOWN.
Args:
Args
----
inp: Input data as a numeric numpy array or a list of numbers.
tinp: Time input data as a numpy array of dtype `datetime64`.
Expand All @@ -797,7 +796,7 @@ def attenuated_signal_test(
check_type: Either 'std' (default) or 'range', depending on the type of check
you wish to perform.
Returns:
Returns
-------
A masked array of flag values equal in size to that of the input.
This array will always contain only a single unique value since all
Expand Down Expand Up @@ -882,7 +881,7 @@ def density_inversion_test(
Ref: Manual for Real-Time Quality Control of in-situ Temperature and Salinity Data, Version 2.0, January 2016
Args:
Args
----
inp: Potential density values as a numeric numpy array or a list of numbers.
zinp: Corresponding depth/pressure values for each density.
Expand All @@ -891,7 +890,7 @@ def density_inversion_test(
fail_threshold: A float value representing a maximum potential density(or sigma0)
variation to be tolerated, downward density variation exceeding this will be flagged as FAIL.
Returns:
Returns
-------
A masked array of flag values equal in size to that of the input.
Expand Down
2 changes: 1 addition & 1 deletion ioos_qc/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def check_timestamps(
proper order and optionally do not have large gaps prior to processing the
data.
Args:
Args
----
times: Input array of timestamps
max_time_interval: The interval between values should not exceed this
Expand Down

0 comments on commit 0d3d811

Please sign in to comment.