basefilelink = baselink + "/0004/clim_0004_0047.tile.nc4" sdilesfolder = "results/sdiles/" # basefile setup print "downloading base file..." timer.start() basefile = kg.downloadFile(basefilelink, "results/base/") basenc = ncOpen(basefile) basefolder = "results/" timer.stop() print "basefile downloaded in ", timer.formatted() timer.reset('basefile downloaded') # ---- loping part starts ---- # #inizialization dile = Dile(2,0,3) bbox = dile.asBoundingBox() lats = linspace(bbox['lat_min'],bbox['lat_max'],dile.YSIZE, endpoint=True) lons = linspace(bbox['lon_min'],bbox['lon_max'],dile.XSIZE, endpoint=True) bboxidxs = kc.bbox_to_indices(bbox) # superdiles creation print "creating super diles..." timer.start()
print "computing md5 for ", fname, "..." timer.start() md5 = getMD5(path) timer.stop() print "md5 computed in: ", timer.formatted() rgrp = ncOpen(path, mode='r') bb = ng.getBoundingBox(rgrp['lat'],rgrp['lon']) zoom = ng.getZoomLevel(rgrp['lat'], rgrp['lon']) mim = MetaIngesterMongo(rgrp) url = " http://s3.amazonaws.com/edu-uchicago-rdcep-diles/" url += str(md5)+'/'+str(fname)+'/' mim.onConnect('test', 'diles') timer.reset() print "ingesting metadata..." timer.start() ndocs = mim.onIngest(path, url, bb, zoom) timer.stop() mim.onClose() rgrp.close() print chr(27) + "[2J" #escape sequence print ndocs, "documents ingested. task completed in: ", timer.formatted()