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