Skip to content

Commit

Permalink
subset docstring edit (#364)
Browse files Browse the repository at this point in the history
* subset docstring edit

* black v24

---------

Co-authored-by: Philippe Miron <philippe.miron@dtn.com>
  • Loading branch information
selipot and Philippe Miron authored Jan 27, 2024
1 parent bd1037d commit 2dd835c
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 25 deletions.
12 changes: 6 additions & 6 deletions clouddrift/adapters/gdp1h.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,11 +601,11 @@ def to_raggedarray(
)

# set dynamic global attributes
ra.attrs_global[
"time_coverage_start"
] = f"{datetime(1970,1,1) + timedelta(seconds=int(np.min(ra.coords['time']))):%Y-%m-%d:%H:%M:%SZ}"
ra.attrs_global[
"time_coverage_end"
] = f"{datetime(1970,1,1) + timedelta(seconds=int(np.max(ra.coords['time']))):%Y-%m-%d:%H:%M:%SZ}"
ra.attrs_global["time_coverage_start"] = (
f"{datetime(1970,1,1) + timedelta(seconds=int(np.min(ra.coords['time']))):%Y-%m-%d:%H:%M:%SZ}"
)
ra.attrs_global["time_coverage_end"] = (
f"{datetime(1970,1,1) + timedelta(seconds=int(np.max(ra.coords['time']))):%Y-%m-%d:%H:%M:%SZ}"
)

return ra
12 changes: 6 additions & 6 deletions clouddrift/adapters/gdp6h.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,11 +488,11 @@ def to_raggedarray(
)

# update dynamic global attributes
ra.attrs_global[
"time_coverage_start"
] = f"{datetime(1970,1,1) + timedelta(seconds=int(np.min(ra.coords['time']))):%Y-%m-%d:%H:%M:%SZ}"
ra.attrs_global[
"time_coverage_end"
] = f"{datetime(1970,1,1) + timedelta(seconds=int(np.max(ra.coords['time']))):%Y-%m-%d:%H:%M:%SZ}"
ra.attrs_global["time_coverage_start"] = (
f"{datetime(1970,1,1) + timedelta(seconds=int(np.min(ra.coords['time']))):%Y-%m-%d:%H:%M:%SZ}"
)
ra.attrs_global["time_coverage_end"] = (
f"{datetime(1970,1,1) + timedelta(seconds=int(np.max(ra.coords['time']))):%Y-%m-%d:%H:%M:%SZ}"
)

return ra
1 change: 1 addition & 0 deletions clouddrift/adapters/glad.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
---------
Özgökmen, Tamay. 2013. GLAD experiment CODE-style drifter trajectories (low-pass filtered, 15 minute interval records), northern Gulf of Mexico near DeSoto Canyon, July-October 2012. Distributed by: Gulf of Mexico Research Initiative Information and Data Cooperative (GRIIDC), Harte Research Institute, Texas A&M University–Corpus Christi. doi:10.7266/N7VD6WC8
"""

from clouddrift.adapters.utils import download_with_progress
from io import BytesIO
import numpy as np
Expand Down
1 change: 1 addition & 0 deletions clouddrift/adapters/mosaic.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
>>> from clouddrift.adapters import mosaic
>>> ds = mosaic.to_xarray()
"""

from datetime import datetime
from io import BytesIO
import numpy as np
Expand Down
1 change: 1 addition & 0 deletions clouddrift/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
they will be downloaded from their upstream repositories and stored for later access
(~/.clouddrift for UNIX-based systems).
"""

from io import BufferedReader, BytesIO
from clouddrift import adapters
import os
Expand Down
1 change: 1 addition & 0 deletions clouddrift/pairs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Functions to analyze pairs of contiguous data segments.
"""

from clouddrift import ragged, sphere
from concurrent.futures import as_completed, ThreadPoolExecutor
import itertools
Expand Down
12 changes: 6 additions & 6 deletions clouddrift/ragged.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,17 +558,17 @@ def subset(
Parameters
----------
ds : xr.Dataset
Dataset stored as ragged arrays
Dataset stored as ragged arrays.
criteria : dict
dictionary containing the variables (as keys) and the ranges/values/functions (as values) to subset
Dictionary containing the variables (as keys) and the ranges/values/functions (as values) to subset.
id_var_name : str, optional
Name of the variable containing the ID of the trajectories (default is "id")
Name of the variable with dimension `traj_dim_name` containing the ID of the trajectories (default is "id").
rowsize_var_name : str, optional
Name of the variable containing the number of observations per trajectory (default is "rowsize")
Name of the variable containing the number of observations per trajectory (default is "rowsize").
traj_dim_name : str, optional
Name of the trajectory dimension (default is "traj")
Name of the trajectory dimension (default is "traj").
obs_dim_name : str, optional
Name of the observation dimension (default is "obs")
Name of the observation dimension (default is "obs").
full_trajectories : bool, optional
If True, it returns the complete trajectories (rows) where at least one observation
matches the criteria, rather than just the segments where the criteria are satisfied.
Expand Down
1 change: 1 addition & 0 deletions clouddrift/raggedarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
structure used by CloudDrift to process custom Lagrangian datasets to Xarray
Datasets and Awkward Arrays.
"""

import awkward as ak
from clouddrift.ragged import rowsize_to_index
import xarray as xr
Expand Down
9 changes: 2 additions & 7 deletions clouddrift/wavelet.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,7 @@ def morse_wavelet(
if normalization == "energy":
with np.errstate(divide="ignore"):
waveletzero = np.exp(
beta * np.log(norm_radian_frequency)
- norm_radian_frequency**gamma
beta * np.log(norm_radian_frequency) - norm_radian_frequency**gamma
)
elif normalization == "bandpass":
if beta == 0:
Expand Down Expand Up @@ -800,11 +799,7 @@ def morse_amplitude(
if normalization == "energy":
r = (2 * beta + 1) / gamma
amp = (
2
* np.pi
* gamma
* (2**r)
* np.exp(_lgamma(order) - _lgamma(order + r - 1))
2 * np.pi * gamma * (2**r) * np.exp(_lgamma(order) - _lgamma(order + r - 1))
) ** 0.5
elif normalization == "bandpass":
fm, _, _ = morse_freq(gamma, beta)
Expand Down

0 comments on commit 2dd835c

Please sign in to comment.