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:
If we change the lang parameter to German (‘de’), we see the conditions is translated to German:
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’:
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 translation source data:
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.
For more information on adding or modifying the translation data, please see How to create or modify language files.