以下的code是根据经纬度坐标下的经纬度信息来计算2d的面积分布
注意:考虑的坐标东西方向(lon)的等距的,
lat也是不等距的
lon =
dble2flt(fi->lon) the longitude of the center of the
cell
lat =
dble2flt(fi->lat) the latitude of the center of the
cell
num_lon
= dimsizes(lon)
num_lat
= dimsizes(lat)
dlon
= abs(lon(1) - lon(0))
dlat
= new(num_lat, float)
dlat = some_inputs
lat_n
= the latitude of the center of the northernmost
cell
lat_s
= the latitude of the center of the southernmost
cell
area_wgt
=
new((/num_lat,num_lon/),float)
dx =
new(num_lat,float)
dy =
new(num_lat,float)
re =
6.371e6
rad
= 4.0*atan(1.0)/180.0
do j = 1-1,
num_lat-1
dx(j)
=
doubletofloat(re*cos(lat(j)*rad)*dlon*rad)
if (j .eq. 0 .or. j .eq. num_lat-1) then
if (lat(j) .gt. 0.0) then
temp
= lat_n
else
temp
= lat_s
end if
dx(j)
=
doubletofloat(re*cos(temp*rad)*dlon*rad)
end if
dy(j)
=
doubletofloat(re*abs(dlat(j))*rad)
end do
do j = 1-1,
num_lat-1
do i = 1-1,
num_lon-1
area_wgt(j,i)
= dx(j)*dy(j)
end do
end do
area_wgt!0 =
"lat"
area_wgt!1 =
"lon"
area_wgt&lat
= lat
area_wgt&lon
= lon
print("area
check")