source: cows_wps/trunk/process_modules/lib_get_weather_stations/utils.py @ 6873

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/cows_wps/trunk/process_modules/lib_get_weather_stations/utils.py@6873
Revision 6873, 983 bytes checked in by astephen, 10 years ago (diff)

Added and updated various code to match security, download URLs that are
secured and chunking of MIDAS outputs.

Line 
1"""
2utils.py
3========
4
5Utils for get_weather_stations.py that holds the GetWeatherStations class.
6
7Also supports the extract_uk_station_data.py module.
8
9"""
10
11import sys
12import logging
13
14# Import local modules
15sys.path.append("/home/badc/software/datasets/ukmo-midas/scripts/extract")
16# MIDAS Station search code
17import getStations
18
19log = logging.getLogger(__name__)
20log.setLevel(logging.DEBUG)
21
22
23def getStationList(counties, bbox, dataTypes, startTime, endTime, outputFile):
24    """
25    Wrapper to call of midas station getter code.
26    """
27    station_getter = getStations.StationIDGetter(counties, bbox = bbox, dataTypes = dataTypes, 
28                       startTime = startTime, endTime = endTime, outputFile = outputFile, noprint = 1) 
29
30    return station_getter.stList
31
32
33def revertDateTimeToLongString(dt):
34    """
35    Turns a date/time into a long string as needed by midas code.
36    """
37    return str(dt).replace("-", "").replace(" ", "").replace("T", "").replace(":", "") 
38
Note: See TracBrowser for help on using the repository browser.