Email:  Password:  
  Forgot Password?  Register Now
UCAR > NCAR > CISL
Search:  
  
FAQs | Contact Us | For Staff
ds207.0 FORMATGo to Dataset: 
 


                           Climate Model Output Data
                           Format for Gridded Fields
                                 Dennis Joseph
                        NCAR, SCD, Data Support Section
                                  14 Sep 1993

     Climate model output data from various sources and in a variety of
     formats have been put into a common grid format to make it simple to
     use on most computers.  The format used for gridded data consists of a
     series of 120 character records.  These records can be read with stan-
     dard FORTRAN read statements as indicated in the sample read state-
     ments below.

     The first record of each grid is a general header and contains 104
     characters of free form comment information.  This information may
     come from the original data format or it may be generated during the
     format conversion.  This comment information may not be completely
     accurate since some changes, such as units, were made at NCAR and the
     comment may apply to the original file.  It usually describes the fol-
     lowing grid, but a full and current definition of the grid is con-
     tained in the identification variables which are in the next two
     records, the grid header records.  The actual grid data appears in
     records following the headers.  There will be as many records as
     necessary to contain all grid point values.

     The sample FORTRAN statements which follow, show examples of reading
     all data for the grid and of skipping over the data and reading only
     headers.  The format allows for a great deal of generality in data
     layout and formats, but in many applications much of this generality
     is not used.  Therefore, it is not necessary to program for all
     options.  The sample read programs included with the data should han-
     dle all format options in use for that data.































     Format                           -6-                      Gridded Data


           PROGRAM GRIDRD
     C                                                                       C
     C  READ PROGRAM FOR EPA CLIMATE MODEL FORMAT       12 SEP 89            C
     C                                                                       C
     C                                                                       C
     C DEFINE ARRAY LARGER THAN LARGEST DATA ARRAY EXPECTED
           PARAMETER (IDM=100,JDM=100)
           DIMENSION DATA(IDM,JDM),XLON(IDM)
           CHARACTER NCMTS*104,NFLG*2,NFORM*10,NFILE*16
     C                                                                       C
     C READ OF EPA EXCHANGE FORMAT (RECORD LENGTH = 120 BYTES)
     C                                                                       C
         2 PRINT 1012
      1012 FORMAT(' ENTER FILE NAME FOR READ')
           READ(5,1013,END=95)NFILE
      1013 FORMAT(A16)
           IF(NFILE(1:3).EQ.'END') GO TO 95
           PRINT 1014,NFILE
      1014 FORMAT(' READ FILE ',A16)
           OPEN(1,FILE=NFILE)
     C                                                                       C
           NRP=0
           NFR=0                                                             C
     C
     C READ GENERAL HEADER (NFLG=##)
         5 CONTINUE
           READ(1,999,END=90)NFLG,NCNT,NFTYP,NCMTS
       999 FORMAT(A2,I6,I8,A104)
           NFR=NFR+1
           NSKP=NCNT
           IF(NFR.GT.3) GO TO 58
           PRINT 1004,NFLG,NCNT,NFTYP,NCMTS
      1004 FORMAT(/,1X,A2,2I5,A104)
     C                                                                       C
     C                                                                       C
     C READ HEADER RECORDS FOR GRID FORMATS
     C                                                                       C
     C HEADER 1 (NFLGA=#A) CONTAINS IDENTIFICATION OF GRID AND SCALING
           READ (1,1000,END=90)NFLGA,NSRC,NDAT,NRUNCD,NMEAN,NPER,NLPM,
          2 NSTAT,NYR,NMO,NDY,NHR,NTYP,NUNITS,NSCALE,NFWID,NFORM,
          3 NLEVT,XLV1,XLV2,SCALE,BASE
      1000 FORMAT(A2,4I2,2I3,I2,I4,3I2,I4,I2,I1,I2,A10,
          2 I2,2E16.9,7X,2E16.9)
     C                                                                       C
           PRINT 1010,NFLGA,NSRC,NDAT,NRUNCD,NMEAN,NPER,NLPM,
          2 NSTAT,NYR,NMO,NDY,NHR,NTYP,NUNITS,NSCALE,NFWID,NFORM,
          3 NLEVT,XLV1,XLV2,SCALE,BASE
      1010 FORMAT(1X,A2,4I2,2I3,I2,I4,3I2,I4,I2,I1,I2,A10,
          2 I2,2E16.9,7X,2E16.9)
     C                                                                       C
     C TEST ID AND SELECT GRIDS TO PRINT, SKIP GRIDS NOT WANTED
           NSKP=NCNT-1
           IF(MOD(NMO,6).NE.1 .AND. NMO.NE.0) GO TO 58










     Format                           -7-                      Gridded Data


     C                                                                       C
     C HEADER 2 (NFLGB=#B) CONTAINS GRID SPECIFICATIONS
     C
           READ(1,1001,END=90)NFLGB,NGDEF,NGTYP,NORD,NI,NJ,XPI,XPJ,
          2 XNOR,XDI,XDJ
      1001 FORMAT(A2,3I2,2I4,24X,5E16.9)
     C                                                                       C
           PRINT 1011,NFLGB,NGDEF,NGTYP,NORD,NI,NJ,XPI,XPJ,
          2 XNOR,XDI,XDJ
      1011 FORMAT(1X,A2,3I2,2I4,24X,5E16.9)                                  C
     C
     C READ DATA POINTS
           READ(1,NFORM,END=90)((DATA(I,J),I=1,NI),J=1,NJ)
     C                                                                       C
     C SCALE IF NECESSARY
           IF(NSCALE.EQ.0) GO TO 16
           DO 10 J=1,NJ
           DO 10 I=1,NI
           DATA(I,J)=DATA(I,J)*SCALE + BASE
        10 CONTINUE
     C                                                                       C
        16 CONTINUE
           NRP=NRP+1
           IF(NI.LE.56) GO TO 20
     C PRINT FIRST 2 AND LAST 2 POINTS FROM DATA ARRAY
           PRINT 1005,DATA(1,1),DATA(2,1),DATA(NI-1,NJ),DATA(NI,NJ)
      1005 FORMAT(6E20.12)
           GO TO 5
     C                                                                       C
        20 CONTINUE
     C                                                                       C
     C PRINT ENTIRE GRID IF IT FITS ON PAGE
           INC=1.+((FLOAT(NI)-.5)/14.)
           DO 22 I=1,NI
        22 XLON(I)=XPI+XDI*(I-1)
           PRINT 1007,(XLON(I),I=1,NI,INC)
      1007 FORMAT(/,9X,14F8.2)
           DO 25 JJ=1,NJ
           J=NJ+1-JJ
           XLAT=XPJ+XDJ*(J-1)
           PRINT 1006,XLAT,(DATA(I,J),I=1,NI,INC)
      1006 FORMAT(1X,F6.2,2X,14F8.2)
        25 CONTINUE
           GO TO 5
     C                                                                       C
        58 CONTINUE
     C TO SKIP HEADERS AND DATA
           DO 60 I=1,NSKP
           READ(1,1003,END=90)DUMMY
      1003 FORMAT(A1)
        60 CONTINUE
           GO TO 5
        90 CONTINUE










     Format                           -8-                      Gridded Data


           PRINT 1015,NFR,NFILE
      1015 FORMAT(1X,I8,'  GRIDS READ FROM ',A16)
           CLOSE(1)
           GO TO 2
        95 CONTINUE
           STOP
           END
























































            Format                           -9-                      Gridded Data


                         Variable Definitions for EPA Gridded Format

                                        General Header

              NFLG - Flag to allow searching for the general header records,
                always = "##".

              NCNT - Number of records following this header, to allow straight
                forward skipping to next general header.

              NFTYP - Format type.
                1 = 2 dimension grid format defined below.

              NCMTS - Free form comments of up to 104 characters.




            Header 1,  for two dimensional grid format.

              NFLGA - Flag for first header, always = "#A"

              NSRC - Source of this data.
                1 = giss
                2 = gfdl
                3 = osu
                4 = ncar
                5 = uk met office
                6 = gfdl qflux run
                7 = gfdl r30 run
                8 = canadian climate centre
                11 = rand climatology
                12 = nasa climatology
                13 = nmc climate analysis center

              NDAT - Observed or predicted data.
                1 = observed data.
                2 = model predicted data.

              NRUNCD - Run code.
                0 = n/a
                1 = 1 x CO2
                2 = 2 x CO2
                3 = ratio of 2 x CO2 to 1 x CO2
                4 = ratio of transient runs scenario A to 1946-55 control run.
                5 = ratio of transient runs scenario B to 1946-55 control run.
                6 = control run from 1946-55 decade.
                7 = this scenario A run minus 1946-55 control run.
                8 = this scenario B run minus 1946-55 control run.
                9 = difference of 2 x CO2 - 1 x CO2
                10 = giss scenario A transient run
                11 = giss scenario B transient run











            Format                           -10-                     Gridded Data


              NMEAN - Type of mean.
                0 = data applies to date-time specified
                1 = mean of an individual continuous period (eg a year-month mean),
                    see NPER for period length
                2 = long period mean (an average of many continuous period means,
                    eg a mean of all januarys for 20 years)

              NPER - Period of data summary (length of continuous period used in
                mean)
                0 = data applies to date-time specified
                1 - 900 = approximate number of days represented by these values

              NLPM - Approximate number of periods which went into long period
                mean
                1 - 998 = approximate number of periods which went into long
                          period mean
                999     = unknown

              NSTAT - Statistics flag
                1 = mean or actual value
                2 = anomaly from longer period mean

              NYR, NMO, NDY, NHR Year, month, day, and hour to which this data
                applies.  Value set to all 9's when it does not apply.  Special
                month codes are 13=DJF, 14=MAM, 15=JJA, 16=SON, 17=Annual.

              NTYP - Type of data, see TABLE 1. The value 1000 is added to type
                numbers in the table to indicate a ratio to a control value rather
                than actual data values. The value 2000 is added for differences
                from a control value.

              NUNITS - Units of data where 0 is default, 1 is alternate 1, etc,
                see TABLE 1.

              NSCALE - Flag for scaling
                0 = no scaling necessary.
                1 = scaling required, VALUE =  RECORDEDVALUE*SCALE + BASE .
                2 = scaling required, VALUE =  RECORDEDVALUE*SCALE + BASE  and there can
                    be missing values in the grid.  The recorded missing value is zero
                    and therefore after scaling, VALUE=BASE indicates missing.

              NFWID - Field width of each variable in data format (ie 12 for NFORM
                shown below)

              NFORM - Format for data read (eg "(10E12.5)")

              NLEVT - Level type on which data is measured.
                1 = pressure level (mb)
                2 = height from sea level in meters
                3 = distance from earths surface in meters
                4 = sigma levels (% of atmosphere above this level)
                5 = entire troposphere
                51 = layer defined by pressure levels (mb) in XLV1 and XLV2










            Format                           -11-                     Gridded Data


                52 = layer, height levels from sea level (m) in XLV1 and XLV2
                53 = layer, heights from earths surface (m) in XLV1 and XLV2
                54 = earths boundary layer

              XLV1 - Level definition as specified by NLEVT

              XLV2 - Level definition as specified by NLEVT

              SCALE - Scale to be applied to data values to recover actual values

              BASE - Base to be applied to data values to recover actual values,
                (where SCALE=1. and BASE=0. the loop applying the BASE and SCALE
                is not necessary)





            Header 2, for two dimensional grid format.

              NFLGB - Flag for second header, always = "#B"

              NGDEF - Grid definition
                1 = this is exact duplicate of originators grid
                2 = this is a subgrid of exact points from originators grid
                3 = this is a grid interpolated from originators grid

              NGTYP - Grid Type
                1 = longitude x latitude grid
                3 = polar stereographic grid of nh
                4 = polar stereographic grid of sh

              NORD - Order in which grid points are written.
                1 = first point is lower left, I dimension scans first.
                2 = first point is lower left, J dimension scans first.
                3 = first point is upper left, I dimension scans first.
                4 = first point is upper left, J dimension scans first.

              NI - I dimension of grid.

              NJ - J dimension of grid.

              XPI - grid reference location.
                For NGTYP = 1 this is longitude of point at I,J = 1,1 (west is negative)
                For NGTYP = 3 or 4 this is exact I index of pole point on this grid

              XPJ - grid reference location.
                For NGTYP = 1 this is latitude of point at I,J = 1,1 (south is negative)
                For NGTYP = 3 or 4 this is exact J index of pole point on this grid

              XNOR - Orientation of grid
                For NGTYP = 1 this is always 0.
                For NGTYP = 3 or 4 this is the longitude of the horizontal line










            Format                           -12-                     Gridded Data


                            through and to the right of the pole point.

              XDI - Grid spacing in the I direction.
                For NGTYP = 1 this is degrees of longitude between consecutive points
                For NGTYP = 3 or 4 this is distance in grid units from equator to
                            pole in the I direction.

              XDJ - Grid spacing in the J direction.
                For NGTYP = 1 this is degrees of latitude between consecutive points
                For NGTYP = 3 this is distance in grid units from equator to pole in
                              the J direction (usually same as XDI)




















































            Format                           -13-                     Gridded Data


                                            TABLE 1
                                   Type Variable Definitions

                NTYP    Variable                NUNITS=  0           1           2

                   1     geopotential height             gpm         100gpm
                   8     pressure                        mb
                  16     atmospheric temperature         c           k
                  20     maximum temperature             c           k
                  21     minimum temperature             c           k
                  22     soil temperature                c           k
                  23     diurnal air temp change         c           k
                  24     surface skin temperature        c           k
                  48     u wind component                m/s
                  49     v wind component                m/s
                  50     wind speed                      m/s
                  51     special wind speed              m/s
                  59     vector wind speed               m/s
                  88     relative humidity               %
                  90     precipitation                   mm/dy       cm/day      .01"/day
                  91     snowfall                        mm/dy       cm/dy
                  92     snow depth                      mm          cm
                  93     snow & ice cover                %
                  94     water& ice over land            %
                  95     specific humidity               (10**-4)
                 101     mixing ratio                    (10**-4)
                 115     tropospheric stability          k/km
                 117     composite evaporation           mm/dy       cm/day   .01"/day
                 118     sfc runoff                      mm/dy       cm/day   .01"/day
                 119     plant water stress              (1)
                 120     soil moisture                   mm
                 121     soil moisture % of capacity     %
                 129     earth sfc elevation             m
                 161     land (-1.) / sea (0) flag
                 162     land coverage                   %
                 168     surface albedo                  %            %/100
                 169     albedo                          %            %/100
                 170     surface sensible heat flux      w/m**2      10ly/day
                 175     incident solar rad              w/m**2      100ly/day
                 178     net solar radiation             w/m**2
                 179     net thermal radiation           w/m**2      100ly/day
                 180     net long wave                   w/m**2      100ly/day
                 211     convective cloud                %
                 220     total cloud                     %            %/100
                 384     sea surface water temperature   c


[Top of page]
Updated 22 July 2005 

© 2009, UCAR  |  Privacy Policy  |  Terms of Use  |  Webmaster