Skip to content
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

Merged
merged 1 commit into from
Oct 5, 2018
Merged

Bazefetcher source #27

merged 1 commit into from
Oct 5, 2018

Conversation

JensGM
Copy link
Contributor

@JensGM JensGM commented Oct 4, 2018

No description provided.

@JensGM JensGM added the review label Oct 4, 2018


def _read_json_gz(fn):
with gzip.GzipFile(fn, 'r') as f:
Copy link

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?

raise ValueError('{} is not a directory'.format(root))

if not isinstance(tzinfo, datetime.tzinfo):
raise ValueError('tzinfo must be instance of datetime.tzinfo')
Copy link

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.

raise ValueError(
'start_date and end_date parameters must be of type date')

if not start_date.tzinfo or not end_date.tzinfo:
Copy link

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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

env python3

@JensGM JensGM changed the title Bazefetcher source WIP Bazefetcher source Oct 4, 2018
@JensGM JensGM force-pushed the bazefetcher-source branch 3 times, most recently from 2c8af86 to 7f49fcc Compare October 5, 2018 09:58
@JensGM JensGM changed the title WIP Bazefetcher source Bazefetcher source Oct 5, 2018
Copy link
Contributor

@sveinung-r sveinung-r left a 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

# 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
Copy link
Contributor

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?

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()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could also check count

@JensGM JensGM force-pushed the bazefetcher-source branch 10 times, most recently from 144be10 to ad25cad Compare October 5, 2018 15:14
Add bazefetcher source function that reads baze tags from files emitted
from bazefetcher
@JensGM JensGM force-pushed the bazefetcher-source branch from ad25cad to 77ed9fc Compare October 5, 2018 15:54
@JensGM JensGM merged commit 7a815f1 into equinor:master Oct 5, 2018
@JensGM JensGM removed the review label Oct 5, 2018
@JensGM JensGM deleted the bazefetcher-source branch October 8, 2018 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants