Skip to content

Commit 4a6b0c2

Browse files
committed
2 parents 4e70fe7 + 9a71274 commit 4a6b0c2

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ git clone https://github.com/hapi-server/client-python
8888
cd client-python; pip install -e .
8989
```
9090

91-
or, create an isolated Anaconda installation (downloads and installs latested Miniconda3) using
91+
or, create an isolated Anaconda installation (downloads and installs latest Miniconda3) using
9292

9393
``` bash
9494
make install PYTHON=python3.6

hapiclient/hapitime.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ def hapitime_reformat(form_to_match, given_form, logging=False):
3535
Examples
3636
--------
3737
::
38-
39-
hapitime_format_str('1989Z', '1989-01Z') # 1989Z
40-
hapitime_format_str('1989-001T00:00Z', '1999-01-21Z') # 1999-021T00:00Z
38+
from hapiclient.hapitime import hapitime_reformat
39+
hapitime_reformat('1989Z', '1989-01Z') # 1989Z
40+
hapitime_reformat('1989-001T00:00Z', '1999-01-21Z') # 1999-021T00:00Z
4141
4242
"""
4343

@@ -93,7 +93,15 @@ def hapitime_reformat(form_to_match, given_form, logging=False):
9393

9494

9595
def hapitime_format_str(Time):
96-
"""Determine the time format string for a HAPI time."""
96+
"""Determine the time format string for a HAPI time.
97+
Examples
98+
--------
99+
::
100+
from hapiclient.hapitime import hapitime_reformat
101+
hapitime_format_str(['1989Z']) # %YZ
102+
hapitime_format_str(['1989-347Z']) # %Y-%jZ
103+
hapitime_format_str(['2002-03-04T05:06Z']) # '%Y-%m-%dT%H:%MZ'
104+
"""
97105

98106
d = 0
99107
# Catch case where no trailing Z
@@ -200,10 +208,10 @@ def hapitime2datetime(Time, **kwargs):
200208
201209
::
202210
203-
from hapiclient.time import hapitime2datetime
211+
from hapiclient.hapitime import hapitime2datetime
204212
import numpy as np
205213
206-
hapitime2datetime(np.array([b'1970-01-01T00:00:00.000Z']))
214+
hapitime2datetime(np.array([b'1970-01-01T00:00:00.000Z'])) # array([datetime.datetime(1970, 1, 1, 0, 0, tzinfo=<UTC>)], dtype=object)
207215
hapitime2datetime(np.array(['1970-01-01T00:00:00.000Z']))
208216
209217
hapitime2datetime([b'1970-01-01T00:00:00.000Z'])
@@ -320,4 +328,4 @@ def hapitime2datetime(Time, **kwargs):
320328
if reshape:
321329
pythonDateTime = np.reshape(pythonDateTime, shape)
322330

323-
return pythonDateTime
331+
return pythonDateTime

0 commit comments

Comments
 (0)