RAVE
Lib.rave_fm12.fm12_parser Class Reference

The parser of the fm12 synop data. More...

Inheritance diagram for Lib.rave_fm12.fm12_parser:

Public Member Functions

 __init__ (self)
 
 parse (self, filename)
 Parses the file.
 

Public Attributes

int SECTION1_PARTS = idx + 1
 
int SECTION3_PARTS = idx + 1
 

Static Public Attributes

dict SECTION1_PARTS
 
dict SECTION3_PARTS
 

Protected Member Functions

 _extract_blocks (self, groups)
 
 _parse_data (self, groups, filename)
 First step of the parsing.
 
 _parse_base_info (self, base_id, filename)
 Extracts the base information about this file.
 
 _parse_block (self, base_id, block)
 Parses one block of data (between AAXX/BBXX/OOXX and next AAXX/BBXX/OOXX.
 
 _parse_obs (self, baseinfo, id, data)
 Parses one observation.
 
 _parse_aaxx_obs (self, baseinfo, yyggi, data)
 Parses an aaxx obs.
 
 _create_sections_from_obs (self, tokens)
 Creates sections from the tokens in an observation.
 
 _parse_section1_1 (self, obs, token)
 Handles group 1 in section 1.
 
 _parse_section1_2 (self, obs, token)
 Handles group 2 in section 1.
 
 _parse_section1_3 (self, obs, token)
 Handles group 3 in section 1.
 
 _parse_section1_4 (self, obs, token)
 Handles group 4 in section 1.
 
 _parse_section1_5 (self, obs, token)
 Handles group 5 in section 1.
 
 _parse_section1_6 (self, obs, token)
 Handles group 6 in section 1.
 
 _parse_section1_7 (self, obs, token)
 Not used.
 
 _parse_section1_8 (self, obs, token)
 Not used.
 
 _parse_section1_9 (self, obs, token)
 Not used.
 
 _fill_obs_with_section1 (self, obs, section1)
 Processes section 1 of the observation and sets the relevant information in the obs.
 
 _parse_section3_0 (self, obs, token)
 Not used.
 
 _parse_section3_1 (self, obs, token)
 Handles group 1 in section 3.
 
 _parse_section3_2 (self, obs, token)
 Handles group 2 in section 3.
 
 _parse_section3_3 (self, obs, token)
 Not used.
 
 _parse_section3_4 (self, obs, token)
 Not used.
 
 _parse_section3_5 (self, obs, token)
 Not used.
 
 _parse_section3_6 (self, obs, token)
 Not used.
 
 _parse_section3_7 (self, obs, token)
 Not used

 
 _parse_section3_8 (self, obs, token)
 
 _parse_section3_9 (self, obs, token)
 Not used.
 
 _fill_obs_with_section3 (self, obs, section3)
 Fills the observation with information from section 3.
 

Detailed Description

The parser of the fm12 synop data.

Member Function Documentation

◆ _create_sections_from_obs()

Lib.rave_fm12.fm12_parser._create_sections_from_obs ( self,
tokens )
protected

Creates sections from the tokens in an observation.

The tokens should not include the station identifier and first 111 group (iihVV)

Parameters
tokens- the token list
Returns
a tuple of sections (111,222,333,444,555) where the sections always will be a list even if there is no data.

◆ _fill_obs_with_section1()

Lib.rave_fm12.fm12_parser._fill_obs_with_section1 ( self,
obs,
section1 )
protected

Processes section 1 of the observation and sets the relevant information in the obs.

Parameters
obs- the observation to get data filled in
section1- the section 1 groups

◆ _fill_obs_with_section3()

Lib.rave_fm12.fm12_parser._fill_obs_with_section3 ( self,
obs,
section3 )
protected

Fills the observation with information from section 3.

Parameters
obs- the observation to be filles
section3a tokenized list of the groups in section 3

◆ _parse_aaxx_obs()

Lib.rave_fm12.fm12_parser._parse_aaxx_obs ( self,
baseinfo,
yyggi,
data )
protected

Parses an aaxx obs.

Parameters
baseinfo- the base info
yyggi- (yy)day of month, (gg)hour of day, (i)wind type indicator

◆ _parse_base_info()

Lib.rave_fm12.fm12_parser._parse_base_info ( self,
base_id,
filename )
protected

Extracts the base information about this file.

◆ _parse_block()

Lib.rave_fm12.fm12_parser._parse_block ( self,
base_id,
block )
protected

Parses one block of data (between AAXX/BBXX/OOXX and next AAXX/BBXX/OOXX.

Parameters
base_idthe base info
blcokthe block to parse
Returns
a list of fm12_obs

◆ _parse_data()

Lib.rave_fm12.fm12_parser._parse_data ( self,
groups,
filename )
protected

First step of the parsing.

◆ _parse_obs()

Lib.rave_fm12.fm12_parser._parse_obs ( self,
baseinfo,
id,
data )
protected

Parses one observation.

Currently, only AAXX (SYNOP) are handled

Parameters
baseinfo- the base info
id- the identifier for this obs
data- the obs data to be parsed
Returns
a fm12_obs

◆ _parse_section1_1()

Lib.rave_fm12.fm12_parser._parse_section1_1 ( self,
obs,
token )
protected

Handles group 1 in section 1.

Parameters
obs- the obs to fill with information
token- in the format 1sTTT (Temperature)

◆ _parse_section1_2()

Lib.rave_fm12.fm12_parser._parse_section1_2 ( self,
obs,
token )
protected

Handles group 2 in section 1.

Parameters
obs- the obs to fill with information
token- in the format 2sTTT (Dewpoint)

◆ _parse_section1_3()

Lib.rave_fm12.fm12_parser._parse_section1_3 ( self,
obs,
token )
protected

Handles group 3 in section 1.

Parameters
obs- the obs to fill with information
token- in the format 3PPPP (Station pressure in 0.1 mb )

◆ _parse_section1_4()

Lib.rave_fm12.fm12_parser._parse_section1_4 ( self,
obs,
token )
protected

Handles group 4 in section 1.

Parameters
obs- the obs to fill with information
token- in the format 4PPPP (Sea level pressure in 0.1 mb )

◆ _parse_section1_5()

Lib.rave_fm12.fm12_parser._parse_section1_5 ( self,
obs,
token )
protected

Handles group 5 in section 1.

Parameters
obs- the obs to fill with information
token- in the format 5appp (Pressure tendency over 3 hours)

◆ _parse_section1_6()

Lib.rave_fm12.fm12_parser._parse_section1_6 ( self,
obs,
token )
protected

Handles group 6 in section 1.

Parameters
obs- the obs to fill with information
token- in the format 6RRRt (Liquid precipitation)

◆ _parse_section1_7()

Lib.rave_fm12.fm12_parser._parse_section1_7 ( self,
obs,
token )
protected

Not used.

◆ _parse_section1_8()

Lib.rave_fm12.fm12_parser._parse_section1_8 ( self,
obs,
token )
protected

Not used.

◆ _parse_section1_9()

Lib.rave_fm12.fm12_parser._parse_section1_9 ( self,
obs,
token )
protected

Not used.

◆ _parse_section3_0()

Lib.rave_fm12.fm12_parser._parse_section3_0 ( self,
obs,
token )
protected

Not used.

◆ _parse_section3_1()

Lib.rave_fm12.fm12_parser._parse_section3_1 ( self,
obs,
token )
protected

Handles group 1 in section 3.

Parameters
obs- the obs to fill with information
token- in the format 1sTTT (Maximum temperature over previous 24 hours)

◆ _parse_section3_2()

Lib.rave_fm12.fm12_parser._parse_section3_2 ( self,
obs,
token )
protected

Handles group 2 in section 3.

Parameters
obs- the obs to fill with information
token- in the format 2sTTT (Minimum temperature over previous 24 hours)

◆ _parse_section3_3()

Lib.rave_fm12.fm12_parser._parse_section3_3 ( self,
obs,
token )
protected

Not used.

◆ _parse_section3_4()

Lib.rave_fm12.fm12_parser._parse_section3_4 ( self,
obs,
token )
protected

Not used.

◆ _parse_section3_5()

Lib.rave_fm12.fm12_parser._parse_section3_5 ( self,
obs,
token )
protected

Not used.

◆ _parse_section3_6()

Lib.rave_fm12.fm12_parser._parse_section3_6 ( self,
obs,
token )
protected

Not used.

◆ _parse_section3_7()

Lib.rave_fm12.fm12_parser._parse_section3_7 ( self,
obs,
token )
protected

Not used

◆ _parse_section3_9()

Lib.rave_fm12.fm12_parser._parse_section3_9 ( self,
obs,
token )
protected

Not used.

◆ parse()

Lib.rave_fm12.fm12_parser.parse ( self,
filename )

Parses the file.

Parameters
filenamethe file containing the fm12 formatted data
Returns
a list of fm12_obs

Member Data Documentation

◆ SECTION1_PARTS

dict Lib.rave_fm12.fm12_parser.SECTION1_PARTS
static
Initial value:
= {'1':_parse_section1_1,
'2':_parse_section1_2,
'3':_parse_section1_3,
'4':_parse_section1_4,
'5':_parse_section1_5,
'6':_parse_section1_6,
'7':_parse_section1_7,
'8':_parse_section1_8,
'9':_parse_section1_9}

◆ SECTION3_PARTS

dict Lib.rave_fm12.fm12_parser.SECTION3_PARTS
static
Initial value:
= {'0':_parse_section3_0,
'1':_parse_section3_1,
'2':_parse_section3_2,
'3':_parse_section3_3,
'4':_parse_section3_4,
'5':_parse_section3_5,
'6':_parse_section3_6,
'7':_parse_section3_7,
'8':_parse_section3_8,
'9':_parse_section3_9}

The documentation for this class was generated from the following file: