Conversation
|
I was having trouble running this. It turns out the issue was the folder One issue is that the NCDC data isn't consistent, it sometimes is over a week behind. Also, I was looking for a solution that can work in any area, not just in NYC. Usually I don't like to resort to web scrapping until absolutely necessary. I would prefer to use some sort of web service list a REST API but also don't want to have to pay for a license to use the API or keep the program constantly running to capture the data. Apparently this is a very small or impossible target to hit. Of the APIs I sent you, I tried tomorrow.io, AccuWeather, and AerisWeather and they all are not able to give you 7 days of historical data without purchasing a license. |
|
|
||
| dailyRainfallMap[rowDate] += knycRow.Precipitation.LastHour | ||
| dailyRainfallMap[rowDate] += knycRow.Precipitation.Last3Hours | ||
| dailyRainfallMap[rowDate] += knycRow.Precipitation.Last6Hours |
There was a problem hiding this comment.
I'm not sure if this is the proper way to calculate the rainfall, wouldnt these values overlap in time?
|
Yeah, the best data looks like it's all behind paywalls. I figured if we
can't get all 7 days from the same source we could try aggregating data
from a few sources and try building up a full week that way.
I wasn't actually sure what the data meant by Last Hour, Last 3 Hours, Last
6 hours. There was only ever one field filled out in the table, so I
figured it was just collected at different granularities but not
overlapping.
…On Tue, Jun 28, 2022, 11:47 PM Jason Biegel ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In DataProviders/knycProvider.go
<#1 (comment)>:
> +
+func GetKNYCRainfall() []models.RainfallDate {
+
+ knycData := getKNYCData()
+
+ var knycRainfall [7]models.RainfallDate
+ dayCounter := 0
+ dailyRainfallMap := make(map[string]float64)
+ for _,knycRow := range knycData.Data {
+
+ year, month, _ := time.Now().Date()
+ rowDate := fmt.Sprintf("%4d-%02d-%02sT00:00:00", year, month, knycRow.Date)
+
+ dailyRainfallMap[rowDate] += knycRow.Precipitation.LastHour
+ dailyRainfallMap[rowDate] += knycRow.Precipitation.Last3Hours
+ dailyRainfallMap[rowDate] += knycRow.Precipitation.Last6Hours
I'm not sure if this is the proper way to calculate the rainfall, wouldnt
these values overlap in time?
—
Reply to this email directly, view it on GitHub
<#1 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AH6CSNSCJILZM7JPY77ZAOLVRPBLJANCNFSM5Z3HCVPQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Moved NCDC specific functionality into separate file
Added KNYC weather data provider
Combine data from NCDC and KNYC for final determination