changeset 856:e310577cc0b8

updated function (url) for weather data
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Wed, 05 Oct 2016 13:31:42 -0400
parents 2277ab1a8141
children 6d89520e269f
files python/utils.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/python/utils.py	Tue Sep 27 17:37:56 2016 -0400
+++ b/python/utils.py	Wed Oct 05 13:31:42 2016 -0400
@@ -898,6 +898,7 @@
 
     Example: MONTREAL MCTAVISH	10761
              MONTREALPIERRE ELLIOTT TRUDEAU INTL A	5415
+    see ftp://client_climate@ftp.tor.ec.gc.ca/Pub/Get_More_Data_Plus_de_donnees/Station%20Inventory%20EN.csv
 
     To get daily data for 2010 and 2011, downloadECWeather(10761, [2010,2011], [], '/tmp')
     To get hourly data for 2009 and 2012, January, March and October, downloadECWeather(10761, [2009,2012], [1,3,10], '/tmp')'''
@@ -914,7 +915,8 @@
 
     for year in years:
         for month in months:
-            url = urllib2.urlopen('http://climat.meteo.gc.ca/climateData/bulkdata_{}.html?format=csv&stationID={}&Year={}&Month={}&Day=1&timeframe={}&submit=++T%C3%A9l%C3%A9charger+%0D%0Ades+donn%C3%A9es'.format(language, stationID, year, month, timeFrame))
+            url = urllib2.urlopen('http://climate.weather.gc.ca/climate_data/bulk_data_{}.html?format=csv&stationID={}&Year={}&Month={}&Day=1&timeframe={}&submit= Download+Data'.format(language, stationID, year, month, timeFrame))
+            #http://climat.meteo.gc.ca/climateData/bulkdata_{}.html?format=csv&stationID={}&Year={}&Month={}&Day=1&timeframe={}&submit=++T%C3%A9l%C3%A9charger+%0D%0Ades+donn%C3%A9es
             data = url.read()
             outFilename = '{}/{}-{}'.format(outputDirectoryname, stationID, year)
             if timeFrame == 1: