UDP JSON Observations Chronological Order

I noticed that obs_air, obs_sky and obs_st can report multiple observations. Since, to date, I’ve never seen an event with multiple observations, I’m wondering if the array is sorted chronologically. Oldest observation first or last?

Yes, the array is sorted chronologically. If you use the REST API with the time_start and time_end parameters (rather than just requesting the single latest observation which is the default), then you will see multiple observations in the obs array. The reason that that obs array is still an array even when there is only one observation is just to maintain consistency across the API.

2 Likes

Thanks @peter.
Is it safe to assume then, that in UDP I’ll never see multiple observations per event?
If not, is the most recent observation going to be first or last in the array?

No, it is not safe to assume that.

A couple months the weewx author briefly had a Tempest station and found lots of repeated UDP messages, probably due to multiple things on the same frequency bands.

1 Like

Did those repeated UDP messages contain multiple observations, though? It’s certainly not safe to assume UDP will only send each observation once, but within each UDP packet I would be very surprised if there were multiple observations.

Agree. It was rebroadcast of an obs_st or evt_ rain or whatever.

2 Likes

So in each UDP message you will only see one observation. But as @vinceskahan pointed out, this observation might be a rebroadcast of an observation already sent. In other situations with the REST API where you can have multiple observations, the most recent is going to be the last in the array.

1 Like

I had a conversation with David three years ago and the reason that UDP is an array of arrays, is to match the websocket. It’s pretty much 99.9% positive that the UDP will contain a single array.

3 Likes