edzer / sdsr

Spatial Data Science: With Applications in R (source files)
https://r-spatial.org/book
Other
235 stars 86 forks source link

How to get the air quality dataset in Chapter 16 Interpolation and Geostatistics #40

Closed xiaochi-liu closed 4 years ago

xiaochi-liu commented 4 years ago

Hello @edzer. I'm reading your book Spatial Data Science. It's awesome! I like doing spatial analysis in the sf way~

I have a little question In chapter 16, although the URL of air quality data is provided, and it is said:

It returns a text file with a set of URLs to CSV files, each containing the hourly values for the whole period for a single measurement station. These files were downloaded and converted to the right encoding using the dos2unix command line utility.

I'm still confused about how to get the data in the right place so that I can follow this chapter. Could you please provide more details?

Many thanks for your kind guidance!

edzer commented 4 years ago

I used the following script

f = function(str) {
    cmd = paste("wget", str)
    system(cmd)
    print(cmd)
    s = basename(cmd)
    system(paste("dos2unix", s))
    ret = read.csv(s)
    system(paste("rm", s))
    ret
}
source("DL.Rest",,T)
length(str)
l = lapply(str, f)
save(l, file = "NO2_.RData")

I commintted the file DL.Rest to the repository, directory aq.

xiaochi-liu commented 4 years ago

Thank you so much for your speedy response @edzer ! Downloading the data now~

xiaochi-liu commented 4 years ago

Hello @edzer , I'm downloading the data from the URLs provided in the DL.Rest the whole day, and it's still going on. I just checked these URLs and found that they are all other countries (NL, BE, FR, AT, CZ, PL, DK, and CH), not Germany (DE).

Therefore, I was wondering whether the data provided by DL.Rest is the data needed in this Chapter? Or is this link (https://fme.discomap.eea.europa.eu/fmedatastreaming/AirQualityDownload/AQData_Extract.fmw?CountryCode=DE&CityName=&Pollutant=8&Year_from=2017&Year_to=2017&Station=&Samplingpoint=&Source=E1a&Output=TEXT&UpdateDate=) the actual data of this Chapter? Thanks!

edzer commented 4 years ago

It looks like that - I think only the German data were used in the chapter - I planned to also use neighboring countries but then didn't (or still need to).

xiaochi-liu commented 4 years ago

Thank you so much @edzer ! Finally downloaded the data of the other countries, I will download the German data following the same procedure.