爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 9212|回复: 30

[求助] 求各位大神有没有能看懂这个程序的

[复制链接]

新浪微博达人勋

发表于 2013-6-2 14:51:35 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 jeffggg 于 2013-6-2 14:54 编辑

Program  Use_Scat_Daily_Example

character(120) filename
real(4) mingmt(1440,720,2)
real(4) windspd(1440,720,2)
real(4) winddir(1440,720,2)
real(4) radrain(1440,720,2)
integer(4) scatflag(1440,720,2)
integer lyear,jday,imonth,idaymonth,ierr,iasc,ilat,ilon

DO lyear =2000,2000 !qscat verification 2000,2000 !seawinds verification  2003,2003 !full qscat data range  1999,2004 (or current year)
    DO jday=11,11  !qscat verification 11,11  !seawinds verification  115,115  !full year  1,366
  IF(lyear.eq.1999.and.jday.lt.200)    cycle !before qscat in orbit
  IF(lyear.ne.4*INT(lyear/4).and.jday.eq.366)  cycle !not a leap year
  
     CALL find_month_day(lyear,jday, imonth,idaymonth)
! Construct file name
  ! ADJUST FOR YOUR DIRECTORY STRUCTURE and INSTRUMENT!
  ! This subroutine assumes you have unzipped files with no extention
  WRITE(filename,9001) lyear,imonth,lyear,imonth,idaymonth
9001  FORMAT('InsertYourDrive:\InsertYourLocation\y',i4.4,'\m',i2.2,'\qscat_',i4.4,i2.2,i2.2,'v4')
  WRITE(*,*) filename
              
  CALL GET_SCAT_DAILY_V4(filename, mingmt,windspd,winddir,scatflag,radrain, IERR)
  IF (IERR.ne.0) THEN
   WRITE(*,*) 'no scat data: ', filename
   STOP
  ENDIF

  !!  write out scat verification file data for comparison
  DO iasc=1,1  !range !1,2(asc,dsc)    !seawinds and qscat verification !1,1
    DO ilat=274,278    !1,720         !274,278
      DO ilon=170,175    !1,1440         !170,175
!  XLAT=0.25*ILAT-90.125
  !  XLON=0.25*ILON-0.125
    write(*,'(2i5,f6.0,2f8.2,2x,i4,f11.2)') ilon,ilat,
     .    mingmt(ilon,ilat,iasc),windspd(ilon,ilat,iasc),
     .    winddir(ilon,ilat,iasc),scatflag(ilon,ilat,iasc),
     .    radrain(ilon,ilat,iasc)
   ENDDO  !ilon
    ENDDO  !ilat
  ENDDO  !iasc
   ENDDO !jday
ENDDO !lyear
END
c   !! write the location of the qscat data subroutine
c     !! include 'YourDrive:\YourDirectory\GET_SCAT_DAILY_v4.F'
include 'GET_SCAT_DAILY_V4.F'

************************************************************************************
      SUBROUTINE FIND_MONTH_DAY(LYEAR,IDAYJL, IMON,IDAY)
INTEGER(4) IDAYFX(12,0:1)
      DATA IDAYFX/1,32,60,91,121,152,182,213,244,274,305,335,           
     1            1,32,61,92,122,153,183,214,245,275,306,336/           
                                                  
      ILEAP=0
IF(LYEAR.EQ.4*INT(LYEAR/4)) ILEAP=1
      DO 10 JMON=2,12
IF(IDAYFX(JMON,ILEAP).GT.IDAYJL) THEN
      IMON=JMON-1
GO TO 20
ENDIF
   10 CONTINUE
      IMON=12
   20 CONTINUE
      IDAY=1+IDAYJL-IDAYFX(IMON,ILEAP)
      RETURN
END
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2013-6-2 14:53:12 | 显示全部楼层
在论坛里提问关于资料下载的问题 一直没人回答  找了个网站提供处理资料的程序 但无奈实在看不懂 求格纹大神帮忙解答  那些注释的地方到底是要让我添加什么东西  程序运行完会生成什么结果
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2013-6-2 14:55:26 | 显示全部楼层
注解 下载的资料是一天一天的  一天一个文件 他网站说要用这个程序去处理
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2013-6-2 15:56:54 | 显示全部楼层
这个程序很简单的吧,而且你根本没必要看懂,就是一个提取数据再输出的程序,你问的注释内容根本就不是程序的问题,是英语!程序不会就算了,英语还要找人给你翻译么???
整个程序很多注释都是告诉你程序是干什么的,不是要让你做什么,你就改改路径(红色部分),把你的数据放到路径。剩下的全是一些读取数据在排序输出的内容,根本不用管。话说你还少贴了一个子程序,读取数据的代码看不到。
楼主既然知道自己的编程不好,那就要多练习啊,不能总指望别人,都到大雨了还是发帖让别人帮你翻译英文,读一个这么简单的程序,管理员和版主们是很伤心的。
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2013-6-2 16:18:38 | 显示全部楼层

