def year_seq(self,_,line): if line[0] == '#': return args = line.rstrip().split(","); quad = [ float(args[0]), float(args[1]), float(args[2]), float(args[3]) ] size = int(args[4]) startYear = int(args[5]) startMonth = int(args[6]) endYear = int(args[7]) endMonth = int(args[8]) for month in partitions.month_partition(datetime.datetime(startYear,startMonth,1),datetime.datetime(endYear,endMonth,1)): for seq in seqs.sequencesFromQuadrangle(size / 120.0,quad): yield "{}-{:02d}".format(month.year,month.month),(size,seq)
def year_seq(self, _, line): if line[0] == '#': return args = line.rstrip().split(",") quad = [float(args[0]), float(args[1]), float(args[2]), float(args[3])] size = int(args[4]) startYear = int(args[5]) startMonth = int(args[6]) endYear = int(args[7]) endMonth = int(args[8]) for month in partitions.month_partition( datetime.datetime(startYear, startMonth, 1), datetime.datetime(endYear, endMonth, 1)): for seq in seqs.sequencesFromQuadrangle(size / 120.0, quad): yield "{}-{:02d}".format(month.year, month.month), (size, seq)
# The quadrangle to cover quad = json.loads(sys.argv[3]) # The start and end year/month start = datetime.datetime.strptime(sys.argv[4],"%Y-%m") # start month end = datetime.datetime.strptime(sys.argv[5],"%Y-%m") # end month # The prefix for the output files prefix = sys.argv[6] # Compute the degree size of the quadrangles size = resolution / 120.0 # Iterate over the months for yearMonth in partitions.month_partition(start,end): # Iterate over the sequence numbers for the quadrangle for seq in seqs.sequencesFromQuadrangle(size,quad): # Fetch a sequence number's data obj = fetchQuadrangle(dataset,yearMonth,resolution,seq) if obj != None: # Serialize the data as JSON fileName = "{}{}-{:02d}-{}-{}.json".format(prefix,yearMonth.year,yearMonth.month,resolution,seq) f = open(fileName,"w") json.dump(obj,f) f.write("\n") f.close()
quad = json.loads(sys.argv[3]) # The start and end year/month start = datetime.datetime.strptime(sys.argv[4], "%Y-%m") # start month end = datetime.datetime.strptime(sys.argv[5], "%Y-%m") # end month # The prefix for the output files prefix = sys.argv[6] # Compute the degree size of the quadrangles size = resolution / 120.0 # Iterate over the months for yearMonth in partitions.month_partition(start, end): # Iterate over the sequence numbers for the quadrangle for seq in seqs.sequencesFromQuadrangle(size, quad): # Fetch a sequence number's data obj = fetchQuadrangle(dataset, yearMonth, resolution, seq) if obj != None: # Serialize the data as JSON fileName = "{}{}-{:02d}-{}-{}.json".format(prefix, yearMonth.year, yearMonth.month, resolution, seq) f = open(fileName, "w") json.dump(obj, f) f.write("\n") f.close()