爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 5800|回复: 3

[作图] NCL关于读取yf2e的AWX格式数据的问题

[复制链接]

新浪微博达人勋

发表于 2016-9-6 14:23:41 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
本人新手,现在需要运用NCL读取风云2E的AWX格式的数据进行作图,但是之前读取的都是wrf数据,从来没有接触卫星的数据,而现在手上只有一个数据结构的fortran文件,根本不知道该怎么处理,希望有能人志士可以出手相助,以下是我的fortran文件代码:

!主程序
        program awx2nc
        implicit none
     !  定义云导风数据结构
        TYPE AwxFileFirstHeader
        sequence
        character(12)::   strFileName           !文件名
        integer(kind=2):: iByteOrder           !整型数的字节顺序
        integer(kind=2):: iFirstHeaderLength   !第一级文件头长度
        integer(kind=2):: iSecondHeaderLength  !第二级文件头长度
        integer(kind=2):: iFillSectionLength   !填充段数据长度
        integer(kind=2):: iRecoderLength       !记录长度
        integer(kind=2):: iRecordsOfHeader     !文件头占用记录数
        integer(kind=2):: iRecordsOfData       !产品数据占用记录数!!maybe<0
        integer(kind=2):: iTypeOfProduct       !产品类别
        integer(kind=2):: iTypeOfCompress      !压缩方式
        character(8)::strVersion               !格式说明字串
        integer(kind=2):: iFlagOfQaulity       !产品数据质量标记
        END TYPE AwxFileFirstHeader
        type  AwxFileSecondHeader
        sequence
        character(8)::  strSatelliteName                 !卫星名
        integer(kind=2)::iYear                           !时间(年)
        integer(kind=2)::iMonth                          !时间(月)
        integer(kind=2)::iDay                            !时间(日)
        integer(kind=2)::iHour                           !时间(时)
        integer(kind=2)::iMinute                         !时间(分)
        integer(kind=2)::iChannel                        !通道号
        integer(kind=2)::iFlagOfProjection               !投影方式
        integer(kind=2)::iWidthOfImage                   !图像宽度
        integer(kind=2)::iHeightOfImage                  !图像高度
        integer(kind=2)::iScanLineNumberOfImageTopLeft   !图像左上角扫描线号
        integer(kind=2)::iPixelNumberOfImageTopLeft      !图像左上角像元号
        integer(kind=2)::iSampleRatio                    !抽样率
        integer(kind=2)::iLatitudeOfNorth                !地理范围(北纬)
        integer(kind=2)::iLatitudeOfSouth                !地理范围(南纬)
        integer(kind=2)::iLongitudeOfWest                !地理范围(西经)
        integer(kind=2)::iLongitudeOfEast                !地理范围(东经)
        integer(kind=2)::iCenterLatitudeOfProjection     !投影中心纬度(*10-2°)
        integer(kind=2)::iCenterLongitudeOfProjection    !投影中心经度(*10-2°)
        integer(kind=2)::iStandardLatitude1              !投影水平分辨率(标准经度)1
        integer(kind=2)::iStandardLatitude2              !投影水平分辨率(标准经度)2
        integer(kind=2)::iHorizontalResolution           !投影水平分辨率(*10-2 km)
        integer(kind=2)::iVerticalResolution             !投影垂直分辨率(*10-2 km)
        integer(kind=2)::iOverlapFlagGeoGrid             !地理网格叠加标志
        integer(kind=2)::iOverlapValueGeoGrid            !地理网格叠加值
        integer(kind=2)::iDataLengthOfColorTable         !调色表数据块长度
        integer(kind=2)::iDataLengthOfCalibration        !定标数据块长度
        integer(kind=2)::iDataLengthOfGeolocation        !定位数据块长度
        integer(kind=2)::iReserved                       !保留
        end type AwxFileSecondHeader                     
       
        character(len=256)::filename
        integer::error,loops
        character,dimension(:),allocatable::skips                  !跳过5个无用的文件头
        type(AwxFileFirstHeader):: firhead        !第一文件头
        type(AwxFileSecondHeader)::sechead
        character,dimension(:,:),allocatable:: fydata
        character::a
        integer :: col,line,recnum,headnum
        integer :: b
        loops=0
        col=0
        line=0
        recnum=0
        headnum=0
       
        filename="/home/liuting/sat/FY2E/Z_SATE_C_BAWX_20160830045501_P_FY2E_SEC_IR1_LCN_20160830_0430.AWX"
        open(16,file=trim(filename),access='stream',status='old',iostat=error)
       
        if(error/=0)then
        write(*,*) "Open FY2E AWX file fail!"
        stop            
        end if
        read(16) firhead                         !读取第一文件头
        read(16) sechead
        write(*,*)firhead
        write(*,*)sechead
        recnum=firhead%iRecoderLength
        headnum=firhead%iRecordsOfHeader
        col=sechead%iWidthOfImage
        line=sechead%iHeightOfImage
        write(*,*)recnum,headnum,col,line
        loops=recnum*headnum-104
        allocate(skips(loops))
        read(16) skips
        allocate(fydata(line,col))

        read(16) fydata
        !read(fydata(1,1),"A1")a
        !ichar(fydata(1,1))
               
       
        b=ichar(fydata(1,1))
        write(*,*) b

        close(16)

       

        end program awx2nc

密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2016-9-6 15:33:58 | 显示全部楼层
希望大家多多帮忙。
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-9-6 19:08:03 | 显示全部楼层
谢谢楼主分享~~~~~~~~~
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2018-10-6 20:34:44 | 显示全部楼层
把后缀改为.f90就可以。亲测有效
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表