加载中…
个人资料
amini遇
amini遇
  • 博客等级:
  • 博客积分:0
  • 博客访问:9,547
  • 关注人气:236
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

[转载]ncl中的面积权重 (经向不等距,纬向等距)

(2013-07-08 11:03:52)
标签:

转载

分类: 气象NCL-GrADS-Fortran
以下的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")
    print("max of area: " + max(area_wgt))
    print("min of area: " + min(area_wgt))
    print("total area : " + sum(area_wgt))
    准确性判断:面积必须大于零,地球总面积必须在5.1d+14平方米量级。

0

  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有