@@ -41,6 +41,7 @@ import shutil
4141import h5py
4242from pathlib import Path
4343import urllib
44+ import requests # noqa: F401 - required implicitly by urllib.
4445
4546from mercator import get_offset , get_scale , pos_to_coord
4647import util
@@ -144,6 +145,7 @@ def get_amazon_radar_data(filename, time):
144145 fh .write (data )
145146
146147
148+ # def process_rainfall_data(filename, resolution, domain):
147149def process_rainfall_data (filename , resolution , domain ):
148150 """get_amazon_radar_dataGenerate a 2D matrix of data from the rainfall data in the image.
149151
@@ -166,15 +168,15 @@ def process_rainfall_data(filename, resolution, domain):
166168
167169 # TODO - work out why this isn't working
168170 scale = get_scale (domain , width )
169- offset = get_offset (domain , scale )
170- scale = (1672.2334443981335 , 3344.466888796267 )
171- offset = (- 1100.8461538461539 , 1400.6953225710452 )
171+ # offset = get_offset(domain, scale)
172+ # offset = (-1100.8461538461539, 1400.6953225710452)
172173
173174 if DEBUG :
175+ print (f'[INFO] { scale = } , { offset = } ' )
174176 from matplotlib import pyplot as plt
175- Path (' CYLC_TASK_LOG_DIR' ).mkdir (parents = True , exist_ok = True )
177+ Path (CYLC_TASK_LOG_DIR ).mkdir (parents = True , exist_ok = True )
176178 plt .imshow (data )
177- plt .savefig (f'{ os . environ [ ' CYLC_TASK_LOG_DIR' ] } /raw.data.png' )
179+ plt .savefig (f'{ CYLC_TASK_LOG_DIR } /raw.data.png' )
178180
179181 for itt_x in range (width ):
180182 for itt_y in range (height ):
@@ -185,6 +187,7 @@ def process_rainfall_data(filename, resolution, domain):
185187 scale
186188 )
187189 val = float (data [height - 1 - itt_y ][itt_x ])
190+ # Original data uses -1 to indicated radar mask
188191 val = 0 if val == - 1 else val
189192 rainfall .add (lng , lat , val )
190193 data = rainfall .compute_bins ()
0 commit comments