inbo/inborutils

Error while using read_knmi_rainfall()

Closed this issue · 1 comments

Contrarely to #37 I could create a text file for function read_knmi_rainfall as I found file rain_knmi_2012.Rda. However, after converting it in a semicolon separated text file, the function seems not recognizing it as a valid file. I get the following error:

> load("./data/rain_knmi_2012.rda")
> readr::write_csv2(rain_knmi_2012, path = "./data/rain_knmi_2012.csv")
> read_knmi_rainfall(filename = "./data/rain_knmi_2012.csv")
Error in as.data.frame(coordinate_info, row.names = coordinate_header) : 
  object 'coordinate_info' not found

After watching a little inside the function read_knmi_rainfall(), I think the file is not the right one.
@stijnvanhoey: do you have any idea about it? Thanks.

As you used a text-converted version of the 'cleaned' data from knmi, this is not the same as the text format as provided by KNMI itself:

# BRON: KONINKLIJK NEDERLANDS METEOROLOGISCH INSTITUUT (KNMI)
# Opmerking: door stationsverplaatsingen en veranderingen in waarneemmethodieken zijn deze tijdreeksen van uurwaarden mogelijk inhomogeen! Dat betekent dat deze reeks van gemeten waarden niet geschikt is voor trendanalyse. Voor studies naar klimaatverandering verwijzen we naar de gehomogeniseerde reeks maandtemperaturen van De Bilt <http://www.knmi.nl/klimatologie/onderzoeksgegevens/homogeen_260/index.html> of de Centraal Nederland Temperatuur <http://www.knmi.nl/klimatologie/onderzoeksgegevens/CNT/>.
# 
# 
# STN      LON(east)   LAT(north)     ALT(m)  NAME
# 310:         3.596       51.442       8.00  VLISSINGEN
# 319:         3.861       51.226       1.70  WESTDORPE
# 
# YYYYMMDD = datum (YYYY=jaar,MM=maand,DD=dag); 
# HH       = tijd (HH=uur, UT.12 UT=13 MET, 14 MEZT. Uurvak 05 loopt van 04.00 UT tot 5.00 UT; 
# DR       = Duur van de neerslag (in 0.1 uur) per uurvak; 
# RH       = Uursom van de neerslag (in 0.1 mm) (-1 voor <0.05 mm); 
# 
# STN,YYYYMMDD,   HH,   DR,   RH
# 
  310,20110101,    1,    0,   -1
  310,20110101,    2,    0,   -1
  310,20110101,    3,    0,   -1
  310,20110101,    4,    0,    0
  310,20110101,    5,    7,    1
  310,20110101,    6,    0,   -1
  310,20110101,    7,    0,   -1
  310,20110101,    8,    0,    0
...

The function actually aims to make the reading of this special data format easier. The example on how to download and read the KNMI data is explained in the vignette. I added an additional reference to the vignettes inside the roxygen docs to help the user.