sbdb_cad

package module
v0.0.0-...-1d49bb6 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2020 License: MIT Imports: 7 Imported by: 0

README

SBDB CAD

A Go Client for Nasa's Small Body Database Close-Approach API

Installation

go get github.com/evancaplan/sbdb_cad

Search Options

type SmallBodyOptions struct {
    
    	// Default value: "now" for current date
    	// Exludes dates earlier than this date
	DateMin             string `json:"dateMin"`

	// Default value: "+60" to add 60 days to current date
	// Excludes data later than this date
	DateMax             string `json:"dateMax"`
	
	//Default Value: none; Default unit: au
	//Excludes data with an approach greater than value
	DistanceMin         string `json:"distanceMin"`
	
	// Default Value: .05; Default unit: au
	// Excludes data with an approach less than value
	DistanceMax         string `json:"distanceMax"`
	
	// Default Value: none
	// Excludes H values smaller than this
	HMin                string `json:"hMin"`
	
	// Default Value: none
	// Excludes H values greater than this
	HMax                string `json:"hMax"`
	
	// Default Value: none; Units: km/s
	// Exlucdes data with Velocity Infinity less than this value
	VelocityInfMax      string `json:"velocityInfMax"`
	
	// Default Value: none; Units: km/s
	// Exlucdes data with Velocity Infinity greater than this value
	VelocityInfMin      string `json:"velocityInfMin"`
	
	//Default Value: none; Units: km/s
	// Exlucdes data with Velocity Relative less than this value
	VelocityRelativeMax string `json:"velocityRelativeMax"`
	
	// Default Value: none; Units: km/s
	// Exlucdes data with Velocity Relative greater than this value
	VelocityRelativeMin string `json:"velocityRelativeMin"`
	
	// Default Value: none
	// Limits data to objects of specified orbit class
	// See https://ssd-api.jpl.nasa.gov/doc/cad.html#sbdb_class_table
	Class               string `json:"class"`
	
	// Default Value: false
	// Limit data to  potentially hazardous asteroids
	Pha                 bool   `json:"pha"`
	
	// Default Value: false
	// Limit data to near-earth asteroids
	Nea                 bool   `json:"nea"`
	
	// Default Value: false
	// Limit data to comets
	Comet               bool   `json:"comet"`
	
	// Default Value: false
	// Limit data to near-earth asteroids and comets
	NeaComet            bool   `json:"neaComet"`
	
	// Default Value: false
	// Limit data to near-earth objects
	Neo                 bool   `json:"neo"`
	
	// Default Value: none
	// Limits data to objects of the specific kind
	// a = asteroid, an = numbered-asteroids, au = unnumbered-asteroids
	// c = comets, cn = numbered-comets, cu = unnumbered-comets
	// n = numbered-objects, u = unnumbered-objects
	Kind                string `json:"kind"`
	
	// Default Value: none
	// Filters data for objects with a matching SPK-ID
	Spk                 string `json:"spk"`
	
	// Default Value: none
	// Filters data for objects with a matching designation
	Designation         string `json:"designation"`
	
	// Default Value: "Earth"
	// Limits data to close-approaches to the specified body
	// See https://ssd-api.jpl.nasa.gov/doc/cad.html#cad_body_table
	Body                string `json:"body"`
	
	// Default Value: "date"
	// Sorts data by any of the fields in this struct
	Sort                string `json:"sort"`
	
	// Default Value: none
	// Limits data to first N results
	Limit               string `json:"limit"`
	
	// Default Value: none
	// Include the full-format object name/designation
	FullName            bool   `json:"fullName"`
}

Usage

imports(
    sbdb_cad "github.com/evancaplab/sbdb_cad"
)

func FindSmallBodyCloseApproachData(sbo sbdb_cad.SmallBodyOptions) ([]sbdb.SbCad, error) {
	SbCadService := sbdb_cad.NewSbCadService()
	bodies, err := SbCadService.FindSbCadBy(sbo)
	if err != nil {
    		return nill, err
	}
	return bodies
}

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewQueryBuilder

func NewQueryBuilder() *queryBuilder

Types

type Decoder

type Decoder interface {
	Decode(input interface{}, output interface{}) error
}

type Getter

type Getter interface {
	Get(url string) (resp *http.Response, err error)
}

type Mapper

type Mapper interface {
	Map(response *http.Response) ([]SbCad, error)
}

type QueryStringBuilder

type QueryStringBuilder interface {
	Build(sbo *SmallBodyOptions) string
}

type Requester

type Requester struct{}

func (*Requester) Get

func (r *Requester) Get(url string) (resp *http.Response, err error)

type SbCad

type SbCad struct {
	Des       string `json:"destination"`
	Orbit_id  string `json:"orbitId"`
	Jd        string `json:"closeApproachJd"`
	Cd        string `json:"closeApproachCd"`
	Dist      string `json:"distance"`
	Dist_max  string `json:"distanceMax"`
	Dist_min  string `json:"distanceMin"`
	V_rel     string `json:"relativeVelocity"`
	V_inf     string `json:"inferredVelocity"`
	T_sigma_f string `json:"threeSigma"`
	Body      string `json:"body"`
	H         string `json:"h"`
	FullName  string `json:"fullName"`
}

type SbCadDecoder

type SbCadDecoder struct{}

func (*SbCadDecoder) Decode

func (sd *SbCadDecoder) Decode(input interface{}, output interface{}) error

type SbCadFinder

type SbCadFinder interface {
	FindSbCadBy(sbo SmallBodyOptions) ([]SbCad, error)
}

type SbCadMapper

type SbCadMapper struct {
	Decoder
}

func NewSbCadMapper

func NewSbCadMapper() *SbCadMapper

func (*SbCadMapper) Map

func (sb *SbCadMapper) Map(res *http.Response) ([]SbCad, error)

type SbCadResponse

type SbCadResponse struct {
	Signature `json:"signature"`
	Count     string     `json:"count"`
	Fields    []string   `json:"fields"`
	Data      [][]string `json:"data"`
}

type SbCadService

type SbCadService struct {
	BaseUrl string
	Getter
	Mapper
	QueryStringBuilder
}

func NewSbCadService

func NewSbCadService() *SbCadService

func (*SbCadService) FindSbCadBy

func (ss *SbCadService) FindSbCadBy(sbo SmallBodyOptions) ([]SbCad, error)

type Signature

type Signature struct {
	Version string `json:"version"`
	Source  string `json:"source"`
}

type SmallBodyOptions

type SmallBodyOptions struct {
	DateMin             string `json:"dateMin"`
	DateMax             string `json:"dateMax"`
	DistanceMin         string `json:"distanceMin"`
	DistanceMax         string `json:"distanceMax"`
	HMin                string `json:"hMin"`
	HMax                string `json:"hMax"`
	VelocityInfMax      string `json:"velocityInfMax"`
	VelocityInfMin      string `json:"velocityInfMin"`
	VelocityRelativeMax string `json:"velocityRelativeMax"`
	VelocityRelativeMin string `json:"velocityRelativeMin"`
	Class               string `json:"class"`
	Pha                 bool   `json:"pha"`
	Nea                 bool   `json:"nea"`
	Comet               bool   `json:"comet"`
	NeaComet            bool   `json:"neaComet"`
	Neo                 bool   `json:"neo"`
	Kind                string `json:"kind"`
	Spk                 string `json:"spk"`
	Designation         string `json:"designation"`
	Body                string `json:"body"`
	Sort                string `json:"sort"`
	Limit               string `json:"limit"`
	FullName            bool   `json:"fullName"`
}

Jump to

Keyboard shortcuts

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