문제

I am currently trying to automate a weather grabbing process from Environment Canada. The site of interest is located at:

http://dd.weatheroffice.ec.gc.ca/ensemble/naefs/xml/20140515/12/WIND-SFC/raw/

I have attempted to use getURL, xmlTreeParse, bzfile and download.file however each one fails in a different way.

download.file("http:/dd.weatheroffice.ec.gc.ca/ensemble/naefs/xml/20140515/00/TMP-SFC/raw/2014051500_GEPS-NAEFS-RAW_ABBOTSFORD_BC_CA_TMP-SFC_000-384.xml.bz2",basename("http:/dd.weatheroffice.ec.gc.ca/ensemble/naefs/xml/20140515/00/TMP-SFC/raw/2014051500_GEPS-NAEFS-RAW_ABBOTSFORD_BC_CA_TMP-SFC_000-384.xml.bz2"))

Error in download.file("http:/dd.weatheroffice.ec.gc.ca/ensemble/naefs/xml/20140515/00/TMP-SFC/raw/2014051500_GEPS-NAEFS-RAW_ABBOTSFORD_BC_CA_TMP-SFC_000-384.xml.bz2", : unsupported URL scheme

xmlTreeParse("http:/dd.weatheroffice.ec.gc.ca/ensemble/naefs/xml/20140515/00/TMP-SFC/raw/2014051500_GEPS-NAEFS-RAW_ABBOTSFORD_BC_CA_TMP-SFC_000-384.xml.bz2")

Error: XML content does not seem to be XML: 'http:/dd.weatheroffice.ec.gc.ca/ensemble/naefs/xml/20140515/00/TMP-SFC/raw/2014051500_GEPS-NAEFS-RAW_ABBOTSFORD_BC_CA_TMP-SFC_000-384.xml.bz2'

Bzfile does produce an output however I have not been able to use that output to generate data. I have looked through many of the other questions regarding XML however, it seems many of the other individuals have these files on their local machine, which I would like to avoid. Further others were not dealing with bz2 xmls however I don't believe that, that is my issue.

Any thoughts?

Thanks in advance!

도움이 되었습니까?

해결책

Might be on your side. I'm not getting any errors with:

 download.file("http://dd.weatheroffice.ec.gc.ca/ensemble/naefs/xml/20140515/00/TMP-SFC/raw/2014051500_GEPS-NAEFS-RAW_ABBOTSFORD_BC_CA_TMP-SFC_000-384.xml.bz2", 
                  destfile="test")

trying URL 'http://dd.weatheroffice.ec.gc.ca/ensemble/naefs/xml/20140515/00/TMP-SFC/raw/2014051500_GEPS-NAEFS-RAW_ABBOTSFORD_BC_CA_TMP-SFC_000-384.xml.bz2'
Content type 'application/x-bzip2' length 6370 bytes
opened URL
==================================================
downloaded 6370 bytes
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top