rewrite = False RR = DataSelector(DATA) RR.getStations() # Total number of stations print "Number of stations: ", len(RR.stations.data["STAID"]) # Rewrite if not done yet. if not os.path.isdir("rewritten/{0}".format(DATA)): os.makedirs("rewritten/{0}".format(DATA)) print 'Rewriting' for station in RR.stations.data["STAID"]: f = RR.getSingleStation(station, mindate=20080101, maxdate=20090101) f.rewrite() RR.wipe_files() # Select the rewritten files RR_rewritten = DataSelector(DATA, "rewritten/") # Show the number of stations per country countries = set(RR.stations.data["CN"]) for country in countries: print country, " : ", RR.stations.data["CN"].count(country) # Get stations for each country d = {} for i in range(len(RR.stations.data["STAID"])): country = RR.stations.data["CN"][i]
from knmiDATA import DataSelector import os MINDATE = 20080100 MAXDATE = 20090101 for DATA in ["CC", "DD", "FG", "FX", "HU", "PP", "RR", "SD", "SS", "TG", "TN", "TX"]: RR = DataSelector(DATA) RR.getStations() # Total number of stations print "Number of stations: ", len(RR.stations.data["STAID"]) # Rewrite if not done yet. if not os.path.isdir("rewritten/{0}".format(DATA)): os.makedirs("rewritten/{0}".format(DATA)) print 'Rewriting' for station in RR.stations.data["STAID"]: f = RR.getSingleStation(station, mindate=MINDATE, maxdate=MAXDATE) f.rewrite() RR.wipe_files()