Message Boards Message Boards

How to convert data into dated entities?

I have some environmental observe data, some examples are as follows:

data=<|DateObject[{2019,8,25,7,0,0.}]->{{DateObject[{2019,8,25,7,0,0.}],12.,{25.069,121.481}},{DateObject[{2019,8,25,7,0,0.}],13.,{25.0624,121.527}},{DateObject[{2019,8,25,7,0,0.}],13.,{24.2566,120.742}},{DateObject[{2019,8,25,7,0,0.}],8.,{24.9825,121.452}},{DateObject[{2019,8,25,7,0,0.}],9.,{25.0355,121.083}},{DateObject[{2019,8,25,7,0,0.}],14.,{24.7406,121.089}},{DateObject[{2019,8,25,7,0,0.}],18.,{24.9533,121.222}},{DateObject[{2019,8,25,7,0,0.}],9.,{24.697,120.899}},{DateObject[{2019,8,25,7,0,0.}],5.,{25.0465,121.508}},{DateObject[{2019,8,25,7,0,0.}],10.,{25.0206,121.53}},{DateObject[{2019,8,25,7,0,0.}],6.,{24.3829,120.759}},{DateObject[{2019,8,25,7,0,0.}],9.,{25.013,121.459}},{DateObject[{2019,8,25,7,0,0.}],2.,{24.9001,121.039}},{DateObject[{2019,8,25,7,0,0.}],5.,{25.0603,121.202}},{DateObject[{2019,8,25,7,0,0.}],4.,{25.05,121.579}},{DateObject[{2019,8,25,7,0,0.}],7.,{25.038,121.433}},{DateObject[{2019,8,25,7,0,0.}],4.,{25.0786,121.366}},{DateObject[{2019,8,25,7,0,0.}],9.,{24.5653,120.82}},{DateObject[{2019,8,25,7,0,0.}],8.,{25.017,121.516}},{DateObject[{2019,8,25,7,0,0.}],8.,{24.8639,121.216}},{DateObject[{2019,8,25,7,0,0.}],30.,{24.9957,121.304}},{DateObject[{2019,8,25,7,0,0.}],10.,{24.9542,121.205}},{DateObject[{2019,8,25,7,0,0.}],21.,{25.1059,121.515}}},
DateObject[{2019,8,25,8,0,0.}]->{{DateObject[{2019,8,25,8,0,0.}],13.,{24.9825,121.452}},{DateObject[{2019,8,25,8,0,0.}],10.,{24.5653,120.82}},{DateObject[{2019,8,25,8,0,0.}],13.,{24.9001,121.039}},{DateObject[{2019,8,25,8,0,0.}],8.,{25.013,121.459}},{DateObject[{2019,8,25,8,0,0.}],8.,{25.038,121.433}},{DateObject[{2019,8,25,8,0,0.}],5.,{25.0465,121.508}},{DateObject[{2019,8,25,8,0,0.}],9.,{24.697,120.899}},{DateObject[{2019,8,25,8,0,0.}],6.,{24.3829,120.759}},{DateObject[{2019,8,25,8,0,0.}],18.,{24.9533,121.222}},{DateObject[{2019,8,25,8,0,0.}],8.,{25.0603,121.202}},{DateObject[{2019,8,25,8,0,0.}],8.,{25.069,121.481}},{DateObject[{2019,8,25,8,0,0.}],11.,{24.7406,121.089}},{DateObject[{2019,8,25,8,0,0.}],18.,{25.1059,121.515}},{DateObject[{2019,8,25,8,0,0.}],21.,{24.8639,121.216}},{DateObject[{2019,8,25,8,0,0.}],10.,{25.017,121.516}},{DateObject[{2019,8,25,8,0,0.}],13.,{24.9542,121.205}},{DateObject[{2019,8,25,8,0,0.}],10.,{24.2566,120.742}},{DateObject[{2019,8,25,8,0,0.}],23.,{24.9957,121.304}},{DateObject[{2019,8,25,8,0,0.}],9.,{25.05,121.579}},{DateObject[{2019,8,25,8,0,0.}],5.,{24.9772,121.538}},{DateObject[{2019,8,25,8,0,0.}],11.,{25.0206,121.53}},{DateObject[{2019,8,25,8,0,0.}],13.,{25.0624,121.527}},{DateObject[{2019,8,25,8,0,0.}],6.,{25.0355,121.083}}},
DateObject[{2019,8,25,9,0,0.}]->{{DateObject[{2019,8,25,9,0,0.}],6.,{25.069,121.481}},{DateObject[{2019,8,25,9,0,0.}],7.,{25.0206,121.53}},{DateObject[{2019,8,25,9,0,0.}],9.,{25.038,121.433}},{DateObject[{2019,8,25,9,0,0.}],5.,{25.0465,121.508}},{DateObject[{2019,8,25,9,0,0.}],5.,{25.0355,121.083}},{DateObject[{2019,8,25,9,0,0.}],12.,{24.9001,121.039}},{DateObject[{2019,8,25,9,0,0.}],16.,{24.8639,121.216}},{DateObject[{2019,8,25,9,0,0.}],8.,{25.0624,121.527}},{DateObject[{2019,8,25,9,0,0.}],7.,{24.2566,120.742}},{DateObject[{2019,8,25,9,0,0.}],10.,{25.1059,121.515}},{DateObject[{2019,8,25,9,0,0.}],5.,{25.0603,121.202}},{DateObject[{2019,8,25,9,0,0.}],14.,{24.9533,121.222}},{DateObject[{2019,8,25,9,0,0.}],13.,{24.7406,121.089}},{DateObject[{2019,8,25,9,0,0.}],12.,{24.9542,121.205}},{DateObject[{2019,8,25,9,0,0.}],25.,{25.05,121.579}},{DateObject[{2019,8,25,9,0,0.}],10.,{25.017,121.516}},{DateObject[{2019,8,25,9,0,0.}],9.,{24.9825,121.452}},{DateObject[{2019,8,25,9,0,0.}],12.,{24.5653,120.82}},{DateObject[{2019,8,25,9,0,0.}],17.,{24.9772,121.538}},{DateObject[{2019,8,25,9,0,0.}],11.,{25.013,121.459}},{DateObject[{2019,8,25,9,0,0.}],9.,{24.697,120.899}},{DateObject[{2019,8,25,9,0,0.}],15.,{24.9957,121.304}},{DateObject[{2019,8,25,9,0,0.},
"Instant","Gregorian",8.],8.,{24.3829,120.759}}}|>;

