gee-community/geemap

netcdf_to_ee code

pflatau opened this issue · 2 comments

Environment Information

analyzing the source code

Description

In this code
https://github.com/gee-community/geemap/blob/master/geemap/common.py

np.ediff1d(): This function calculates the difference between consecutive elements in an array. When applied to lon_data and lat_data, it computes the difference between each pair of consecutive longitude and latitude values, respectively. Essentially, it's showing how much each longitude or latitude value changes from one point to the next in the sequence.

np.unique(): This function finds the unique elements of an array. After calculating the differences between consecutive longitude and latitude values, np.unique() is used to find the unique differences. This means it will remove any duplicate values in the array of differences, leaving only distinct difference values.

But for floating point numbers lon_data, lat_data such difference can be slightly different due to roundoff error even for double precision. This will generate the error reported. I guess one needs to use machine epsilon to decide if two floating point numbers are equal or not.

What I Did

looked at the source code

Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.

Pull request is welcome. Otherwise, please provide a complete script with a sample dataset that can reproduce the issue.

Duplicate issue. See #1945