# Time series repressentations

**URL:** <https://forum.generic-mapping-tools.org/t/time-series-repressentations/911>\
**Category:** Q&A\
**Created:** [September 25, 2020, 1:53pm UTC](https://forum.generic-mapping-tools.org/t/time-series-repressentations/911 "2020-09-25T13:53:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yacob](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/yacob/32/576_2.png) [@Yacob](https://forum.generic-mapping-tools.org/u/Yacob)\
**Post date:** [September 25, 2020, 1:53pm UTC](https://forum.generic-mapping-tools.org/t/time-series-repressentations/911/1 "2020-09-25T13:53:06Z")

</div>

I wanted to plot a time series (the time series file has a **calendar date and a temperature** ) like as shown below. Is it possible to use a polar projection first by assigning each calendar date to represent as **azimuth** value? Here I assign April month aligned to North (an azimuth of 0) and January month assigned to 90 degrees and, so on. The elevation angle needed for the polar projection comes from the temperature values but first scaling (renormalizing ) between the range 0 - 90 degrees.

Does this work or Is there a simpler/better way in GMT?

 ![IMG-3884(1)](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/1X/f58086bf6d2edc0d7c18c826a31dca3469a91464.jpeg)

---

<div class="post-metadata">

**Author:** ![Esteban82](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/esteban82/32/54_2.png) [@Esteban82](https://forum.generic-mapping-tools.org/u/Esteban82)\
**Post date:** [September 25, 2020, 4:48pm UTC](https://forum.generic-mapping-tools.org/t/time-series-repressentations/911/2 "2020-09-25T16:48:20Z")

</div>

I think that you only need to to normalize/scale the dates to 360. This should be easy (or not) depending on the format of the dates.

For the temperatures there is no need to normalize to 0-90. You could plot any values (as long as are all positives).

---

<div class="post-metadata">

**Author:** ![MarceloBanik](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/marcelobanik/32/479_2.png) [@MarceloBanik](https://forum.generic-mapping-tools.org/u/MarceloBanik)\
**Post date:** [September 25, 2020, 6:21pm UTC](https://forum.generic-mapping-tools.org/t/time-series-repressentations/911/3 "2020-09-25T18:21:04Z")

</div>

you could try something like:

```
#!/bin/bash
year=2020
Tmin=10
Tmax=40
yearMin=$(echo "$year-01-01T00:00:00" | gmt convert -fi0T -fo0t)
yearMax=$(echo "$(($year+1))-01-01T00:00:00" | gmt convert -fi0T -fo0t)
delYear=$(echo "$yearMax-$yearMin" | bc -l)

declare -A month=([01]=Jan [02]=Feb [03]=Mar [04]=Apr [05]=May [06]=Jun
		  [07]=Jul [08]=Aug [09]=Sep [10]=Oct [11]=Nov [12]=Dec)

for m in ${!month[*]}; do
    echo "$year-${m}-01T00:00:00 ag ${month[$m]}"
done | gmt convert -fi0T -fo0t | \
    awk -v o=$yearMin -v s=$delYear '{print (($1-o)/s)*360,$2,$3}' > labels.txt

cat <<EOF > test.dat
2020-03-01T00:00:00 $Tmin
2020-09-25T12:00:00 25
2020-09-01T00:00:00 $Tmax
EOF

gmt begin test png
gmt set FONT_ANNOT_PRIMARY=24p,Helvetica,black MAP_GRID_PEN_PRIMARY=thin,black,-
gmt basemap -X2c -JP18c+f -R-180/180/$Tmin/$Tmax -Bxclabels.txt -Byg10
gmt convert -fi0T,1f -fo0t,1f test.dat | \
    awk -v o=$yearMin -v s=$delYear '{print (($1-o)/s)*360,$2}' | \
    gmt plot -Sc8p -Gorange
gmt end

```

That results in:

 ![test](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/1X/7d730f3d84a1e5603003481d28e79241060b149c.png)

---

<div class="post-metadata">

**Author:** ![Yacob](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/yacob/32/576_2.png) [@Yacob](https://forum.generic-mapping-tools.org/u/Yacob)\
**Post date:** [September 25, 2020, 10:05pm UTC](https://forum.generic-mapping-tools.org/t/time-series-repressentations/911/4 "2020-09-25T22:05:08Z")

</div>

MarceloBanik, Simply brilliant solution. Thank you so much and appreciated.

/Yacob