I hope that Manipulate can display GeoDensityPlot based on time series. The document mentions that the data needs to be converted into a dated entity. I tried for a long time but failed~~ How should I do it?

POSTED BY: Tsai Ming-Chou
3 Replies
Posted 3 years ago

Hi Tsai,

I don't think GeoDensityPlot can plot time series data. Maybe you are trying to do this?

byDateAndPosition = Map[<|GeoPosition@Last@# -> #[[2]]|> &, data, {2}] // Map[Association]

Manipulate[GeoDensityPlot[byDateAndPosition[date]], {date, Keys@assoc}]

enter image description here

POSTED BY: Rohit Namjoshi

It should be that I did not express the problem clearly~~ As you can see, I have time-series data for each observation point. I want to display the time series data of each observation point in the Manipulate and display GeoDensityPlot at the same time. In other words, DateListPlot and GeoDensityPlot can be synchronized. So I want to know how to establish a suitable data type to achieve the above goals.

Thanks for the example you provided, I will try it. I hope if it can succeed~~

POSTED BY: Tsai Ming-Chou
Posted 3 years ago

Can you please explain in more detail?

There are 24 observation points, most of them have data values for three date/time, some have just two or one. So there are 24 time series. A DateListPlot will show 24 lines, each line connecting two or three points.. A GeoDensityPlot needs data values for several locations (observation points). In the Manipulate code above, the values for the selected day are used. What do you mean by

DateListPlot and GeoDensityPlot can be synchronized

If you want the time series by observation point

Values[data] // Flatten[#, 1] & // GroupBy[Last -> Most] // KeyMap[GeoPosition]
POSTED BY: Updating Name
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract