API Docs for: 0.0.1
Show:

Range Class

Defined in: lib/range.js:29
Module: niviz

A range of snow profiles.

Constructor

Range

(
  • [profiles]
  • [height]
)

Defined in lib/range.js:29

Parameters:

  • [profiles] Array optional

    an existing profiles array to use

  • [height] Number optional

    initial height

Methods

avgstep

(
  • profile
)
Number

Defined in lib/range.js:336

Calculate the average timestep of the range.

Parameters:

Returns:

Number:

The average timestep in minutes

duration

(
  • The
)
Number

Defined in lib/range.js:352

Calculate the duration of the range.

Parameters:

  • The Unit

    moment unit to use (default: hours)

Returns:

Number:

The duration in the unit specified

index

(
  • date
)

Defined in lib/range.js:221

Get the closest index for the given date.

Parameters:

  • date Moment

Returns:

Number

insert

(
  • profile
)
chainable

Defined in lib/range.js:286

Inserts a profile to the range and updates the range's height. NOTE: In case there is already a profile present with the same date, the profile to be inserted is ignored.

Parameters:

matches

(
  • from
  • [to]
)
Boolean

Defined in lib/range.js:365

Whether or not the range matches the passed-in interval exactly.

Parameters:

  • from Array, Moment
  • [to] Moment optional

    to

Returns:

max

(
  • prop
)
Number

Defined in lib/range.js:384

Get maximal value for a certain property present in the profiles.

Parameters:

Returns:

merge

(
  • range
)
chainable

Defined in lib/range.js:318

Merge two range objects by adding the profiles of the object passed.

Parameters:

push

(
  • profile
)
chainable

Defined in lib/range.js:272

Adds a profile to the range and updates the range's height.

Parameters:

range

(
  • from
  • to
)

Defined in lib/range.js:185

Get a sub range of profiles by index or by dates.

Note: The new range object will share profile references with the current range!

Parameters:

  • from Number, Moment

    index or date

  • to Number, Moment

    index or date

Returns:

Range

showsoil

(
  • enable
)
chainable

Defined in lib/range.js:167

Toggle whether to expose all layers of all profiles present or just the ones above the ground, i. e. with a top value > 0.

Parameters:

  • enable Boolean

    true = expose all layers, false = hide soil layers

updateFeatures

() chainable

Defined in lib/range.js:147

If the station profiles receive an update, this function needs to be called in order to update the features array

Properties

bottom

Number

Defined in lib/range.js:71

The height at the bottom of the lowest layer of all the profile, measured from the ground.

empty

Boolean

Defined in lib/range.js:127

features

Array

Defined in lib/range.js:135

from

Moment

Defined in lib/range.js:99

height

Number

Defined in lib/range.js:86

The maximal distance from top to bottom, i. e. maximal height of all profiles.

length

Number

Defined in lib/range.js:119

profiles

Array

Defined in lib/range.js:40

to

Moment

Defined in lib/range.js:109

top

Number

Defined in lib/range.js:56

The height at the top of the topmost layer of all profiles, measured from the ground.