surfrad

package module
v0.0.0-...-7d31469 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 9 Imported by: 0

README

parse SURFRAD with go

GoDoc

as per these docs

why? because I have ADHD and I'm not even sure what I was doing a couple of hours ago

but here you go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateStationID

func ValidateStationID(sid StationID) bool

func ValidateStationName

func ValidateStationName(sn StationName) bool

Types

type Data

type Data struct {
	RawTimestamp RawEntryTime `json:"raw_time_data"`
	Timestamp    time.Time    `json:"timestamp"`

	// Solar Radiation
	SolarZenithAngle                  float64 `json:"solar_zenith_angle,omitempty"`
	DownwellingSolar                  float64 `json:"downwelling_solar,omitempty"`
	UpwellingSolar                    float64 `json:"upwelling_solar,omitempty"`
	DirectNormalSolar                 float64 `json:"direct_normal_solar,omitempty"`
	DownwellingDiffuseSolar           float64 `json:"downwelling_diffuse_solar,omitempty"`
	DownwellingIR                     float64 `json:"downwelling_ir,omitempty"`
	DownwellingIRCaseTemp             float64 `json:"downwelling_ir_case_temp,omitempty"`
	DownwellingIRDomeTemp             float64 `json:"downwelling_ir_dome_temp,omitempty"`
	UpwellingIR                       float64 `json:"upwelling_ir,omitempty"`
	UpwellingIRCaseTemp               float64 `json:"upwelling_ir_case_temp,omitempty"`
	UpwellingIRDomeTemp               float64 `json:"upwelling_ir_dome_temp,omitempty"`
	GlobalUVB                         float64 `json:"global_uvb,omitempty"`
	PhotosyntheticallyActiveRadiation float64 `json:"photosynthetically_active_radiation,omitempty"`
	NetSolar                          float64 `json:"net_solar,omitempty"`
	NetIR                             float64 `json:"net_ir,omitempty"`
	TotalNetRadiation                 float64 `json:"total_net,omitempty"`

	TemperatureC             float64 `json:"temperature,omitempty"` // celcius
	RelativeHumidity         float64 `json:"relative_humidity,omitempty"`
	WindSpeedMetersPerSecond float64 `json:"wind_speed,omitempty"`          // m/s
	WindDirectionDegrees     float64 `json:"wind_direction,omitempty"`      // degrees, clockwise from north
	BarometricPressure       float64 `json:"barometric_pressure,omitempty"` // mb

}

func ParseLine

func ParseLine(fields []string) (Data, error)

func (*Data) OmitInvalidOrMissing

func (d *Data) OmitInvalidOrMissing()

func (*Data) ParseTimestamp

func (d *Data) ParseTimestamp(fields []string) error

type Location

type Location struct {
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
	Elevation int     `json:"elevation"`
}

type RawEntryTime

type RawEntryTime struct {
	Year    int     `json:"year"`
	Month   int     `json:"month"`
	Day     int     `json:"day"`
	JDay    int     `json:"jday"`
	Hour    int     `json:"hour"`
	Minute  int     `json:"minute"`
	Decimal float64 `json:"decimal_time"` // (hour.decimalminutes, e.g., 23.5 = 2330)
}

type Station

type Station struct {
	StationName StationName `json:"station_name"`
	LocatedAt   Location    `json:"located_at"`

	Version int `json:"version"`

	Entries []Data `json:"entries"`
}

func ReadData

func ReadData(r io.Reader) (Station, error)

func (Station) Len

func (s Station) Len() int

func (*Station) ParseHeader

func (s *Station) ParseHeader(headerInfo []string) (error, bool)

type StationID

type StationID [3]rune

func GetStationID

func GetStationID(sn StationName) (StationID, bool)

func (StationID) String

func (sid StationID) String() string

func (StationID) Valid

func (sid StationID) Valid() bool

type StationName

type StationName string
const (
	StationBondville     StationName = "Bondville"
	StationFortPeck      StationName = "Fort Peck"
	StationGoodwinCreek  StationName = "Goodwin Creek"
	StationTableMountain StationName = "Table Mountain"
	StationDesertRock    StationName = "Desert Rock"
	StationPennState     StationName = "Penn State"
	StationSiouxFalls    StationName = "Sioux Falls"
)

func GetStationName

func GetStationName(sid StationID) (StationName, bool)

func (StationName) String

func (sn StationName) String() string

func (StationName) Valid

func (sn StationName) Valid() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL