![](/img/trans.png)
[英]How to get mean of a variable through time within a given boundarybox (lon1,lon2,lat1,lat2)?
[英]Python calculate surface area bounded by the parallels lat1 and lat2 and the meridians lon1 and lon2
我正在 Python 中尋找與此 Matlab function areaquad
的產品。
area = areaquad(lat1,lon1,lat2,lon2) 返回以緯線 lat1 和 lat2 以及經線 lon1 和 lon2 為界的表面積。 output 面積是單位球體面積 4π 的一小部分,因此結果范圍為 0 到 1。
你碰巧知道我如何使用 Python 計算這個嗎? 非常感謝任何提示!
如果您只需要球體,那么計算它並不難。 這是計算兩個緯度之間球面總面積的公式。 所以:
h = sin(lat2)-sin(lat1)
Az = 2 * pi * h
現在,我們可以簡單地求出限制在兩個經度之間的區域的比例:
Aq = Az * (lon2-lon1)/(2*pi)
最后,為了使結果成為單位球面的一小部分,將其除以4*pi
。 放在一起,簡化並考慮角度單位:
A = (sind(lat2)-sind(lat1)) * deg2rad(lon2-lon1) / (4*pi);
希望你能把它翻譯成 python。
編輯:這是我在 R2020b 中為您的測試用例得到的:
lat1 = -90; lat2 = -89; lon1 = -180; lon2 = 180;
A = (sind(lat2)-sind(lat1)) * deg2rad(lon2-lon1) / (4*pi)
一個=
7.6152e-05
此外,關於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.