@@ -31,7 +31,7 @@ def quantize(data,least_significant_digit):
31
31
return np .around (scale * data )/ scale
32
32
33
33
def interpolate_long_segments (coords , resolution ):
34
- lookup_thresh = {'c' : 0.5 , 'l' :0.1 , 'i' :0.05 , 'h' :0.01 , 'f' :0.005 }
34
+ lookup_thresh = {'c' : 0.5 , 'l' :0.3 , 'i' :0.2 , 'h' :0.1 , 'f' :0.05 }
35
35
thresh = lookup_thresh [resolution ]
36
36
spacing = thresh / 5.0
37
37
@@ -119,7 +119,9 @@ def get_wdb_boundaries(resolution,level,rivers=False):
119
119
b [:,0 ] = lons ; b [:,1 ] = lats
120
120
if lsd is not None :
121
121
b = quantize (b ,lsd )
122
- b = interpolate_long_segments (b , resolution )
122
+
123
+ if not rivers :
124
+ b = interpolate_long_segments (b , resolution )
123
125
124
126
polymeta .append ([- 1 ,- 1 ,south ,north ,len (b ),poly_id ])
125
127
polybounds .append (b )
@@ -178,7 +180,10 @@ def get_wdb_boundaries(resolution,level,rivers=False):
178
180
for resolution in ['c' ,'l' ,'i' ,'h' ,'f' ]:
179
181
f = open (os .path .join (OUTPUT_DIR , 'rivers_' + resolution + '.dat' ), 'wb' )
180
182
f2 = open (os .path .join (OUTPUT_DIR , 'riversmeta_' + resolution + '.dat' ), 'w' )
181
- for level in range (1 ,12 ):
183
+ # Levels above 5 are intermittent rivers and irrigation canals.
184
+ # They haven't been included in the past, as far as I can tell, so I'm
185
+ # not including them here...
186
+ for level in range (1 , 6 ):
182
187
poly , polymeta = get_wdb_boundaries (resolution ,level ,rivers = True )
183
188
offset = 0
184
189
for p ,pm in zip (poly ,polymeta ):
0 commit comments