0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

浮動小数点の扱いは面倒。jismeshでメッシュコードが意図しないものに

Posted at

緯度経度から地域メッシュコードを求める

を使っていたけど,スカラーと配列で値が違っていた。

from jismesh.utils import to_meshcode

lat0 = 34.875
lon0 = 135.1875

print(to_meshcode(lat0, lon0, 3))
print(to_meshcode(np.array([lat0, lat0]), np.array([lon0, lon0]), 3))

を実行すると、

52352155
[52352154 52352154]

と、同じ緯度経度のはずなのにメッシュコードが違う。

$34.875$ が そのまま扱われず $34.87499999999999$ と解釈され、
切り捨てられたんだろうなと思いつつ、どうしてやろうかと。。。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?