datapoint-python icon indicating copy to clipboard operation
datapoint-python copied to clipboard

Ugly element mapping

Open jacobtomlinson opened this issue 10 years ago • 0 comments

Despite returning basically the same data types for a 'Day', 'Night' and '3hourly' timestep Datapoint feels the need to provide different keys for the same thing.

For example Probability of Precipitation will be 'Pp' if you requested 3hourly. But if you request Daily you will get 'PPd' in the Day timestep and 'PPn' in the Night timestep. And it is not even consistent with some things being the same (Visibility is always 'V') and some being different again e.g Humidity is either 'H' for 3hourly, or 'Hn' and 'Hm' for 'Humidity Noon' and 'Humidity Midday'.

The only difference between the data returned for any of the timesteps is that you don't get UV data for a 'Night' timestep in a Daily. Even though you do for midnight in a 3hourly.

Also Temperature (and Feels Like Temperature) in a 3hourly is the average temperature for that timestep but in a daily it's the minimum temperature for the Night timestep and maximum temperature for the Day timestep.

To work around this the Manager object holds a hardcoded array of mappings and has some additional logic to read the correct array items into the Timestep object properties.

This makes the code a but ugly and overly complicated. I'd like to neaten this up if possible.

jacobtomlinson avatar Oct 05 '14 13:10 jacobtomlinson