没有了 网站上给的就这么多
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2013-6-2 16:33:47 | 显示全部楼层
jeffggg 发表于 2013-6-2 16:18
没有了 网站上给的就这么多

那就试试呗~
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2013-6-2 16:45:59 | 显示全部楼层
话说你下载f文件的时候把这个也下载了。get_scat_daily_v4.f

评分

参与人数 1金钱 +6 贡献 +1 收起 理由
言深深 + 6 + 1

查看全部评分

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

新浪微博达人勋

 楼主| 发表于 2013-6-2 17:03:42 | 显示全部楼层
lqouc 发表于 2013-6-2 16:45
话说你下载f文件的时候把这个也下载了。get_scat_daily_v4.f

这是两个程序啊
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2013-6-2 17:32:43 | 显示全部楼层
你贴出来的程序最后说了会调用这个的。下载以后你看看就知道了。
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2013-6-2 18:37:41 | 显示全部楼层
lqouc 发表于 2013-6-2 17:32
你贴出来的程序最后说了会调用这个的。下载以后你看看就知道了。


SUBROUTINE GET_SCAT_DAILY_V4(FILENAME, MINGMT,WINDSPD,WINDDIR,SCATFLAG,RADRAIN, IERR)

        !This program reads Remote Sensing Systems Scatterometer Level-4 gridded bytemap daily files, Version-4, GMF: Ku-2011
        !这个程序用来读取REMSS网站提供的L-4格点资料 逐日的 版本4 GMH-2011
        !         The data are returned in 1440 x 720 x 4 x 2 arrays.
        !数据是在一个110*720*4*2的数组当中
        !                  the first index of the array is the longitude in 1/4 degrees 第一个是经度 0.25分辨率
        !                  the second index of the array is the latitude in 1/4 degrees 第二个是纬度 0.25分辨率
        !                  the third index of the array is the data type  (min gmt,wind speed,wind direction and rain bitflag) 第三个是数据类型 变量()
        !                  and the fourth is the morning/evening (ascending/descending) orbit segments  早上/晚上(升序/降序)轨道段
        !
        !The center of the first cell of the 1440 column and 720 row map is at 0.125 E longitude and -89.875 latitude. 其实分别为0.125 -89.875
        !The center of the second cell is 0.375 E longitude, -89.875 latitude. 0.375 -89.875
        !                XLAT=0.25*ILAT-90.125
        !                XLON=0.25*ILON-0.125
        !
      !This main program can be adapted to your needs.  It also calls a subroutine that extracts the rain data. 主程序根据自己的需要 也可以调用降雨数据的子函数
        !                Data Types:  数据类型:
        !                 IVAL = ICHAR(data_array(ilon,ilat,parameter,iasc)
        !                        1        GMT Time                GMT时间                        : mingmt  = IVAL * 6  (Minute of day GMT)
        !                        2   Wind Speed                        风速            : windspd = IVAL*0.2  (10m surface wind speed in m/s)
        !                        3        Wind Direction                    风向    : winddir = IVAL*1.5  (direction wind is flowing to, North is 0 deg)
        !                        4        Combination Rain Data        连接降水数据        : use bit extraction to access all data
        !                                            bit pos 0       SCATEROMETER rainflag (0=no rain, 1=rain)     0 没有降水 1 有降水
        !                                            bit pos 1       collocated SSMI, TMI or AMSR observation within 60 min=1, else=0
        !                                            bit pos 2-7     0-63: radiometer rain where:
        !                                                                                                0= absolutely no rain
        !                                                                                                1= rain in one of the adjacent cells
        !                                                                                                2= Radiometer columnar RR = 0.5  km*mm/hr
        !                                                                                                3= Radiometer columnar RR = 1.0
        !                                                                                                4: Radiometer columnar RR = 1.5         etc.
        !                                                                                        Rain subroutine will extract these bit flags and return 2 arrays
        !                                                                                        scatflag (0=no rain, 1 = rain) and
        !                                                                                        radrain:  -999.0 = no rad data
        !                                                                                                            -1.0 = adjacent rain exists
        !                                                                                                    0.0-31.0 = radiometer columnar rain rate in km*mm/hr
        !
        !Please make sure your system/compiler reads the data as an array of 8-bit unsigned integer values (0-255) 确保系统按照8-bit整型
        !the code in this routine reads the data as a character(1) array to accomplish this.  Adjust for your achitecture if needed.
        !
        !
        ! Written by D. Smith  January 2002
        ! Amended by D. Smith to new format  December 2002
        ! Renamed to get_qscat_daily_v03.f by D. Smith   August 2003
        ! Altered to read both qscat and seawinds files and -99. changed to -999. for consistency by D. Smith  July 2004
        ! Added cell definition information and signed integer stop   D.Smith  March 2005
        ! Fixed error with signed integer stop code  D.Smith  Feb 2006
        ! added comment for v3a data  D.Smith Jan 2007
        ! updated to version-4, only text changes  D.Smith April 2011
!*******************************************************************************************************************
        logical(4)      lexist

        character(1)        data_array(1440,720,4,2)
        character(120)  filename

        real(4)                        windspd(1440,720,2),winddir(1440,720,2)
        real(4)                        uu(1440,720,2),vv(1440,720,2)
        real(4)         mingmt(1440,720,2), radrain(1440,720,2)
        integer(4)      scatflag(1440,720,2)
        integer(4)      ival(1440,720)
        integer(4)                iasc
        integer(4)      IERR
                                                                        

*****************************************************************

        IERR=0

        ! Determine if file exists
      INQUIRE(FILE=filename,EXIST=lexist)
          IF (.not.(lexist)) THEN
                IERR = -1
                RETURN
        ENDIF


        ! Open file and Read Data
        OPEN(5,FILE=filename,STATUS='old',RECL=8294400,
     .        ACCESS='direct',FORM='unformatted')
        READ(5,rec=1) data_array
        CLOSE(5)



        ! Assign data to arrays
        DO iasc=1,2               

                !time
                    ival   = ICHAR(data_array(:,:,1,iasc))
                if(MINVAL(ival).lt.0) stop 'ival must be 0-255'
                mingmt(:,:,iasc) = ival*6.0

                !wind speed
                ival   = ICHAR(data_array(:,:,2,iasc))
                if(MINVAL(ival).lt.0) stop 'ival must be 0-255'
                WHERE (ival .le. 250)
                        windspd(:,:,iasc) = ival*0.2
                ELSEWHERE
                        windspd(:,:,iasc) = -999.0
                ENDWHERE

                !wind direction
                ival  = ICHAR(data_array(:,:,3,iasc))
                if(MINVAL(ival).lt.0) stop 'ival must be 0-255'
                WHERE (ival.le.250)
                        winddir(:,:,iasc) = ival*1.5
                        uu(:,:,iasc)=windspd(:,:,iasc)*SIND(winddir(:,:,iasc))
                        vv(:,:,iasc)=windspd(:,:,iasc)*COSD(winddir(:,:,iasc))
                ELSEWHERE
                        winddir        (:,:,iasc) = -999.0
                        uu                (:,:,iasc) = -999.0
                        vv                (:,:,iasc) = -999.0
                ENDWHERE

        ENDDO        !iasc


        !decode combination rain flag
        CALL get_rain(data_array, scatflag,radrain)

        
        RETURN
        END

        


***************************************************************************************
        SUBROUTINE get_rain(data_array, scatflag,radrain)

      character(1) data_array(1440,720,4,2)
        integer(4) scatflag(1440,720,2)
        real(4)    radrain (1440,720,2)

        integer(4) ilon,ilat,iasc,ival,radflag,krain


        do iasc=1,2

        do ilat=1,720
        do ilon=1,1440

        itime= ICHAR(data_array (ilon,ilat,1,iasc))
        if(itime.lt.0) stop 'itime must be 0-255'

        if (itime.gt.250) then
                scatflag(ilon,ilat,iasc)= -999.
                radrain (ilon,ilat,iasc)= -999.
                cycle
        endif
        ival = ICHAR(data_array (ilon,ilat,4,iasc))
        if(ival.lt.0) stop 'ival must be 0-255'
        scatflag(ilon,ilat,iasc) = IBITS(ival,0,1)  !start at zero, extract 1 bit                 !independant scatterometer rain flag
        radflag = IBITS(ival,1,1)  !start at one,  extract 1 bit
        krain   = IBITS(ival,2,6)  !start at two,  extract 6 bits

        IF (radflag  == 0)  radrain(ilon,ilat,iasc)  = -999.0                        !no collocated radiometer data

        IF (radflag  == 1) THEN
                IF(krain == 0)         radrain(ilon,ilat,iasc)  =    0.0                        !collocated radiometer data show no rain
        
                IF(krain == 1)  radrain(ilon,ilat,iasc)  =   -1.0                        !collocated radiometer data show rain in adjacent cells

            IF(krain  > 1)  radrain(ilon,ilat,iasc)  = krain/2. - 0.5        !collocated radiometer columnar rain rate (0.5 kg.mm/hr resolution)
        ENDIF

        enddo        !ilon
        enddo        !ilat

        enddo        !iasc

        RETURN
        END
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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