Skip to content
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

在 utils 子包中增加经纬度计算方位角、距离的工具函数,方便直接读取产品后插值到指定经纬度 #123

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

longtsing
Copy link
Contributor

如标题,增加这两个工具函数后,若需要插值到某个地点,以地点经纬度和雷达站点经纬度计算方位角azimuth和距离distance,直接用 xarray.DataArray.interp 方法即可插值到某地(注意插值方法最好用 nearest)

@CyanideCN
Copy link
Owner

看起来都挺好的,但是我有一个问题,这个不能直接用numpy的函数实现吗,有什么一定要用cython提速的部分吗

@pysoer
Copy link
Contributor

pysoer commented Dec 6, 2024

如标题,增加这两个工具函数后,若需要插值到某个地点,以地点经纬度和雷达站点经纬度计算方位角azimuth和距离distance,直接用 xarray.DataArray.interp 方法即可插值到某地(注意插值方法最好用 nearest)

哈哈,确实实用。不过你也可以看看刚增加的函数polar_to_xy
polar_to_xy可以将单仰角数据从极坐标插值转换为经纬度坐标,这样再interp就搞定啦

@longtsing
Copy link
Contributor Author

对,就是极坐标和经纬度坐标转化,polar_to_xy 是极坐标转经纬度坐标 ,提交代码是经纬度坐标转极坐标。主要是涉及地理计算方面内容,用 math 是相对简单一些,用 numpy也可以啊,不过math加 numpy.vectorize 也一样,用 cython做了计算加速。

@CyanideCN
Copy link
Owner

我感觉每个函数看起来都可以直接用改成用整个array计算的版本,这样会好很多,也省去了在cython里弄的功夫。用np.vectorize包一个用math实现的函数其实也不会有性能提升。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants