5
5
6
6
def quantize (data ,least_significant_digit ):
7
7
"""
8
+ quantize data to improve compression. data is quantized using
9
+ around(scale*data)/scale, where scale is 2**bits, and bits is determined
10
+ from the least_significant_digit. For example, if
11
+ least_significant_digit=1, bits will be 4.
8
12
9
- quantize data to improve compression. data is quantized using
10
- around(scale*data)/scale, where scale is 2**bits, and bits is determined
11
- from the least_significant_digit. For example, if
12
- least_significant_digit=1, bits will be 4.
13
-
14
- This function is pure python.
15
-
13
+ This function is pure python.
16
14
"""
17
15
precision = pow (10. ,- least_significant_digit )
18
16
exp = np .log10 (precision )
@@ -39,7 +37,7 @@ def get_coast_polygons(resolution):
39
37
for shprec in shf .shapeRecords ():
40
38
shp = shprec .shape ; rec = shprec .record
41
39
parts = shp .parts .tolist ()
42
- if parts != [0 ]:
40
+ if parts != [0 ]:
43
41
print 'multipart polygon'
44
42
raise SystemExit
45
43
verts = shp .points
@@ -70,7 +68,7 @@ def get_wdb_boundaries(resolution,level,rivers=False):
70
68
for shprec in shf .shapeRecords ():
71
69
shp = shprec .shape ; rec = shprec .record
72
70
parts = shp .parts .tolist ()
73
- if parts != [0 ]:
71
+ if parts != [0 ]:
74
72
print 'multipart polygon'
75
73
raise SystemExit
76
74
verts = shp .points
@@ -105,7 +103,6 @@ def get_wdb_boundaries(resolution,level,rivers=False):
105
103
offset = offset + len (bstring )
106
104
f .close ()
107
105
f2 .close ()
108
- raise SystemExit
109
106
110
107
for resolution in ['c' ,'l' ,'i' ,'h' ,'f' ]:
111
108
poly , polymeta = get_wdb_boundaries (resolution ,1 )
0 commit comments