-
-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
not enough values to unpack (expected 4, got 0)
in outside_the_boundaries_of
#209
Comments
Thanks for reporting this. It would be best to unit test the respective functions for all possible values. Unfortunately I don't have enough time to implement this. Can anyone help? |
Hello @rez0n, are you sure the error originates from the line in the screenshot? |
I added unit tests for the highlighted functions. The tests are passing. Additional unit tests are required to rule out possible bugs. @rez0n can you provide an example input to reproduce this? It seems very strange that the error cannot be reproduced even if you repeat your experiments. The code of timezonefinder should be deterministic, so it should either always or never throw an error for identical input. |
Hi @jannikmi
As you can see, it is Sentry.io report. It is always correct for me.
Unfortunately no, as I said in the initial message I ran script for entire database and no any value did not triggered this error. |
Just chiming in that I am running into this now. In a running service I see the following logged:
When I run the same locally, it executes fine:
Similar to the above poster, this occurs seemingly at random and is not reproducible locally. Will continue to investigate and report back here if I am able to discern further... |
Thanks for reporting this! |
@kuanb did you figure out what the problem was? I am also facing this issue at random. |
@chboe can you perhaps help to reproduce it and add some test cases? |
@jannikmi It happens totally at random. Very odd behaviour. I tried adding some random noise and querying a second time. Will see if this solves my issue. It doesn't even seem to be a boundary issue since all my test cases run very clearly inside timezone boundaries |
Thanks for the report. And you encountered the error while running the query for statically defined test cases (coordinates)? That would inply that the behaviour of Timezonefinder is not deterministic, which would be very surprising for me. |
Not well-defined test-cases but some code running in production that occasionally logged and error in datadog. When I then re-queryed with the same lat-lon it went fine - both in production and locally. |
Might the different behaviour come from different floating point precisions? |
If users face this issue, it's possible to make a minor change to capture what From the example, we can see that 'in_memory' is False in the TimezoneFinder by default, so the data is returned by NumPy's I suggest adding these changes to def get_polygon_boundaries(self, poly_id: int) -> Tuple[int, int, int, int]:
"""returns the boundaries of the polygon = (lng_max, lng_min, lat_max, lat_min) converted to int32"""
poly_max_values = getattr(self, POLY_MAX_VALUES)
poly_max_values.seek(4 * NR_BYTES_I * poly_id)
- xmax, xmin, ymax, ymin = self._fromfile(
+ file_result = self._fromfile(
poly_max_values,
dtype=DTYPE_FORMAT_SIGNED_I_NUMPY,
count=4,
)
+ xmax, xmin, ymax, ymin = file_result
return xmax, xmin, ymax, ymin Then we can get the Or inside The code inside NumPy's |
Thanks for the suggestion. Could you open a PR with these changes? |
@rez0n, @kuanb, @chboe, @ringsaturn in the lastest version |
Hi,
I faced with some rare issue in timezonefinder, it throwing
not enough values to unpack (expected 4, got 0)
exception randomly and rarely. I have no ideas about reproducing of this because I ran it for all coordinates in the database multiple times and have no luck to catch exception.Submitting this report just in case if author have any ideas.
Timezonefinder version: 6.2.0
Python 3.11
Usage example:
The text was updated successfully, but these errors were encountered: