blaylockbk / Herbie

Download numerical weather prediction datasets (HRRR, RAP, GFS, IFS, etc.) from NOMADS, NODD partners (Amazon, Google, Microsoft), ECMWF open data, and the University of Utah Pando Archive System.
https://herbie.readthedocs.io/
MIT License
480 stars 72 forks source link

cartopy as an optional dependency #318

Closed rafa-guedes closed 4 months ago

rafa-guedes commented 4 months ago

Thanks for providing this very useful library. I was wondering if you would consider making cartopy an optional dependency instead of a required one. Cartopy is a relatively large dependency which fails to build easily in some systems, and it is not required if one only requires the data access capability in the library. It looks like cartopy is used in the hrrr_zarr.py and accessors.py modules, perhaps some try/except conditional import in those modules with an appropriate exception message indicating the required dependency needs to be installed could work? I'm happy to submit a pull request if you think this is helpful.

rafa-guedes commented 4 months ago

And perhaps the same for scikit-learn!

blaylockbk commented 4 months ago

Hi @rafa-guedes,

Glad you find Herbie useful. Yes, this is something I have thought about too, but never bothered to do it since I use Cartopy all the time. I wondered how long it would take before someone said something when I added scikit-learn as a new dependency; didn't take long 😆

Yes, I'd be open to a PR if you want to take a stab at it. Keeping it super simple with try/except statements should be good. Perhaps even matplotlib could be optional?