Hello everyone,
My previous code using openweather maps : http://hastebin.com/uzebomohon.vala
The problem im having right now is:
I want to switch from openweathermap.org API to wunderground because it allows weather forecast by IP and is said to be more accurate. But seems a bit more complicated to convert and http://json2csharp.com/ isn't cutting it...
can someone please help me out?
Yes im using unity but I (think) I did everything needed for any weather API to work.
If I just know how to convert this to c sharp and properly log everything to console that should wrap my head around it enough to use it for whatever else so any help is greatly appreciated!
ㅇ새 ㅇ 국ㄸ긴
I guess I simply assumed my classes generated from openweathermap.org using http://json2csharp.com/ werent going to work because when i tried to convert weatherunderground the same way i got something completely broken and screwy out of it instead
afelicioni
I tried to use that webtool with an addess like
and from what I can see it can parse, but you may need to manually rework the code for types and for wrapping class (I don't get the match between the raw JSON and the WeatherData in the hastebin code)
ㅇ새 ㅇ 국ㄸ긴
afelicioni
ㅇ새 ㅇ 국ㄸ긴
ㅇ새 ㅇ 국ㄸ긴
ㅇ새 ㅇ 국ㄸ긴
afelicioni
for detecting a particular condition, you can do a string cross compare with list available at http://www.wunderground.com/weather/api/d/docs?d=resources/phrase-glossary for conditions or icon
since forecast is given as a list, a pseudocode consisting in a loop with a cursor could refer to weatherData.forecast.simpleforecast.forecastday[cursor].conditions in a foreach cursor in weatherData.forecast.simpleforecast.forecastday
ㅇ새 ㅇ 국ㄸ긴
Youre saying i can also use the conditions? Also I know what pseudocode means but what is a cursor? :)
Edit: Do you have any idea what would be a good way to actually use POP to make it rain?
When I think about it, we only get the probability of todays weather and not the actual weather.
And its going to look very silly when it is raining outside but not in the program or IS raining in the program but not actually outside....
Because the pop value in the code just so happens to be set low enough for it to happen....wondering how to go about that.
Any ideas are greatly appreciated!
Second edit: Also is it normal for the forecast to be changing on almost every single refresh i do?
It seems to be alternating constantly between:
ㅇ새 ㅇ 국ㄸ긴
but its never certain whether its actually ''raining'' and its going to look really weird to have rain happen in the game when there is actually non going on outside, because thats kind of the point!
Here's the whole script incase that helps:
http://hastebin.com/erupeqelar.vala (I commented it all out for you so it makes sense hopefully)
What do you think? Is the solution in doing some sort of combination of using these?
precipm: Precipitation in mm
precipi: Precipitation in inches
pop:Probability of Precipitation
And create a formula to increase accuracy? or do you think the solution lies more likely in the current condition?
condition:conds ( cant seem to parse this btw) it isnt returning values when I go for string something = weatherData.forecast.simpleforecast.forecastday[0].conditions;
Because im thinking the actual descriptions might actually be more helpful like when its says its going to be cloudy with ocasional light rain if we could convert that to usable values or something?ㅇ새 ㅇ 국ㄸ긴
ㅇ새 ㅇ 국ㄸ긴
conditions array and then creating an enum list containing all the condition phrases and then comparing them to the string output from the conditions array.
I get the current condition string output, it will go through my enum list, and if the current condition enum is equal to the current condition string output then : stuff happens!
However I hope the the API's condition information is accurate enough to know whether its truly currently raining outside or not...
afelicioni
since I can mainly follow the programming aspects, I hope a Weather Underground representative can be clear about forecast "reliability index" to ensure the best success of your project.
about forecast response model, under simpleforecast you get today forecast and for next 3 days, but under txt_forecast it doubles since it returns splitted day and night forecasts, codeable via a for loop with index starting from 0; anyway if current conditions is needed, conditionsfeature may fit best http://www.wunderground.com/weather/api/d/docs?d=data/conditions
afelicioni
since I can mainly follow the programming aspects, I hope a Weather Underground representative can be clear about forecast "reliability index" to ensure the best success of your project.
about forecast response model, under simpleforecast you get today forecast and for next 3 days, but under txt_forecast it doubles since it returns splitted day and night forecasts, codeable via a for loop with index starting from 0; anyway if current conditions is needed, conditionsfeature may fit best http://www.wunderground.com/weather/api/d/docs?d=data/conditions
ㅇ새 ㅇ 국ㄸ긴