deeplycloudy / lmatools

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

Isolate matplotlib dependency #23

Closed deeplycloudy closed 4 years ago

deeplycloudy commented 5 years ago

Certain parts of lmatools rely on matplotlib. Those parts of lmatools are not used by glmtools, but the imports are convolved, and so matplotlib becomes a dependency for glmtools. It would be good to do some work to better isolate matplotlib.

If I uninstall matplotlib and run glmtools to create some grids in its usual mode, the first place it throws an error is:

Traceback (most recent call last):
  File "./grid/make_GLM_grids.py", line 300, in <module>
    gridder, glm_filenames, start_time, end_time, grid_kwargs = grid_setup(args)
  File "./grid/make_GLM_grids.py", line 134, in grid_setup
    from glmtools.grid.make_grids import grid_GLM_flashes
  File "/Users/ebruning/anaconda/envs/glmval-prod-test/lib/python3.7/site-packages/glmtools-0.1.dev0-py3.7.egg/glmtools/grid/make_grids.py", line 13, in <module>
    from glmtools.io.mimic_lma import read_flashes
  File "/Users/ebruning/anaconda/envs/glmval-prod-test/lib/python3.7/site-packages/glmtools-0.1.dev0-py3.7.egg/glmtools/io/mimic_lma.py", line 18, in <module>
    from lmatools.lasso.cell_lasso_timeseries import TimeSeriesGenericFlashSubset
  File "/Users/ebruning/code/lmatools/lasso/cell_lasso_timeseries.py", line 9, in <module>
    from lmatools.lasso.energy_stats import TimeSeriesPolygonLassoFilter 
  File "/Users/ebruning/code/lmatools/lasso/energy_stats.py", line 18, in <module>
    from stormdrain.support.matplotlib.formatters import SecDayFormatter
  File "/Users/ebruning/code/stormdrain/support/matplotlib/formatters.py", line 5, in <module>
    from matplotlib.ticker import Formatter, EngFormatter
ModuleNotFoundError: No module named 'matplotlib'

TimeSeriesGenericFlashSubset does not require the point-in-polygon features used from Matplotlib, nor does an application not requiring plots need a matplolib tick formatter. So, this is the first place to start to remove the matplotlib dependency.

deeplycloudy commented 5 years ago

There's a start on this in #24, specifically commit 95ff5bb. Needs to be retested now that #24 has been merged.

deeplycloudy commented 4 years ago

The PR in glmtools/#49 and a few other changes were able to isolate this dependency and others such as pytables (see 92ed12a) and scikit-learn, so I'm closing this PR.