SEF: A module for accessing Station Exchange Format files

This module provides a python API to newly-rescued weather observations in Station Exchange Format (SEF) files.

It provides three functions read_file(), write_file(), and create():

import SEF
obs=SEF.read_file('/wherever/Exeter_1811.tsv')

Will load the file contents as a dict that replicates the SEF file structure.

obs=SEF.create()
# Add data and metadata to the obs structure
SEF.write_file(obs,'/wherever/Exeter_new.tsv')

Will create the specified SEF file with the obs as specified. |

SEF.create(version='0.0.1')[source]

Create a data structure matching a SEF file

Args:
version (str): Semantic version of SEF to be supported
Returns:
dict: Data as key:value pairs.

SEF.read_file(file_name)[source]

Load the contents of the specified file.

Parameters:file_name (str) – File (or ‘open’able object)
Returns:Data as key:value pairs.
Return type:dict
Raises:IOError – Not a readable SEF file.

SEF.write_file(obs, file_name)[source]

Write the specified set of obs to a file in SEF format.

Parameters:file_name (str) – File (or ‘open’able object)
Returns:Data as key:value pairs.
Return type:dict
Raises:ValueError – obs not a SEF structure