It can be useful to get a summary of the daily weather for a site. For example, this can be useful when writing up a trip report and comments on the weather will add to the understanding of the activities.
The routines here focus on a single WMO Weather Station (see the Climate section on how to get the station numbers) and a single month.
Show the code
## Core packageslibrary(tidyverse) ## General data manipulationlibrary(lubridate) ## Date functionslibrary(gt) ## Tableslibrary(gtExtras) ## Table printinglibrary(webshot2) ## Print GT tables## Specialized packages##install_github("bczernecki/climate")library(climate) ## Support for meteo_ogimetlibrary(hms) ## Format time##library(geosphere) ## Lots of specialized geometry calculations
5.0.1 Extract Weather Data
The routines here extract daily weather data for a specific station over a one-month period.
All the useful data fields are extracted and formatted into a table.
A few station ID numbers are listed for testing.
Show the code
## Choose a station WHO Weather Station (by number).station <-91182## Specify a year and month number.year <-2023month <-5
5.1 Process the Request
Show the code
## Process the request. ################################ Table caption.caption_info <-paste0("WHO Weather Station: ",station)## Format the date information.begin <-ymd(paste(year,"-",month,"-1"))finish <-ymd(paste(year,"-",month,"-",days_in_month(month)))## Extract the daily data for the period.daily <-meteo_ogimet(interval ="daily", date =c(begin, finish), station = station)
## Pare down the data and rename the columns, then sort by Date.useful_daily <- daily |>select(-PreselevHp,-SunD1h,-SnowDepcm) |>rename(Avg = TemperatureCAvg) |>rename(Max = TemperatureCMax) |>rename(Min = TemperatureCMin) |>rename(Dew = TdAvgC) |>rename(Hum = HrAvg) |>rename(Dir = WindkmhDir) |>rename(Speed = WindkmhInt) |>rename(Pres = PresslevHp) |>rename(Ppt = Precmm) |>rename(Total = TotClOct) |>rename(Low = lowClOct) |>rename(Vis = VisKm) |>arrange(Date)
5.2 Create the Tables
There are enough variables recorded that two tables are required.
Note that some stations report wind gusts; others don’t include this measurement. This adds some complexity to the table creation process. However, seeing how this is done might be important if this routine is adapted to other places where there is “unusual” data reporting.
Show the code
if("WindkmhGust"%in%names(useful_daily)){ useful_daily <- useful_daily |>rename(Gust = WindkmhGust)}## Arrange the columns for the first table.table1 <- useful_daily |>select(Date, Avg, Max, Min, Dew, Hum, Ppt)## Print the first set of data.t1 <-gt(table1) |>opt_row_striping() |>## Caption the tabletab_header(title = caption_info) |>## Caption sets of columnstab_spanner(label ="Temperature",columns =c(Avg, Max, Min)) |>## Source Informationtab_source_note(source_note ="Source: Extracted using ogimet") |>## Footnotestab_footnote(footnote ="degrees C @ 2 m AGL",locations =cells_column_labels(columns=c(Avg, Max, Min))) |>tab_footnote(footnote ="average dewpoint, degrees C @ 2 m AGL",locations =cells_column_labels(columns=Dew)) |>tab_footnote(footnote ="average relative humidity, %",locations =cells_column_labels(columns=Hum)) |>tab_footnote(footnote ="precipitation, mm",locations =cells_column_labels(columns=Ppt)) |>tab_options(table.align ="left")## Prepare the second table.if("Gust"%in%names(useful_daily)){ col_list <-c("Date","Dir","Speed","Gust","Pres","Total","Low","Vis") wind_span <-c("Dir","Speed","Gust")} else { col_list <-c("Date","Dir","Speed","Pres","Total","Low","Vis") wind_span <-c("Dir","Speed")} table2 <- useful_daily |>select(col_list)## Print the second set of data.t2 <-gt(table2) |>opt_row_striping() |>## Caption the tabletab_header(title = caption_info) |>## Caption sets of columnstab_spanner(label ="Wind",columns = wind_span) |>tab_spanner(label ="Clouds",columns =c(Total, Low)) |>## Source Informationtab_source_note(source_note ="Source: Extracted using ogimet") |>## Footnotestab_footnote(footnote ="wind direction",locations =cells_column_labels(columns=Dir)) |>tab_footnote(footnote ="wind speed, km/h",locations =cells_column_labels(columns=Speed)) |>tab_footnote(footnote ="sea level pressure, hPa",locations =cells_column_labels(columns=Pres)) |>tab_footnote(footnote ="total cloudiness, octants",locations =cells_column_labels(columns=Total)) |>tab_footnote(footnote ="cloudiness by low level clouds, octants",locations =cells_column_labels(columns=Low)) |>tab_footnote(footnote ="visibility, km",locations =cells_column_labels(columns=Vis)) |>tab_options(table.align ="left")## If there are gusts, add a footnote.if("Gust"%in%names(useful_daily)){ t2 <- t2 |>tab_footnote(footnote ="wind gusts, km/h",locations =cells_column_labels(columns=Gust))}## Print the tablest1
WHO Weather Station: 91182
Date
Temperature
Dew2
Hum3
Ppt4
Avg1
Max1
Min1
2023-05-01
24.4
27.8
22.2
18.7
71.6
0.0
2023-05-02
25.0
30.0
23.3
19.7
72.1
NA
2023-05-03
23.6
27.2
21.1
20.0
81.6
NA
2023-05-04
25.2
30.0
20.6
19.6
71.0
0.0
2023-05-05
25.7
30.0
22.8
19.1
68.1
NA
2023-05-06
25.4
29.4
23.9
18.4
66.1
NA
2023-05-07
25.5
29.4
22.2
18.3
64.7
NA
2023-05-08
25.5
29.4
22.8
17.9
63.1
0.0
2023-05-09
25.6
29.4
23.3
18.4
65.2
0.0
2023-05-10
25.6
29.4
22.2
18.8
66.5
NA
2023-05-11
25.5
29.4
22.2
18.6
66.6
NA
2023-05-12
23.2
26.1
21.1
20.3
84.4
0.8
2023-05-13
24.7
28.9
21.1
19.4
73.4
0.0
2023-05-14
24.7
29.4
21.1
18.3
68.6
0.0
2023-05-15
23.9
28.9
20.0
18.8
74.3
3.0
2023-05-16
24.2
28.3
20.6
16.4
61.9
0.0
2023-05-17
24.5
28.9
20.0
18.6
69.5
0.0
2023-05-18
24.8
30.0
21.7
18.9
70.0
0.0
2023-05-19
24.4
25.6
22.8
20.5
79.5
2.0
2023-05-20
24.5
28.9
21.7
21.0
79.9
12.0
2023-05-21
25.9
28.9
21.7
21.6
77.0
0.0
2023-05-22
26.9
30.6
24.4
20.3
68.0
0.0
2023-05-23
26.7
30.0
23.9
19.7
66.1
NA
2023-05-24
26.2
30.0
23.9
19.5
67.1
0.0
2023-05-25
26.3
30.6
23.9
19.6
68.2
NA
2023-05-26
25.1
30.0
22.2
18.9
68.3
NA
2023-05-27
25.5
29.4
22.8
17.5
62.1
0.0
2023-05-28
25.2
30.0
20.0
17.6
63.8
0.0
2023-05-29
24.6
28.3
21.1
18.9
70.6
0.0
2023-05-30
25.7
30.0
22.2
19.0
67.5
0.0
2023-05-31
26.2
30.0
23.9
19.2
65.7
0.0
Source: Extracted using ogimet
1 degrees C @ 2 m AGL
2 average dewpoint, degrees C @ 2 m AGL
3 average relative humidity, %
4 precipitation, mm
Show the code
t2
WHO Weather Station: 91182
Date
Wind
Pres4
Clouds
Vis7
Dir1
Speed2
Gust3
Total5
Low6
2023-05-01
NE
19.9
35.2
1017.9
2.5
NA
16.0
2023-05-02
ENE
12.0
NA
1015.8
5.0
NA
16.0
2023-05-03
ESE
9.7
NA
1014.3
4.0
NA
16.0
2023-05-04
ENE
17.6
38.9
1014.1
3.0
NA
16.0
2023-05-05
ENE
25.0
48.2
1015.1
3.5
NA
16.0
2023-05-06
ENE
29.2
48.2
1016.6
3.5
NA
16.0
2023-05-07
ENE
25.9
48.2
1017.2
5.0
NA
16.0
2023-05-08
ENE
23.2
46.3
1017.7
4.5
NA
16.0
2023-05-09
ENE
24.6
55.6
1018.1
2.5
NA
16.0
2023-05-10
NE
24.1
42.6
1018.1
2.5
NA
16.0
2023-05-11
ENE
18.1
42.6
1018.2
4.5
NA
16.0
2023-05-12
NNE
9.7
NA
1017.5
5.5
NA
16.0
2023-05-13
ESE
11.6
NA
1016.1
5.0
NA
16.0
2023-05-14
N
10.7
NA
1017.1
5.0
NA
16.0
2023-05-15
NNE
19.5
42.6
1017.3
4.0
NA
16.0
2023-05-16
NE
14.8
NA
1017.1
3.5
NA
16.0
2023-05-17
NNE
12.5
NA
1017.9
4.0
NA
16.0
2023-05-18
ENE
15.8
NA
1016.8
4.0
NA
16.0
2023-05-19
ESE
12.0
NA
1015.6
6.5
NA
16.0
2023-05-20
SE
7.9
NA
1016.1
5.5
NA
16.0
2023-05-21
ESE
9.3
NA
1018.3
3.0
NA
16.0
2023-05-22
ENE
19.0
38.9
1019.0
4.0
NA
16.0
2023-05-23
ENE
25.0
50.0
1018.0
5.0
NA
16.0
2023-05-24
NE
26.4
42.6
1017.9
3.0
NA
15.5
2023-05-25
ENE
22.2
48.2
1018.8
3.5
NA
16.0
2023-05-26
NE
19.0
51.9
1018.1
5.0
NA
16.0
2023-05-27
NE
15.3
40.8
1017.2
2.5
NA
16.0
2023-05-28
NNE
14.4
38.9
1016.7
3.5
NA
16.0
2023-05-29
ESE
12.0
NA
1017.0
4.0
NA
16.0
2023-05-30
NE
16.7
42.6
1016.8
3.5
NA
16.0
2023-05-31
ENE
22.7
46.3
1017.4
5.0
NA
16.0
Source: Extracted using ogimet
1 wind direction
2 wind speed, km/h
3 wind gusts, km/h
4 sea level pressure, hPa
5 total cloudiness, octants
6 cloudiness by low level clouds, octants
7 visibility, km
Show the code
## Save tablesgtsave(data=t1, filename ="Weather_table1.png")gtsave(data=t2, filename ="Weather_table2.png")
5.3 Interpretation
The two tables were sent to Claude-3 with the following request.
These two tables report the weather conditions for one month. Can you interpret these data and write a summary of the weather at this location for the month?
Here is the response.
The instructions are to interpret the weather data from the two tables showing temperature, humidity, precipitation, wind speed/direction, and cloud cover for the WHO Weather Station 91182 during the month of May 2023, and to write a summary of the weather conditions for that month.
Summary of weather conditions at WHO Weather Station 91182 for May 2023:
Temperatures were mild, with daily averages ranging from 23.2°C to 26.9°C (73.8°F to 80.4°F). The highest temperature reached was 30.6°C (87.1°F) on May 22-23, while the lowest was 21.1°C (70.0°F) on May 12-13.
Humidity levels were moderately high, typically in the 60-70% range. The highest humidity of 84.4% occurred on May 12.
Precipitation was minimal, with only 4 days recording any rainfall. The highest daily total was 12.0 mm on May 20.
Winds were generally from the ENE direction at speeds ranging from 9.7 to 26.4 km/h (6 to 16.4 mph). The strongest winds of 26.4 km/h from the NE were recorded on May 24.
Cloud cover was present on all days, with total cloudiness octant values between 2.5 and 5.5 throughout the month. Visibility remained good at 16.0 km on most days, except for a couple days with slightly lower 15.5 km visibility.
Overall, the month saw mild temperatures, moderately high humidity, light winds mostly from the ENE, minimal rainfall, and partly cloudy skies. The weather was generally pleasant and stable throughout May 2023 at this location.