func main() { lat := flag.Float64("lat", 0, "latitude of occurrence") lng := flag.Float64("lng", 0, "longitude of occurrence") explain := flag.Bool("explain", true, "print useful information") date := flag.Int64("date", 0, "unix second: 1467558491") period := flag.Int64("period", 14, "number of days into the past to generate weather: 14") flag.Parse() store, err := noaa.NewWeatherStore( "/Users/mph/Desktop/phenograph-raw-data/stations.txt", "/Users/mph/Desktop/phenograph-raw-data/ghcnd_all/ghcnd_all", false, ) if err != nil { panic(err) } records, err := store.Nearest( *lat, *lng, noaa.Elements{noaa.ElementTMAX, noaa.ElementPRCP, noaa.ElementTMIN}, noaa.TimesFromUnixArray(*date, *period), *explain, ) if err != nil { panic(err) } fmt.Println("RECORDS", utils.JsonOrSpew(records)) return }
func TestPages(t *testing.T) { t.Parallel() Convey("should successfully return a list of encyclopedia of life search results", t, func() { response, err := Page(PageQuery{ ID: 1045608, Synonyms: true, Images: 1, Text: 1, Details: true, }) Println(utils.JsonOrSpew(response)) So(err, ShouldBeNil) So(response.ScientificName, ShouldEqual, "Apis mellifera Linnaeus 1758") So(response.RichnessScore, ShouldEqual, 86.9941) So(len(response.Synonyms), ShouldEqual, 7) So(len(response.TaxonConcepts), ShouldEqual, 9) }) }