- 积分
- 11819
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2013-4-26
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
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
|
|