I’ve done a considerable upgrade to my function for retrieving model data from KNMI within R. This builds on the KNMI webpage but IMO is a considerable enhancement of it. I’ve made the script available here .
The function read.knmi.models is built as an emulator of the radio buttons.
Geert’s radio buttons (if I’m understanding things right) build a command in OpenDAP – the command excerpt “cgi?” comes from OpenDAP. OpenDAP was developed in the US for external retrieval of relevant portions of geographically structured data sets without downloading terabytes of data. There are some online manuals on OpenDAP, but I must confess that I’ve worked using Geert’s command structure as a template. The manuals on OpenDAP describe an installation program.
However, the system here: using R to access the KNMI installation seems to rather neatly accomplish the objectives of OpenDAP while working in a language and framework that is much more widely understood.
KNMI does not appear to have a convenient data frame of models and scenarios. I’ve collated information from their webpage as at a couple of months ago and placed it online. It is read as part of calling the functions, which can be done as follows:
dim(knmi.info) #86 4
# model alias scenario Runs
#1 BCC CM1 bcc_cm1 20c3m 4
#2 BCCR BCM2.0 bccr_bcm2_0 20c3m 1
#4 CGCM3.1 (T47) cccma_cgcm3_1 20c3m 5
Now logon using your email. KNMI asks users to register. I’ve done so. Their retrieval command requires an email address and the script here assumes that you have an email address on file with KNMI (the email address firstname.lastname@example.org is a placeholder.) The function download_html pings the website to log on, assuming that you’re registered.
email=Email=”email@example.com” ##REGISTER FIRST
Here’s a sample of retrieving model data. I’ll describe the fields in a minute.
landtype=”land”, lat=c(-20,20), long=c(0,360), version=”anomaly”)
plot.ts(test,main=paste(“giss_aom”, “sresa1b”) )
I experimented with recovering the centigrade values – something that Lucia asked for this morning, but haven’t debugged this.
The fields are as follows:
field – “tas” is the field name for temperature. Only one tested so far
model – use alias nomenclature from knmi.info.
scenario- use nomenclature from knmi.info. “20c3m” and “sresa1b” are examples. Radio “Scenario Runs” for nomenclature.
landtype – default is all. Can be “land” or “sea”
lat – south to north. default c(-90,90)
long – 0 to 360. default c(0,360)
version – default is anomaly. “centigrade” gets Centigrade
Info – requires knmi.info