admin管理员组文章数量:1401171
I have gridded atmospheric field data stored in an xarray.DataArray. I computed its gradient and rotated it to obtain vector components that are tangent to the isolines at each grid point:
ddata_dlon = data.differentiate("longitude")
ddata_dlat = data.differentiate("latitude")
tx = -ddata_dlat
ty = ddata_dlon
Now, I want to move each grid point by 10 km in the direction of these vectors, effectively tracing a step along the isolines. This means computing new latitude and longitude values that are offset by 10 km in the appropriate directions.
My Understanding So Far:
I need to normalize (tx, ty) to obtain unit vectors.
I then scale them to represent a 10 km displacement.
Since longitude degrees vary with latitude, I need a proper conversion between kilometers and degrees for both latitude and longitude.
My Questions:
What is the correct way to normalize (tx, ty) so that they represent unit vectors in the tangent direction?
How do I correctly scale these unit vectors to a 10 km step while accounting for latitude-dependent degree-to-km conversion?
本文标签: pythonCalculating a step in a direction of a vectorStack Overflow
版权声明:本文标题:python - Calculating a step in a direction of a vector - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744302606a2599653.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论