Esempio n. 1
0
	baselink 	= "http://users.rcc.uchicago.edu/~davidkelly999/agmerra.origgrid.2deg.tile"
	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		
if __name__ == '__main__':
	
	ng    = NetcdfGeometry()
	df    = DileFactory()
	timer = Chrono()

	path  = "/sdiles/ubuntu/sdiles/sdile_tasmax_2_0_1.nc"
	fname = pathLeaf(path,False)
	

	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..."