简体   繁体   English

Python 计算以纬线 lat1 和 lat2 以及经线 lon1 和 lon2 为界的表面积

[英]Python calculate surface area bounded by the parallels lat1 and lat2 and the meridians lon1 and lon2

I'm looking for an equivalent to this Matlab function areaquad in Python.我正在 Python 中寻找与此 Matlab function areaquad的产品。

area = areaquad(lat1,lon1,lat2,lon2) returns the surface area bounded by the parallels lat1 and lat2 and the meridians lon1 and lon2. area = areaquad(lat1,lon1,lat2,lon2) 返回以纬线 lat1 和 lat2 以及经线 lon1 和 lon2 为界的表面积。 The output area is a fraction of the unit sphere's area of 4π, so the result ranges from 0 to 1. output 面积是单位球体面积 4π 的一小部分,因此结果范围为 0 到 1。

Do you happen to know how I can calculate this using Python?你碰巧知道我如何使用 Python 计算这个吗? Any tips are much appreciated!非常感谢任何提示!

It's not that hard to calculate it, if you need it only for spheres.如果您只需要球体,那么计算它并不难。 Here is the formula for calculating total area of sphere surface between two latitudes.是计算两个纬度之间球面总面积的公式。 So:所以:

h = sin(lat2)-sin(lat1)
Az = 2 * pi * h

Now, we can simply find the proportion of the region restricted between two longitudes:现在,我们可以简单地求出限制在两个经度之间的区域的比例:

Aq = Az * (lon2-lon1)/(2*pi)

And finally, to make the result a fraction of surface of unit sphere, divide it by 4*pi .最后,为了使结果成为单位球面的一小部分,将其除以4*pi Putting all together, with simplification and take angle units into account:放在一起,简化并考虑角度单位:

 A = (sind(lat2)-sind(lat1)) * deg2rad(lon2-lon1) / (4*pi);

Hope you can translate it to python.希望你能把它翻译成 python。

在此处输入图像描述

Edit: This is what I get in R2020b for your test case:编辑:这是我在 R2020b 中为您的测试用例得到的:

lat1 = -90; lat2 = -89; lon1 = -180; lon2 = 180;
A = (sind(lat2)-sind(lat1)) * deg2rad(lon2-lon1) / (4*pi)

A =一个=
7.6152e-05 7.6152e-05

在此处输入图像描述

Also, about Aq not being present in the final formula:此外,关于Aq不存在于最终公式中:

h = sin(lat2)-sin(lat1)
Az = 2 * pi * h
Aq = Az * (lon2-lon1)/(2*pi)
   = 2*pi*h*(lon2-lon1)/(2*pi) // reducing 2*pi
   = h * (lon2-lon1)
   = (sin(lat2)-sin(lat1))*(lon2-lon1)
A  = Aq/(4*pi)
   = (sin(lat2)-sin(lat1))*(lon2-lon1)/(4*pi)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM