Skip to content

Cleaner python3 example for use with gzip #14

@travc

Description

@travc

Not much of an 'issue', but...
The usage example with gzip could be better.

import ish_parser
import gzip

ish_filename = 'path/to/a/ish/file.gz'

# Read content
parser = ish_parser.ish_parser()
with gzip.open(ish_filename, 'rb') as gzstream:
    for line in gzstream:
        ishp.loads(line.decode('utf-8'))

# get the list of all reports
reports = parser.get_reports()
print(len(reports))

I'm currently working on code to fetch the data for a particular station over a particular range.
Also converting some results (just air_temperature for now) into pandas dataframes.
If your interested, I can submit that code to you if it ever gets done to a 'clean enough' standard.

Oh, and thanks for writing a parser for the insane mess... I was not looking forward to that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions