API Docs for: 0.0.1
Show:

SMETParser Class

Extends StringParser
Module: niviz

A SMET Weather Station Meteorological Data Format parser. Reads the input by line in a single pass (supports streamed data).

Constructor

SMETParser

()

Methods

check

(
  • against
)
Boolean
Returns true if the next line starts with the given string against.

Parameters:

Returns:

convert

(
  • idx
  • value
)
Moment | Number private

Parameters:

Returns:

Moment | Number:

The converted value.

end

() chainable

Inherited from Parser: lib/parser.js:176

This method must be called by the parsing methods when the parsing has finished.

generate_meta

() private chainable

next

() String | Undefined
Returns the next line/token; updates the parser's current position pointer and line number as a side effect.

Returns:

String | Undefined: The next token.

parse

(
  • [callback]
)
Object

Inherited from Parser but overwritten in lib/parser.js:130

Starts the parsing process; in sync mode this method blocks until the parsing has finished, otherwise it should return immediately! If given a callback, it must be bound to the end and error events.

Parameters:

Returns:

Object: The parse result.

parse_data

(
  • name
  • value
)
private chainable

Parameters:

parse_header

(
  • name
  • value
)
private chainable

Parameters:

parse_line

(
  • line
)
private

Inherited from StringParser but overwritten in lib/parsers/smet.js:205

Lexically analyses a line and parses it accordingly.

Note: When strict parsing is active (default), this method will reject out-of-section lines even if they are syntactically correct (e.g., header definitions outside of a header section).

Parameters:

parse_signature

(
  • version
  • type
)
private chainable

Parameters:

pause

()
Resumes _parse method after a short timeout; these small timeouts effectively give the browser more time to breathe and are a remedy for the 'long running script' warnings in Firefox.

peek

() String

Returns:

String: The next k characters.

restrict

()

skip

(
  • over
  • [until]
)
String | Undefined
Like next() but skips lines matching over until the end of data is reached or, if given, the next line starts with until.

Parameters:

Returns:

String | Undefined:

The next line.

verify

()

Inherited from Parser but overwritten in lib/parsers/smet.js:441

Properties

_parse

Unknown

converter

Object static

Type converter functions for PRO data values.

data

Object

Inherited from Parser: lib/parser.js:50

dates

Array static

A list of date/time formats recognized by the parser.

delimiter

String
The token delimiter; defaults to a newline.

done

Boolean
Whether or not all data has been parsed.

fields

Array

fields

Array static

A list of all known fields. For each field, there is a corresponding parser/converter in .converters.

lines

Number private
The number of lines/tokens parsed so far.

meteo

Meteo

mode

String

The current parsing mode. The mode corresponds to the different sections in a SMET file:

  • 'signature'
  • 'header'
  • 'data'

nodata

Object

position

Number private
The current position in the input data.

result

Object

Inherited from Parser: lib/parser.js:56

strict

Boolean

When true (default), the parser will only accept lines in their respective sections.

trim

String
The token trim value; defaults to a carriage return. If present, this value will be cut off at the end of each token during parsing.

type

String

units

Object

version

String