We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aa6b122 commit dc39768Copy full SHA for dc39768
1 file changed
src/cchdo/hydro/discoverability.py
@@ -4,6 +4,25 @@
4
import xarray as xr
5
6
7
+def temporal(ds: xr.Dataset) -> xr.Dataset:
8
+ """Set the temporal extent global attributes
9
+
10
+ This includes:
11
+ * time_coverage_start
12
+ * time_coverage_end
13
+ """
14
+ ds_ = ds.copy()
15
16
+ fmt = "%Y-%m-%dT%H:%M:%SZ"
17
+ attrs = {
18
+ "time_coverage_start": ds_.time.min().dt.strftime(fmt).item(),
19
+ "time_coverage_end": ds_.time.max().dt.strftime(fmt).item(),
20
+ }
21
22
+ ds_.attrs.update(attrs)
23
+ return ds_
24
25
26
def geospatial(ds: xr.Dataset) -> xr.Dataset:
27
"""Set the geospatial extent global attributes
28
0 commit comments