{"action":"created","issue":{"url":"https://api.github.com/repos/ARM-DOE/pyart/issues/685","repository_url":"https://api.github.com/repos/ARM-DOE/pyart","labels_url":"https://api.github.com/repos/ARM-DOE/pyart/issues/685/labels{/name}","comments_url":"https://api.github.com/repos/ARM-DOE/pyart/issues/685/comments","events_url":"https://api.github.com/repos/ARM-DOE/pyart/issues/685/events","html_url":"https://github.com/ARM-DOE/pyart/issues/685","id":257716222,"number":685,"title":"Python 3.6 bug in gridding routines","user":{"login":"tjlang","id":3036387,"avatar_url":"https://avatars0.githubusercontent.com/u/3036387?v=4","gravatar_id":"","url":"https://api.github.com/users/tjlang","html_url":"https://github.com/tjlang","followers_url":"https://api.github.com/users/tjlang/followers","following_url":"https://api.github.com/users/tjlang/following{/other_user}","gists_url":"https://api.github.com/users/tjlang/gists{/gist_id}","starred_url":"https://api.github.com/users/tjlang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tjlang/subscriptions","organizations_url":"https://api.github.com/users/tjlang/orgs","repos_url":"https://api.github.com/users/tjlang/repos","events_url":"https://api.github.com/users/tjlang/events{/privacy}","received_events_url":"https://api.github.com/users/tjlang/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2017-09-14T13:18:05Z","updated_at":"2018-05-22T14:56:29Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Gridding routines appear to be broken in Python 3.6. In order to account for mobile radars, Py-ART Radar object allows arrays for radar lat/lon/alt, altho a lot of code heritage assumes scalars for these parameters. It appears that doing a float conversion on the z_disp calculation, or if that is removed, the appending immediately after this calculation raises a TypeError in 3.6 due to this array/scalar confusion. Here is the error below. This completely breaks gridding.\r\n\r\n---------------------------------------------------------------------------\r\nTypeError                                 Traceback (most recent call last)\r\n<ipython-input-9-f49e01bb2c25> in <module>()\r\n      1 g1 = grid_radar(r1, origin=(r2.latitude['data'][0], r2.longitude['data'][0]),\r\n----> 2                 xlim=(-100000, 50000), ylim=(0, 150000), grid_shape=(20, 151, 151))\r\n      3 g2 = grid_radar(r2, origin=(r2.latitude['data'][0], r2.longitude['data'][0]),\r\n      4                 xlim=(-100000, 50000), ylim=(0, 150000), grid_shape=(20, 151, 151))\r\n\r\n<ipython-input-7-45d25a898f20> in grid_radar(radar, grid_shape, xlim, ylim, zlim, fields, origin)\r\n     11         grid_limits=(zlim, ylim, xlim),\r\n     12         grid_origin=origin, fields=fields,\r\n---> 13         gridding_algo='map_gates_to_grid', grid_origin_alt=0.0)\r\n     14     print(time.time()-bt, 'seconds to grid radar')\r\n     15     return grid\r\n\r\n/Users/tjlang/anaconda/envs/py3/lib/python3.6/site-packages/pyart/map/grid_mapper.py in grid_from_radars(radars, grid_shape, grid_limits, gridding_algo, **kwargs)\r\n     85         grids = map_to_grid(radars, grid_shape, grid_limits, **kwargs)\r\n     86     elif gridding_algo == 'map_gates_to_grid':\r\n---> 87         grids = map_gates_to_grid(radars, grid_shape, grid_limits, **kwargs)\r\n     88     else:\r\n     89         raise ValueError('invalid gridding_algo')\r\n\r\n/Users/tjlang/anaconda/envs/py3/lib/python3.6/site-packages/pyart/map/gates_to_grid.py in map_gates_to_grid(radars, grid_shape, grid_limits, grid_origin, grid_origin_alt, grid_projection, fields, gatefilters, map_roi, weighting_function, toa, roi_func, constant_roi, z_factor, xy_factor, min_radius, h_factor, nb, bsp, **kwargs)\r\n     97     fields = _determine_fields(fields, radars)\r\n     98     grid_starts, grid_steps = _find_grid_params(grid_shape, grid_limits)\r\n---> 99     offsets = _find_offsets(radars, projparams, grid_origin_alt)\r\n    100     roi_func = _parse_roi_func(roi_func, constant_roi, z_factor, xy_factor,\r\n    101                                min_radius, h_factor, nb, bsp, offsets)\r\n\r\n/Users/tjlang/anaconda/envs/py3/lib/python3.6/site-packages/pyart/map/gates_to_grid.py in _find_offsets(radars, projparams, grid_origin_alt)\r\n    223         z_disp = np.array(radar.altitude['data'], dtype='float') - \\\r\n    224             grid_origin_alt\r\n--> 225         offsets.append((z_disp, float(y_disp), float(x_disp)))\r\n    226     return offsets\r\n    227 \r\n\r\nTypeError: only length-1 arrays can be converted to Python scalars\r\n"},"comment":{"url":"https://api.github.com/repos/ARM-DOE/pyart/issues/comments/391021983","html_url":"https://github.com/ARM-DOE/pyart/issues/685#issuecomment-391021983","issue_url":"https://api.github.com/repos/ARM-DOE/pyart/issues/685","id":391021983,"user":{"login":"scollis","id":825351,"avatar_url":"https://avatars3.githubusercontent.com/u/825351?v=4","gravatar_id":"","url":"https://api.github.com/users/scollis","html_url":"https://github.com/scollis","followers_url":"https://api.github.com/users/scollis/followers","following_url":"https://api.github.com/users/scollis/following{/other_user}","gists_url":"https://api.github.com/users/scollis/gists{/gist_id}","starred_url":"https://api.github.com/users/scollis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scollis/subscriptions","organizations_url":"https://api.github.com/users/scollis/orgs","repos_url":"https://api.github.com/users/scollis/repos","events_url":"https://api.github.com/users/scollis/events{/privacy}","received_events_url":"https://api.github.com/users/scollis/received_events","type":"User","site_admin":false},"created_at":"2018-05-22T14:56:29Z","updated_at":"2018-05-22T14:56:29Z","author_association":"MEMBER","body":"ok.. So it may be an issue in the UF reader. Can you put the file somewhere? \r\n"}}
{"actor":{"display_login":"scollis"}}