Documentation ¶
Overview ¶
package series defines data structures and functions to manipulate and retrieve BDSICE series
Index ¶
- type BDSICESerie
- func (s BDSICESerie) Average() float64
- func (s BDSICESerie) GetCode() string
- func (s BDSICESerie) GetData() *Observations
- func (s BDSICESerie) GetTitle() string
- func (s BDSICESerie) GetUnit() string
- func (s BDSICESerie) Max() (float64, time.Time)
- func (s BDSICESerie) Min() (float64, time.Time)
- func (s BDSICESerie) String() string
- type EconSerie
- type Observations
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BDSICESerie ¶
type BDSICESerie struct { SerieCode string `json:"SerieCode"` Title string `json:"Title"` Units string `json:"Units"` Source string `json:"Source"` Notes []string `json:"Notes"` Decimals int `json:"Decimals"` Frequency int `json:"Frequency"` Start *time.Time `json:"Start"` End *time.Time `json:"End"` NumberOfObservations int `json:"NumberOfObservations"` Observations Observations `json:"Observations"` Public bool `json:"Public"` Private bool `json:"Private"` Active bool `json:"Active"` Text []string `json:"Text"` ContainsNan bool `json:"ContainsNaN"` }
func Load ¶
func Load(configuration *config.BDSICEConfig, serieCode string) (*BDSICESerie, error)
loads the serie corresponding to serieCode in dbLocalPath and returns a pointer to the BDSICESerie object.
func (BDSICESerie) Average ¶
func (s BDSICESerie) Average() float64
returns a float64 number containing the average value of the full serie
func (BDSICESerie) GetCode ¶
func (s BDSICESerie) GetCode() string
returns a string containing the code of the serie
func (BDSICESerie) GetData ¶
func (s BDSICESerie) GetData() *Observations
JSON marshal does not support math.NaN values The workaround here is to append a very unlikely value such as -9999999.9999999 and toggle a field called ContainsNan When BDSICESerie.Data() gets implemented, it will have to check for ContainsNaN and substitute all -999999999.99999 values for a math.NaN
func (BDSICESerie) GetTitle ¶
func (s BDSICESerie) GetTitle() string
returns a string containing the title of the serie
func (BDSICESerie) GetUnit ¶
func (s BDSICESerie) GetUnit() string
func (BDSICESerie) Max ¶
func (s BDSICESerie) Max() (float64, time.Time)
returns a float64 number contaning the maximum value in the serie and its associated date
func (BDSICESerie) Min ¶
func (s BDSICESerie) Min() (float64, time.Time)
returns a float64 number containing the minimum value in the serie and its associated value
func (BDSICESerie) String ¶
func (s BDSICESerie) String() string
returns a string representation of the serie
type EconSerie ¶
type EconSerie interface { GetData() *Observations String() string GetCode() string GetTitle() string GetUnit() string Average() float64 Min() (float64, time.Time) // must return the minimum observation in the serie and its time Max() (float64, time.Time) // must return the maximum value in the serie and its time }