deeplycloudy / lmatools

Python code for working with VHF Lightning Mapping Array data
BSD 2-Clause "Simplified" License
22 stars 23 forks source link

Fix error caused by pyproj >= 2.2 #29

Open deeplycloudy opened 4 years ago

deeplycloudy commented 4 years ago

First seen in glmtools#31, an API change in pyproj results in a crash due to a check for a mysterious 'time' dimension. I reproduced it today when testing flash sorting on a simple file, as seen below.

Traceback (most recent call last):
  File "flash_sort_and_grid.py", line 187, in <module>
    ctr_lat=params['ctr_lat'], ctr_lon=params['ctr_lon'], center_ID=center_ID)
  File "flash_sort_and_grid.py", line 129, in grid_and_plot
    output_filename_prefix=center_ID, spatial_scale_factor=1.0
  File "/Users/ebruning/code/lmatools/lmatools/grid/make_grids.py", line 631, in grid_h5flashfiles
    gridder.process_flashes(h5_filenames, **process_flash_kwargs)
  File "/Users/ebruning/code/lmatools/lmatools/grid/make_grids.py", line 608, in process_flashes
    read_flashes( h5_filenames, self.framer, base_date=self.t_ref, min_points=min_points_per_flash)
  File "/Users/ebruning/code/lmatools/lmatools/io/LMA_h5_file.py", line 253, in read_flashes
    target.send(push_out)
  File "/Users/ebruning/code/lmatools/lmatools/grid/density_to_files.py", line 215, in flashes_to_frames
    target.send((these_events, these_flashes))
  File "/Users/ebruning/code/lmatools/lmatools/grid/density_to_files.py", line 247, in extract_events_for_flashes
    target.send((events, fls))
  File "/Users/ebruning/code/lmatools/lmatools/stream/subset.py", line 83, in broadcast
    target.send(stuff)
  File "/Users/ebruning/code/lmatools/lmatools/grid/density_to_files.py", line 291, in project
    points[x_coord], points[y_coord], points[z_coord]))
  File "/Users/ebruning/code/lmatools/lmatools/coordinateSystems.py", line 74, in toECEF
    projectedData = array(proj4.transform(self.ERSlla, self.ERSxyz, lon, lat, alt ))
  File "/Users/ebruning/miniconda3/envs/glmval/lib/python3.6/site-packages/pyproj/transformer.py", line 759, in transform
    ).transform(xx=x, yy=y, zz=z, tt=tt, radians=radians, errcheck=errcheck)
  File "/Users/ebruning/miniconda3/envs/glmval/lib/python3.6/site-packages/pyproj/transformer.py", line 445, in transform
    errcheck=errcheck,
  File "pyproj/_transformer.pyx", line 432, in pyproj._transformer._Transformer._transform
pyproj.exceptions.ProjError: x,y,z, and time must be same size