Weather Data Conditions

The Weather APIs include a ‘conditions’ field which represents a summary of the key weather features for a particular weather record (be it daily, hourly or subhourly record).

How is the condition field calculated?

The weather conditions field is created by examining the weather that will be or was experienced during that weather record. If a weather station reported specific weather conditions themselves then we will also attempt to incorporate those into the condition.

The condition may include precipitation amounts, types and likelihood (for forecasts). In addition, extreme temperature, low visibility (such as fog) and amount of sun will be considered. The output is a list of conditions that will be translated according to the API ‘lang’ parameter.

Here is an example of the conditions for a weather forecast request for London,UK:

“London,UK”,”01/11/2021″,45.8,44.9,45.2,39.2,,100.0,0.02,0.0,0.0,11.2,26.2,9.2,100.0,87.3,“Rain, Overcast”

If we change the lang parameter to German (‘de’), we see the conditions is translated to German:

“London,UK”,”01/11/2021″,45.8,44.9,45.2,39.2,,100.0,0.02,0.0,0.0,11.2,26.2,9.2,100.0,87.3,“Regen, Bedeckt”

Can I parse the weather conditions field and use the list in my code or script?

The output of the condition field can be used for programmatic or script use. We strongly advise to request the raw ‘ID’ form of the conditions using ‘&lang=id’ API parameter. This will result in a list of condition Ids that we use for our translations. These condition IDs will not change as we improve our API or make translation modifications. If you base your code on a particular language, you may experience problems if we correct or improve a descriptor.

Here is the above case for London, UK with the lang parameter set to ‘id’:

“London,UK”,”01/11/2021″,45.8,44.9,45.2,39.2,,100.0,0.02,0.0,0.0,11.2,26.2,9.2,100.0,87.3,“type_21, type_41”

Whilst it is not common, we may add additional condition codes in the future. Your code should handle new, unknown condition IDs and we recommend you implement a way to easily add new conditions as necessary.

Current list of condition codes

The latest version of our conditions code is available in our GitHub in our translations files:

https://github.com/visualcrossing/WeatherApi/tree/master/lang

Each language file includes the set of descriptors for the type_<number>. These are the descriptors used for the conditions. Not all of these conditions are currently used but they may be used as we continue to improve our product.

Leave a Reply

Your email address will not be published. Required fields are marked *