<s> import urllib2 <EOL> import zlib <EOL> import StringIO <EOL> import numpy as np <EOL> import argparse <EOL> import cStringIO <EOL> import sys <EOL> def main ( ) : <EOL> parser = argparse . ArgumentParser ( description = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , action = "<STR_LIT:store>" ) <EOL> parser . add_argument ( '<STR_LIT>' , action = "<STR_LIT:store>" ) <EOL> parser . add_argument ( '<STR_LIT>' , action = "<STR_LIT:store>" ) <EOL> parser . add_argument ( '<STR_LIT>' , action = "<STR_LIT:store>" , type = int ) <EOL> parser . add_argument ( '<STR_LIT>' , action = "<STR_LIT:store>" , type = int ) <EOL> parser . add_argument ( '<STR_LIT>' , action = "<STR_LIT:store>" , type = int ) <EOL> parser . add_argument ( '<STR_LIT>' , action = "<STR_LIT:store>" , type = int ) <EOL> parser . add_argument ( '<STR_LIT>' , action = "<STR_LIT:store>" , type = int ) <EOL> parser . add_argument ( '<STR_LIT>' , action = "<STR_LIT:store>" , type = int ) <EOL> parser . add_argument ( '<STR_LIT>' , action = "<STR_LIT:store>" , type = int ) <EOL> result = parser . parse_args ( ) <EOL> url = '<STR_LIT>' + result . baseurl + '<STR_LIT>' + result . dataset + '<STR_LIT>' + str ( result . resolution ) + "<STR_LIT:/>" + str ( result . xlow ) + "<STR_LIT:U+002C>" + str ( result . xhigh ) + "<STR_LIT:/>" + str ( result . ylow ) + "<STR_LIT:U+002C>" + str ( result . yhigh ) + "<STR_LIT:/>" + str ( result . zlow ) + "<STR_LIT:U+002C>" + str ( result . zhigh ) + "<STR_LIT:/>" <EOL> xoffset = result . xlow <EOL> yoffset = result . ylow <EOL> zoffset = result . zlow <EOL> print "<STR_LIT>" , url <EOL> try : <EOL> f = urllib2 . urlopen ( url ) <EOL> except urllib2 . URLError , e : <EOL> print "<STR_LIT>" , url <EOL> print "<STR_LIT>" % ( e ) <EOL> sys . exit ( <NUM_LIT:0> ) <EOL> zdata = f . read ( ) <EOL> print "<STR_LIT>" <EOL> pagestr = zlib . decompress ( zdata [ : ] ) <EOL> pagefobj = StringIO . StringIO ( pagestr ) <EOL> cube = np . load ( pagefobj ) <EOL> annodata = np . zeros ( [ result . zhigh - result . zlow , result . yhigh - result . ylow , result . xhigh - result . xlow ] ) <EOL> vec_func = np . vectorize ( lambda x : <NUM_LIT:0> if x > <NUM_LIT:30> else <NUM_LIT> ) <EOL> annodata = vec_func ( cube ) <EOL> print np . nonzero ( annodata ) <EOL> url = '<STR_LIT>' % ( result . baseurl , result . token , result . resolution , result . xlow , result . xhigh , result . ylow , result . yhigh , result . zlow , result . zhigh ) <EOL> fileobj = cStringIO . StringIO ( ) <EOL> np . save ( fileobj , annodata ) <EOL> cdz = zlib . compress ( fileobj . getvalue ( ) ) <EOL> print "<STR_LIT>" , url <EOL> req = urllib2 . Request ( url , cdz ) <EOL> response = urllib2 . urlopen ( req ) <EOL> the_page = response . read ( ) <EOL> print "<STR_LIT>" <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> main ( ) </s>
