@@ -280,12 +280,22 @@ def set_crs(self, crs) -> xr.Dataset:
280
280
return ds
281
281
282
282
@abstractmethod
283
- def is_1d (self ):
284
- """Returns True if dataset is 1D, i.e. time is a 1D coordinate variable."""
283
+ def is_1d (self ) -> bool :
284
+ """Returns True if dataset is 1D, i.e. time is a 1D coordinate variable.
285
+
286
+ Returns
287
+ -------
288
+ bool
289
+ """
285
290
286
291
@abstractmethod
287
- def is_2d (self ):
288
- """Returns True if dataset is 2D, i.e. time is a 2D variable and not a coordinate variable."""
292
+ def is_2d (self ) -> bool :
293
+ """Returns True if dataset is 2D, i.e. time is a 2D variable and not a coordinate variable.
294
+
295
+ Returns
296
+ -------
297
+ bool
298
+ """
289
299
290
300
def assign_cf_attrs (self ,
291
301
creator_name = None ,
@@ -396,8 +406,8 @@ def time_to_next(self) -> pd.Timedelta:
396
406
397
407
Returns
398
408
-------
399
- xarray. DataArray
400
- Scalar timedelta for 1D objects, and DataArray of same size as input for 2D objects
409
+ DataArray
410
+ Scalar timedelta for 1D objects (fixed timestep) , and DataArray of same size as input for 2D objects
401
411
402
412
See Also
403
413
--------
@@ -418,13 +428,18 @@ def distance_to(self, other) -> xr.Dataset:
418
428
419
429
Parameters
420
430
----------
421
- other : xarray.DataSet
431
+ other : Dataset
422
432
Other dataset to which distance is calculated
423
433
424
434
Returns
425
435
-------
426
- xarray.Dataset
427
- Same dimensions as original dataset
436
+ Dataset
437
+ Same dimensions as original dataset, containing three DataArrays from pyproj.geod.inv:
438
+ distance : distance [meters]
439
+
440
+ az_fwd : forward azimuth angle [degrees]
441
+
442
+ az_bwd : backward azimuth angle [degrees]
428
443
429
444
See Also
430
445
--------
@@ -456,18 +471,18 @@ def distance_to(self, other) -> xr.Dataset:
456
471
return ds
457
472
458
473
def distance_to_next (self ):
459
- """Returns distance in m from one position to the next.
474
+ """Returns distance in meters from one position to the next along trajectories .
460
475
461
- Last time is repeated for last position (which has no next position)
476
+ Last time is repeated for last position (which has no next position).
462
477
463
478
Returns
464
479
-------
465
- xarray. DataArray
466
- Same dimensions as original dataset , since last value is repeated along time dimension
480
+ DataArray
481
+ Same dimensions as original Dataset , since last value is repeated along time dimension.
467
482
468
483
See Also
469
484
--------
470
- time_to_next, speed
485
+ azimuth_to_next, time_to_next, speed
471
486
472
487
"""
473
488
@@ -490,7 +505,16 @@ def distance_to_next(self):
490
505
def azimuth_to_next (self ):
491
506
"""Returns azimution travel direction in degrees from one position to the next.
492
507
493
- Last time is repeated for last position (which has no next position)
508
+ Last time is repeated for last position (which has no next position).
509
+
510
+ Returns
511
+ -------
512
+ DataArray
513
+ Same dimensions as original Dataset, since last value is repeated along time dimension.
514
+
515
+ See Also
516
+ --------
517
+ distance_to_next, time_to_next, speed
494
518
"""
495
519
496
520
# TODO: method is almost duplicate of "distance_to_next" above
@@ -516,7 +540,12 @@ def azimuth_to_next(self):
516
540
def velocity_components (self ):
517
541
"""Returns velocity components [m/s] from one position to the next.
518
542
519
- Last time is repeated for last position (which has no next position)
543
+ Last time is repeated for last position (which has no next position)
544
+
545
+ Returns
546
+ -------
547
+ (u, v) : array_like
548
+ East and north components of velocities at given position along trajectories.
520
549
"""
521
550
speed = self .speed ()
522
551
azimuth = self .azimuth_to_next ()
@@ -557,7 +586,7 @@ def convex_hull_contains_point(self, lon, lat):
557
586
558
587
Parameters
559
588
----------
560
- lon, lat scalars
589
+ lon, lat : scalar
561
590
longitude and latitude [degrees] of a position.
562
591
563
592
Returns
@@ -575,7 +604,13 @@ def convex_hull_contains_point(self, lon, lat):
575
604
return p .contains_points (point )[0 ]
576
605
577
606
def get_area_convex_hull (self ):
578
- """Return the area [m2] of the convex hull spanned by all particles."""
607
+ """Return the area [m2] of the convex hull spanned by all positions.
608
+
609
+ Returns
610
+ -------
611
+ scalar
612
+ Area [m2] of convex hull around all positions.
613
+ """
579
614
580
615
from scipy .spatial import ConvexHull
581
616
@@ -621,7 +656,13 @@ def gridtime(self, times, timedim = None) -> xr.Dataset:
621
656
622
657
@abstractmethod
623
658
def seltime (self , t0 = None , t1 = None ) -> xr .Dataset :
624
- """ Select observations in time window between `t0` and `t1` (inclusive). """
659
+ """ Select observations in time window between `t0` and `t1` (inclusive).
660
+
661
+ Parameters
662
+ ----------
663
+ t0, t1 : numpy.datetime64
664
+ Test
665
+ """
625
666
626
667
627
668
@abstractmethod
0 commit comments