bcgov / climr

An R package for downscaling monthly climate data for North America
https://bcgov.github.io/climr/
16 stars 5 forks source link

Add CRU/GPCC time series #231

Closed cmahony closed 6 months ago

cmahony commented 7 months ago

in addition to the climateNA observational time series, we can add the CRU ts (for tmin/tmax) and GPCC (precip) time series. GPCC is updated monthly. CRU is updated annually between march and May (last year it was april 19). this will provide users with alternatives and establish that there is observational uncertainty.

cmahony commented 7 months ago

cmip6NA WNA Tmin sm

cmahony commented 7 months ago

@kdaust i've updated the cru (1901-2022) and gpcc (1891-2023) gridded time series in the object storage bucket.

\objectstore2.nrs.bcgov\ffec\TimeSeries_gridded_monthly\cru_ts4.07 \objectstore2.nrs.bcgov\ffec\TimeSeries_gridded_monthly\GPCC

a couple of notes:

  1. the cru .nc files include a time series of station counts contributing to each cell. just FYI.
  2. ignore cru precipitation and tmp (average temperature) use tmn and tmx only
  3. the gpcc data are in absolute mm. calculate anomalies as % change.
cmahony commented 7 months ago

@kdaust this is at your discretion as to whether to add these now or wait until June. i recognize it may not be straightforward as we will need to change the downscale function calls to accommodate more than one source of observational data.

kdaust commented 7 months ago

@cmahony just out of curiosity, why aren't we using the CRU precipitation?

cmahony commented 7 months ago

CRU has very low precip station density in canada post year-2000.

kdaust commented 7 months ago

@cmahony I'll be combining these two datasets together, because each dataset needs to have tmin, tmax and precip. What should I call the resulting dataset in climr?

cmahony commented 7 months ago

how about cru_gpcc?

kdaust commented 7 months ago

@cmahony I've added gpcc_cru to climr devl, but was just running some tests and I'm concerned there's something wrong with tmin and tmax (either for the climatena or the gpcc), because I wasn't expecting them to be that different. See plots:

Min_Temp bcgov/climr/assets/34073038/07d72181-281b-495f-ad6b-eb6f05d45880) Max_Temp PPT

It's strange because PPT looks good, and temperature looks fine for January and August. Is this expected, or is something wrong?

cmahony commented 7 months ago

@kdaust i expect differences in raw values of temperature because CRU is the average for a 0.5-arcdegree grid cell, while climateNA is elevation adjusted to the point location. less so for precipitation because it is much noisier, which would reduce apparent biases relative to variability. but... if this is climr output then we shouldn't have these differences because both datasets should be bias corrected to the same 1961-1990 normal. reprex please!

kdaust commented 7 months ago

Right. I'm wondering if I did something wrong with the climate_na historic. I'll investigate.

Reprex:

library(climr)
library(data.table)
points_downscale_ref <- readRDS("tests/testthat/data/points_downscale_ref.rds")
pt <- points_downscale_ref

test_cru <- climr_downscale(pt, which_normal = "auto", 
                         historic_ts = 1950:2022,
                         historic_ts_dataset = "cru_gpcc",
                         return_normal = FALSE,
                         vars = paste0("Tmin", sprintf("%02d", 1:12))
)

test_climna <- climr_downscale(pt, which_normal = "auto", 
                            historic_ts = 1950:2015,
                            historic_ts_dataset = "climate_na",
                            return_normal = FALSE,
                            vars = paste0("Tmin", sprintf("%02d", 1:12))
)

test_cru[,dataset := "cru_gpcc"]
test_climna[,dataset := "climna"]
hist_all <- rbind(test_cru,test_climna)

hist <- melt(hist_all, id.vars = c("id","PERIOD","dataset"))
hist <- hist[id == 2,]
hist[,month := gsub("[^0-9.-]","",variable)]
hist[,date := as.Date(paste0(PERIOD,"-",month,"-01"))]

library(ggplot2)
ggplot(hist, aes(x = date, y = value, col = dataset)) +
  geom_line() +
  facet_wrap(~variable) +
  ylab("Tmin")
cmahony commented 6 months ago

cru_gpcc time series still isn't downscaling correctly (it should line up with the 1961-1990 baseline). image

cmahony commented 6 months ago

@kdaust it looks like cru won't release 2023 until june: https://crudata.uea.ac.uk/cru/data/hrg/crutsblog.htm#230424

kdaust commented 6 months ago

@cmahony ok I think cru_gpcc is fixed. I had a silly off-by-one error meaning the months weren't being matched up correctly. Please let me know if that fixes your timeseries plot. Historic_TS_plots