pegler / pytzwhere

python library to look up timezone from lat lng offline
Other
146 stars 54 forks source link

Minor change to avoid numpy DeprecationWarning #58

Open oscgonfer opened 2 years ago

oscgonfer commented 2 years ago

This is a minor PR to avoid numpy DeprecationWarning on:

numpy/core/_asarray.py:102: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
  return array(a, dtype, copy=False, order=order)
VivaLaPanda commented 2 years ago

Bump on merging this?

remi-dupre commented 1 year ago

Hi!

Note that with latest numpy 1.24.0rc0 this deprecation notice becomes an exception:

  File "/home/remi/code/idunn/idunn/utils/__init__.py", line 4, in <module>
    tz = tzwhere.tzwhere(forceTZ=True)
  File "/home/remi/.local/share/virtualenvs/idunn-JfTPVegI/lib/python3.10/site-packages/tzwhere/tzwhere.py", line 62, in __init__
    self.timezoneNamesToPolygons[tzname] = WRAP(polys)
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 2 dimensions. The detected shape was (1, 2) + inhomogeneous part.
oscgonfer commented 1 year ago

As the repository is clearly not being maintained, maybe we should make a port and release it on pypi. This should also guarantee that long term support is there, but in my case I don't have time to get fully involved in checking possible future issues for dependencies.

Opinions?

jannikmi commented 1 year ago

I don't want to hijack this PR, but I want to point out that my package timezonefinder offers the same functionality and is being actively maintained. If you are missing functionality, feel free to open an issue/PR there. Hope this helps.

oscgonfer commented 1 year ago

@jannikmi, thank you for the comment. I personally hadn't heard of your timezonefinder package, but I have just tested it, and in my particular case, it works as I need it. It wouldn't make sense to keep working with pytzwhere unless someone else has another issue with yours, but eitherway development shouldn't be divided into two different repos that can potentially do the same thing.

Long story short, switching to timezonefinder seems like the best solution.