# UDP JSON Observations Chronological Order

**URL:** <https://community.tempest.earth/t/udp-json-observations-chronological-order/9595>\
**Category:** Developers\
**Created:** [September 29, 2020, 3:17pm UTC](https://community.tempest.earth/t/udp-json-observations-chronological-order/9595 "2020-09-29T15:17:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mircolino](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/mircolino/32/9837_2.png) [@mircolino](https://community.tempest.earth/u/mircolino)\
**Post date:** [September 29, 2020, 3:17pm UTC](https://community.tempest.earth/t/udp-json-observations-chronological-order/9595/1 "2020-09-29T15:17:28Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![peter](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/peter/32/1365_2.png) [@peter](https://community.tempest.earth/u/peter)\
**Post date:** [September 29, 2020, 4:17pm UTC](https://community.tempest.earth/t/udp-json-observations-chronological-order/9595/2 "2020-09-29T16:17:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mircolino](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/mircolino/32/9837_2.png) [@mircolino](https://community.tempest.earth/u/mircolino)\
**Post date:** [September 29, 2020, 4:41pm UTC](https://community.tempest.earth/t/udp-json-observations-chronological-order/9595/3 "2020-09-29T16:41:55Z")

</div>

> [@peter](#):
>
> Yes, the array is sorted chronologically.

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?

---

<div class="post-metadata">

**Author:** ![vinceskahan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/vinceskahan/32/2785_2.png) [@vinceskahan](https://community.tempest.earth/u/vinceskahan)\
**Post date:** [September 29, 2020, 5:47pm UTC](https://community.tempest.earth/t/udp-json-observations-chronological-order/9595/4 "2020-09-29T17:47:39Z")

</div>

> [@mircolino](#):
>
> Is it safe to assume then, that in UDP I’ll never see multiple observations per event?

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.

---

<div class="post-metadata">

**Author:** ![peter](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/peter/32/1365_2.png) [@peter](https://community.tempest.earth/u/peter)\
**Post date:** [September 29, 2020, 6:03pm UTC](https://community.tempest.earth/t/udp-json-observations-chronological-order/9595/5 "2020-09-29T18:03:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![vinceskahan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/vinceskahan/32/2785_2.png) [@vinceskahan](https://community.tempest.earth/u/vinceskahan)\
**Post date:** [September 29, 2020, 6:17pm UTC](https://community.tempest.earth/t/udp-json-observations-chronological-order/9595/6 "2020-09-29T18:17:35Z")

</div>

Agree. It was rebroadcast of an obs\_st or evt\_ rain or whatever.

---

<div class="post-metadata">

**Author:** ![peter](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/peter/32/1365_2.png) [@peter](https://community.tempest.earth/u/peter)\
**Post date:** [September 29, 2020, 6:43pm UTC](https://community.tempest.earth/t/udp-json-observations-chronological-order/9595/7 "2020-09-29T18:43:59Z")

</div>

> [@mircolino](#):
>
> 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?

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.

---

<div class="post-metadata">

**Author:** ![GaryFunk](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/garyfunk/32/5729_2.png) [@GaryFunk](https://community.tempest.earth/u/GaryFunk)\
**Post date:** [September 30, 2020, 12:03am UTC](https://community.tempest.earth/t/udp-json-observations-chronological-order/9595/8 "2020-09-30T00:03:26Z")

</div>

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.
