"""Script to investigate relationship between specified bounding box and resolution in geoserver downloads via the REST interface.
"""

import os

bounding_box = [122.580, -2.00250, 126.60250, 2.02250]
res = 0.025
layer = 'shakemap_20110505155015'

bbox = ','.join([str(x) for x in bounding_box])
cmd = 'curl "http://localhost:8001/geoserver-geonode-dev/ows?version=1.0.0&service=wcs&request=getcoverage&format=GeoTIFF&store=false&coverage=%s&crs=EPSG:4326&bbox=%s&resx=%.12f&resy=%.12f" > dnld.tif' % (layer, bbox, res, res)

print cmd
os.system(cmd)
os.system('gdalinfo dnld.tif')

