-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bazefetcher source #27
Conversation
camille/source/bazefetcher.py
Outdated
|
||
|
||
def _read_json_gz(fn): | ||
with gzip.GzipFile(fn, 'r') as f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this crash if fn does not exist?
camille/source/bazefetcher.py
Outdated
raise ValueError('{} is not a directory'.format(root)) | ||
|
||
if not isinstance(tzinfo, datetime.tzinfo): | ||
raise ValueError('tzinfo must be instance of datetime.tzinfo') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe let pandas itself figure out if it accepts tzinfo or not.
camille/source/bazefetcher.py
Outdated
raise ValueError( | ||
'start_date and end_date parameters must be of type date') | ||
|
||
if not start_date.tzinfo or not end_date.tzinfo: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is not None
@@ -0,0 +1,73 @@ | |||
#!/usr/bin/env python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
env python3
2c8af86
to
7f49fcc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small suggestions, then ready to merge
camille/source/bazefetcher.py
Outdated
# File names are on the form: | ||
# |- start_date ----------| |- end_date ------------| | ||
# tag_YYYY-MM-DDTHH.MM.SS+HH.MM_YYYY-MM-DDTHH.MM.SS+HH.MM.json.gz | ||
date_str = fn[len(tag)+1:-34] # Slice out the start date |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps better to split on underscore?
tests/source/test_bazefetcher.py
Outdated
def test_bazefetcher(): | ||
tag2 = bazefield('installation-04-tag-2', start_date, end_date) | ||
assert (1.100000e+32 < tag2).all() | ||
assert (tag2 < 1.300000e+32).all() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could also check count
144be10
to
ad25cad
Compare
Add bazefetcher source function that reads baze tags from files emitted from bazefetcher
ad25cad
to
77ed9fc
Compare
No description provided.