library(tidyverse)
library(dygraphs)
library(xts)
library(lubridate)
library(rnoaa)
library(mgcv)
library(mapview)
library(sf)
mapviewOptions(basemaps =c("Esri.WorldImagery","OpenStreetMap","Esri.WorldStreetMap", "OpenTopoMap"))
get_ghcnd <- function(id="UK000056225"){
require(reshape2)
require(rnoaa)
climate_data<-ghcnd(id)
meas<-paste("VALUE",1:31,sep="")
climate_data<-melt(climate_data,id=c("year","month","element"),m=meas)
climate_days<-as.numeric(gsub("VALUE","",climate_data$variable))
climate_year<-as.numeric(as.character(climate_data$year))
climate_month<-as.numeric(as.character(climate_data$month))
climate_data$date<-as.Date(sprintf("%04d-%02d-%02d",climate_year,climate_month,climate_days))
d<-data.frame(date=climate_data$date,element=climate_data$element,value=climate_data$value)
d<-na.omit(d)
d
}
max_min<-function(stat="UKE00105903")
{
require(mgcv)
d<-get_ghcnd(stat)
d$year<-year(d$date)
d$month<-month(d$date)
d$week<-week(d$date)
d$yday<-yday(d$date)
d %>% filter(element=="TMAX") %>% mutate(value=value/10) ->d1
d1 %>% filter(year<2023) ->d1
mod<-gam(data=d1,value~s(yday+s(year)))
d1$max_trend<-predict(mod)
d %>% filter(element=="TMIN") %>% mutate(value=value/10) ->d2
d2 %>% filter(year<2023) ->d2
mod<-gam(data=d2,value~s(yday+s(year)))
d2$min_trend<-predict(mod)
dd1<-data.frame(date=d1$date,max_trend=d1$max_trend,max=d1$value)
dd2<-data.frame(date=d2$date,min_trend=d2$min_trend,min=d2$value)
dd1<-merge(dd1,dd2)
dd1
}
# hovid<-max_min("MG000044218")
# choibalsan<-max_min("MG000044259")
# petra <-max_min("KZ000028676")
#
# save(hovid,choibalsan,petra,file="mongolia.rda")
load("mongolia.rda")
hovid$name<-"Hovid"
choibalsan$name<-"Choibalsan"
petra$name<-"Petrobavlosk"
d<-rbind(hovid,choibalsan,petra)
d$year<-year(d$date)
Yesterday I posted a brief analysis of daily climate data from the UK in order to look at the potential risk of extreme heat associated with a global trend towards higher average temperatures.
https://rpubs.com/dgolicher/heat_waves
The air today has cooled due to a westerly flow from the Atlantic. The climate of the UK is particularly maritime, which does lead to rather rapid fluctuations in temperature.
The NOAA global Historical climate database GHCND is a gold mine for research on empirical climate patterns that can help support and/or test predictions from global circulation models. A common issue when daily temperature records are analysed is the problems caused by urban heat island effects and the influence of changing land use. Another problem when looking at records from the UK and many other densely populated areas is that they tend to be close to the coat. Thus the influence of ocean temperatures and air movements from the sea can play an important role in determining maximum temperatures regardless of the effect of any change in mean global temperature (Comrie and McCabe 2012).
The GHCND has surprisingly complete records from central Asia, particularly Mongolia and Kazakhstan. This area is interesting as it lies about as far away from any oceanic influences as its possible to get. Land use change has been minimal overall, and the area is not urbanised. Therefore it provides a chance to look at how terrestrial temperatures may be changing with fewer confounding factors.
The raw data from two Mongolian and one station in Kazakhstan have been downloaded and reshaped. Clicking on the dygraphs opens up the whole data set for inspection.
Notice that as the temperatures are virtually free from the effects of oceanic air they show an almost clockwork like seasonal regularity with relatively little day to random noise.
To look at overall trends the data can be summarised for each calendar year.
In order to look at seasonal patterns for each station the mean temperature (max+min/2) was taken for each day and the mean calculated for each month.
The results provide a rather mixed picture. The overall increasing trend in the yearly means for both maxim and minimum temperatures is significant and it does follow the pattern shown in aggregated global terrestrial data series and satellite derived measurements of tropospheric temperatures. However there is no significant increase in peak temperatures whilst the mean diurnal range has decreased. This suggests that atmospheric humidity may have increased in the region leading to a buffering effect that raises minimum temperatures whilst preventing peak maximums. The monthly breakdown suggests slight warming in the winter, but no significant trend at the height of summer. Therefore the lack of an increase in peak temperatures is not unexpected.
There is some potential for cherry picking within these data sets. For example (Nandintsetseg, Greene, and Goulden 2007) report that “Significant increases are detected in the annual number of hot days and warm nights in this region. Associated with these changes are concomitant decreases in the annual number of cold days and cold nights. The number of days with precipitation has increased slightly while the annual total precipitation has not significantly increased in northern Mongolia. On an average, there was no significant decrease in the maximum number of consecutive dry days or increase in the wet days. The 5-day precipitation total showed a small increase.”
Likewise in the journal of Weather and Climate Extremes Dashkhuu et al. (2015) wrote “A significant reduction at a rate of -0.6 d decade(-1) (-1.0 d decade(-1)) occurred for cool nights (days), and a significant increase at a rate of 2.8 d decade(-1) (3.1 d decade(-1)) occurred for warm nights (days). The reduction of cool nights and cool days occurred over four seasons, while the increaseof warm days and warm nights occurred mainly in summer”
Daily data from the GHCND for three stations in Central Asia show an overall recent warming trend. Increases in temperature are most noticeable in the winter. There is no clear indication of a corresponding increase in extreme high temperatures in Summer.