Coupled Ocean Atmosphere Response Experiment (COARE)
Surface Meteorological Data Processing Center (DPC)
Center for Ocean-Atmospheric Prediction Studies
Florida State University
03 Aug 1995
Report COAREMET 95-11
Version 1.0
1. Introduction
The COARE American Standard Code for Information Interchange (ASCII) manual for quality controlled surface meteorological data outlines the codes used within the DPC surface meteorological data sets released to the COARE community. The code is a synthesis of the COADS documentation (Slutz et al. 1985), standard World Meteorological Organization (WMO) synoptic code, and new codes derived at Florida State University (FSU). In many places numeric codes were used to keep the data set compact.
The COARE ASCII data file includes up to 24 possible variables. In some cases, multiple measurements of the same variable are available (e.g. sea temperature measured from a thermosalinograph and a bucket temperature) and are differentiated using sequentially numbered variable names (TS, TS2, TS3, TS4, etc). As described in section 2, variables include not only meteorological data (temperature, pressure, etc.), but also a number of supporting variables (time of observation, platform position and movement, etc.). A variable containing quality control (QC) flags is included to indicate the QC applied to the data values. Multiple variable attributes provide information on data units, instruments used, instrument height, etc. in an attempt to provide an even mix between raw data and metadata. Eleven global attributes contain general information for all data within the ASCII file.
When the data that arrive at the Surface Meteorology DPC, the only change to the data is a simple conversion to a standard set of units. The original units are noted in a variable attribute. Any data arriving without an accurate time stamp or information on whether the time is local or GMT were discarded only after all attempts to obtain correct time information were exhausted. The data also must have position information, i.e. data lacking latitude and longitude values were discarded only after all attempts to correctly position the data failed. Furthermore, if data arrived with no units attached, only after every effort to determine their units was exhausted, were the data discarded. Data collected without a record of time, position, or units are useless to the research community. However, all original data contributions are archived in the event additional information is discovered later that would allow the inclusion of discarded data.
The ASCII file structure, an example is found in Appendix 1, begins with the file name followed by the eleven global attributes. The second part of the header is a table giving the values for the variable attributes. The final section of the file is the data in a column format with the variable names at the top of each data column. A sample FORTRAN code to read the ASCII file in Appendix 1 is presented in Appendix 2 and can be modified for any COARE ASCII file.
Section 2 outlines the data variables and attributes and describes all numeric codes that are employed. Section 3 covers the global attributes. Throughout the manual, variables will be indicated by bold type and attributes will be italicized.
Up to 24 variables with a maximum of 8 associated attributes may appear in a surface meteorology file for COARE, Table 1. All data files will contain the time, latitude, longitude, and quality control flag variables. The quality control flags are single alphabetic characters that represent either problems or notable features in the data. The quality control flags for multiple variables are combined in a single string and stored in the flag variable. The flag variable as a result is a character string that has a length equal to the number of variables that underwent quality control. (A list of the flags, their definitions, and an example of their usage is found in section 2x). For each variable, Table 1 shows whether or not that attribute is associated with a particular variable.
Table 1: Variable attribute list.
Variable     long_name     units       convers_  type      inst  ht  FORTRAN      qcindex   
                                       units                         _format                
ctc          cruise        code (see                                 A9                     
             track code    text)                                                            
time         time          min.                  Table 2             I12          *         
                           since                                                            
                           1-1-1980                                                         
                           00:00                                                            
lat          latitude      degrees N   Table 3                       F9.2         *         
lon          longitude     degrees E   Table 3                       F9.2         *         
PL_HD        platform      degrees -                *         F9.1         *         
             heading       clockwise                                                        
                           from N                                                           
PL_SPD       platform      m s-1       Table 5             *         F9.1         *         
             speed                                                                          
DIR          earth         degrees -   Table 4             *     *   F9.1         *         
             relative      clockwise                                                        
             wind          from N                                                           
             direction                                                                      
SPD          earth         m s-1       Table 5             *     *   F9.1         *         
             relative                                                                       
             wind speed                                                                     
P            atmospheric   mb          Table 6   Table 7   *     *   F9.1         *         
             pressure                                                                       
T            air           degrees C   Table 8             *     *   F9.2         *         
             temperature                                                                    
TW           wet-bulb      degrees C   Table 8             *     *   F9.2         *TD       
             temperature                                                                    
TD           dewpoint      degrees C   Table 8             *     *   F9.2         *TD       
             temperature                                                                    
TS           sea           degrees C   Table 8   Table 9   *     *   F9.2         *         
             temperature                                                                    
RH           relative      percent                         *     *   F9.1         *         
             humidity                                                                       
Q            specific      g kg-1                          *     *   F9.1         *         
             humidity                                                                       
PRECIP       precipitatio  mm          Table 10            *     *   F9.1         *         
             n                                                                              
WX           present       code                                      I6                     
             weather       (Table 11)                                                       
TCA          total cloud   code        Table 13                      I6                     
             amount        (Table 12)                                                       
LMCA         low/middle    code        Table 13                      I6                     
             cloud amount  (Table 12)                                                       
ZCL          cloud height  code                                      I6                     
                           (Table 14)                                                       
LCT          low cloud     code                                      I6                     
             type          (Table 15)                                                       
MCT          middle        code                                      I6                     
             cloud type    (Table 16)                                                       
HCT          high cloud    code                                      I6                     
             type          (Table 17)                                                       
flag         quality       code                                      A*                     
             control       (Table 18)                                                       
             flags                                                                          
The definition of the attributes are:
Code Definitions
A FORTRAN subroutine to convert from minutes since 1-1-1980 00:00 to year, month, day, hour, and minute values is provided in Appendix 3.
Platform position is in units of degrees; positive degrees for north latitude, negative degrees for south latitude, and positive 0-359 degrees east longitude. The units of the original values of latitude and longitude are found in Table 3.
Table 3: Units of original latitude and longitude.
Code Definitions
The latitude and longitude is quality controlled for data validity, unrealistic platform movement, and whether an oceanographic platform moves over land.
Table 4: Compass direction conversion units.
Code Definitions
Table 5: Wind speed conversion units.
Code Definitions
Table 6: Atmospheric pressure conversion units.
Code Definitions
Table 7: Atmospheric pressure type.
Code Definitions
All atmospheric temperatures are recorded in units of degrees Celsius after a conversion from the original units (see Table 8).
Table 8: Temperature conversion units.
Code Definitions
Table 9: General instrument types used to record sea temperature.
Code Definitions
Though the relative humidity, recorded in units of percent, is the more common moisture measurement; the specific humidity, always recorded in grams per kilogram, is preferred and supplied whenever it is present in the original data.
Table 10: Precipitation conversion units.
Code Definitions
An alternative measure of precipitation, the rain rate (RRATE) may be used in some files. The rain rate units are amount of rain per unit time. All other attributes are the same as in PRECIP.
Code Definitions
Codes 00 to 49 indicate no precipitation at the site (e.g., ship, buoy, etc.) at time of observation:
Codes 20 to 29 refer to phenomena that occurred at the station during the preceding hour but not at time of observation:
Codes 30 to 99 refer to phenomena occurring at the ship at time of observation:
Codes 50 to 99 indicate precipitation at the station at time of observation:
The codes for the total and low/middle cloud amounts (Table 14) are from the COADS data (Slutz et al. 1985). For the total cloud amount, codes 0 to 9 show the fraction, in oktas, of the celestial dome covered by all clouds. For the low/middle cloud amount the codes show the fraction, in oktas, of the celestial dome covered by all the low clouds and, if no low clouds are present, the fraction covered by all the middle clouds.
Code Definitions
If the data arriving at the DPC use tenths to describe cloud cover, the convention in Table 15 will be used to convert from tenths to oktas and the original data units will be noted using the codes in Table 16.
Table 13: Relationship between tenths and oktas
| tenths | oktas | 
| 0 | 0 | 
| 1 | 1 | 
| 2,3 | 2 | 
| 4 | 3 | 
| 5 | 4 | 
| 6 | 5 | 
| 7,8 | 6 | 
| 9 | 7 | 
| 10 | 8 | 
Table 14: Cloud amount conversion units
Code Definitions
Table 15: Cloud height codes, adapted from Table 9 of the COADS data documentation (Slutz et al. 1985)
Approximate height of lowest cloud base
| Code | Feet | Meters | 
| 0 | 0-149 | 0-49 | 
| 1 | 150-299 | 50-99 | 
| 2 | 300-599 | 100-199 | 
| 3 | 600-999 | 200-299 | 
| 4 | 1000-1999 | 300-599 | 
| 5 | 2000-3499 | 600-999 | 
| 6 | 3500-4999 | 1000-1499 | 
| 7 | 5000-6499 | 1500-1999 | 
| 8 | 6500-7999 | 2000-2499 | 
| 9 | >=8000 or no clouds | >=2500 or no clouds | 
10 indicates that the cloud height cannot be estimated because of darkness or for other reasons.
Code Definitions
Code Definitions
Code Definitions
Table 19: Definitions of COARE quality control flags
Flag Definitions
Table 20: Range Bounds used in determining the use of flag B
Variable Lower Bound Upper Bound Units Other time 1-1-1980 12-31-1999 latitude 90 90 degrees longitude 0 359 degrees platform heading 0 359 degrees platform speed 0 15 m/s research vessels 0 0 m/s stationary buoys 0 2 m/s drifters plat. wind direction 0 360 degrees plat. wind speed 0 40 m/s wind direction 0 360 degrees wind speed 0 40 m/s pressure 950 1050 mb Sea level air temperature 10 40 [[ring]] Celsius wet bulb temperature 10 40 [[ring]] Celsius dew point temperature 10 40 [[ring]] Celsius sea temperature 0 35 [[ring]] Celsius relative humidity 0 100 percent radiation
As an example of the usage of the flag variable, assume that a COARE ASCII file contains only time, latitude, longitude, atmospheric pressure, and air temperature data along with a flag variable. Based on Table 1, all five variables will be quality controlled and each will have a unique qcindex. If the values for the first record of all five variables pass all quality control checks, then the first record of the flag variable will contain "ZZZZZ"; i.e. the flag variable contains QC flags for each QC variable, in this example 5 flags. However, if the second record contains a non-sequential time, but good latitude and longitude values, a pressure value of 1090 mb, and a temperature that is 6 standard deviations from the climatology, then the second record of flag will contain "CZZBG". The qcindex allows access to the flags for any variable. For example, the flag for the second record for atmospheric pressure (qcindex=4) is a "B" indicating the pressure value is out of bounds.
The global attributes in the COARE DPC ASCII files include parameters that apply to all the variables in the file or to the file in general. Again a mix of data and metadata are included.
da Silva, A. M., C. C. Young, and S. Levitus, 1994: Atlas of Surface Marine Data, Volume 1: Algorithms and Procedures. NOAA Atlas Series. In preparation.
Example COARE-Met ASCII Data File
CCVG.931007011v100.nc
title        :Vidal Gormaz: WOCE PR_14_/04
site         :Vidal Gormaz
elev         :0
ID           :CCVG
platform     :Standard instrument shelter on open bridge
facility     :Chilean Navy
fsu_version  :100
missing_value:-9999
startdate    :7 OCT 1993
enddate      :17 OCT 1993
EXPOCODE     :20VG
Release_Date :22 JUN 1995
Variable(qcindex) long_name                     units                      convers_units type      ht  inst                                              FORTRAN_format
ctc     (       )cruise track code                                                                                                                      A9             
time    (      1)time                          minutes from 1-1-1980 00:00                  2                                                           I12            
lat     (      2)latitude                      degrees                                 0                                                                F9.2           
lon     (      3)longitude                     degrees east                            0                                                                F9.2           
PL_HD   (      4)platform heading              degrees                                 5              Magellan 5000D GPS                                F9.0           
PL_SPD  (      5)platform speed                meters/second                           5              Magellan 5000D GPS                                F9.1           
DIR     (      6)earth relative wind direction degrees true                            0        15.24 calculated from F420G Electric Speed Indicator    F9.0           
SPD     (      7)earth relative wind speed     meters/second                           5        15.24 calculated from F420G Electric Speed Indicator    F9.0           
P       (      8)atmospheric pressure          millibars                               0    2    9.50 Lufft model 8103 quartz barograph                 F9.1           
T       (      9)air temperature               Celsius                                 0         9.00 Nurnberg thermometer                              F9.1           
TS      (     10)sea temperature               Celsius                                 0    1 -999.90 thermocouple                                      F9.1           
TD      (     11)dewpoint temperature          Celsius                                 2         9.00 NOAA/NWS ship synoptic code table                 F9.1           
TW      (     12)wet bulb temperature          Celsius                                 0         9.00 Nurnberg thermometer                              F9.1           
WX      (       )present weather                                                                                                                        I6             
TCA     (       )total cloud amount                                                    1                                                                I6             
LMCA    (       )low/middle cloud amount                                               1                                                                I6             
ZCL     (       )cloud base height                                                                                                                      I6             
LCT     (       )low cloud type                                                                                                                         I6             
MCT     (       )middle cloud type                                                                                                                      I6             
HCT     (       )high cloud type                                                                                                                        I6             
flag    (       )quality control flags                                                                                                                  A12            
      ctc        time      lat      lon    PL_HD   PL_SPD      DIR      SPD        P        T       TS       TD       TW    WX   TCA  LMCA   ZCL   LCT   MCT   HCT        flag
PR_14_/04     7240680   -37.90   285.90     229.      0.8     180.       7.   1015.8     12.5     13.3     10.0     11.5     3     1     0     9     0    10    10ZZZZZEKZZZZZ
PR_14_/04     7241040   -38.00   285.30     270.      5.1     190.      10.   1018.0     13.0     13.3     11.0     12.0     3     8     8     1     4    10    10ZZZZZEEZZZZZ
PR_14_/04     7241400   -37.90   285.20     269.      5.7     190.       7.   1019.8     14.0     13.3     12.0     13.0     2     8     8     4     3    10    10ZZZZZEKZZZZZ
PR_14_/04     7241760   -37.90   284.40     238.      1.0     190.      10.   1021.0     13.5     13.3      9.0     11.0     2     8     8     5     3    10    10ZZZZZEKZZZZZ
PR_14_/04     7242120   -38.00   283.40     270.      5.7     190.       8.   1020.0     12.0     13.3      8.0     10.0     2     4     4     5     1    10    10ZZZZZEEZZZZZ
PR_14_/04     7242480   -38.00   282.50     269.      5.7     190.       7.   1022.5     14.0     14.0      9.0     11.0     3     7     7     5     2     0     0ZZZZZEEZZZZZ
PR_14_/04     7242840   -38.00   281.60     260.      5.7     190.       5.   1022.0     16.5     12.8      9.0     12.5     2     8     8     5     1    10    10ZZZZZEEZZZZZ
PR_14_/04     7243200   -38.00   280.40     271.      5.7     180.       6.   1022.0     12.5     13.3      7.0     10.0     2     5     5     5     3    10    10ZZZZZKKZZZZZ
PR_14_/04     7243560   -38.00   279.40     269.      5.7     190.       3.   1022.5     13.0     13.4      7.0     10.0     3     3     3     4     4     0     0ZZZZZEEZZZZZ
PR_14_/04     7243920   -37.90   278.40     270.      5.7     270.       5.   1023.0     13.0     13.9     10.0     11.5     3     8     8     4     4     8     0ZZZZZEEZZZZZ
PR_14_/04     7244280   -38.00   277.80     270.      0.5     210.       2.   1023.5     14.5     14.0     10.0     12.0     3     6     6     5     2     0     0ZZZZZEKZZZZZ
PR_14_/04     7244640   -38.10   277.80     180.      5.7     190.       3.   1023.0     16.5     14.0     10.0     13.0     1     1     1     4     2     0     0ZZZZZKEZZZZZ
PR_14_/04     7245000   -40.00   277.80     180.      5.7     290.       4.   1024.0     12.0     13.3     10.0     11.0     1     1     1     4     2     0     0ZZZZZEKZZZZZ
PR_14_/04     7245360   -40.60   277.80     180.      5.7     320.       7.   1022.0     12.0     12.2      9.0     10.5     0     0     0     9     0     0     0ZZZZZEKZZZZZ
PR_14_/04     7245720   -41.70   277.80     185.      5.7     300.       8.   1020.5     14.0     11.7     13.0     13.5     3     5     5     5     3     0     0ZZZZZEKZZZZZ
PR_14_/04     7246080   -42.50   277.80     182.      6.2     330.      12.   1016.5     12.0     11.7     10.0     11.0     2     7     7     6     4     0     6ZZZZZEKZZZZZ
PR_14_/04     7246440   -43.30   277.80     180.      6.2     320.      12.   1014.2     10.5     10.6     10.0     10.0    80     6     6     3     4    10    10ZZZZZEKZZZZZ
PR_14_/04     7246800   -44.10   277.80     180.      5.1     270.       8.   1014.6     10.0     10.6      8.0      9.0     2     5     5     4     8    10    10ZZZZZEKZZZZZ
PR_14_/04     7247160   -44.80   277.70     190.      5.1     260.      12.   1015.0     11.5     10.6      9.0      9.5     3     8     8     2     1     0     0ZZZZZKKZZZZZ
PR_14_/04     7247520   -45.50   277.70     190.      4.6     310.       9.   1016.0      9.0      9.0      8.0      7.5     3     7     7     2     1     0     0ZZZZZEKZZZDD
PR_14_/04     7247880   -46.20   277.80     210.      5.1     310.       9.   1015.0      9.0      9.0      7.0      8.0     1     0     0    10     0     0     0ZZZZZEKZZZZZ
PR_14_/04     7248240   -46.90   277.80     235.      4.1     320.      11.   1011.5      9.0      8.9      8.0      7.5     3     9     8     2     7    10    10ZZZZZEKZZZDD
PR_14_/04     7248600   -47.50   277.80     145.      4.6     310.      10.   1007.0      9.0      9.0      5.0      7.0     3     8     8     5     4    10    10ZZZZZEKZZZZZ
PR_14_/04     7248960   -48.00   278.10      95.      6.2     300.      10.   1002.0      9.0      8.9      5.0      7.0     3     8     8     4     8    10    10ZZZZZEKZZZZZ
PR_14_/04     7249320   -48.00   279.30      35.      6.2     360.      11.    999.0      9.0      8.9      8.0      8.5     3     9     8     4    10    10    10ZZZZZEEZZZZZ
PR_14_/04     7249680   -47.90   280.50      60.      5.0     350.      12.    995.0     10.5      9.0      9.0     10.0    14     8     8     4     7    10    10ZZZZZEEZZZZZ
PR_14_/04     7250040   -47.80   280.70     340.      1.0     350.      20.    992.5     10.5      8.9      9.0     10.0    14     8     8     4     8    10    10ZZZZZEKZZZZZ
PR_14_/04     7250400   -47.70   280.70     335.      1.0     300.      15.    994.5      9.5      8.9      6.0      8.0 -9999     8     8     4     8    10    10ZZZZZEKZZZZZ
PR_14_/04     7250760   -48.00   280.80     330.      0.0     330.       6.    998.0      8.5      7.8      7.0      7.5    25     8     8     3     8    10    10ZZZZZEKZZZZZ
PR_14_/04     7251120   -47.90   281.90      90.      5.1     150.      11.    993.0      6.0      7.6      0.0      6.0    25     8     8     3     8    10    10ZZZZZEKZZZZZ
PR_14_/04     7251480   -48.00   283.00       0.      1.0     350.      14.    989.0     11.0      9.4      9.0     11.0    25     8     8     3     8    10    10ZZZZZKKZZZZZ
PR_14_/04     7251840   -47.90   283.90     345.      3.8     320.      18.    995.0      7.5     10.6      7.0      7.0     1     7     7     4     8    10    10ZZZZZKEZZZZZ
PR_14_/04     7252200   -46.90   283.80       8.      5.1     240.       7.    998.5      9.0      9.0      5.0      7.0     1     2     2     4     6     0    10ZZZZZEKZZZZZ
PR_14_/04     7252560   -45.80   284.00       3.      5.1     160.       7.    996.2      8.4     10.6      1.0      6.5     3     8     8     4     7    10    10ZZZZZEKZZZZZ
PR_14_/04     7252920   -44.90   284.10      12.      5.1     120.       3.    992.8      9.5     10.0      4.0      7.0     3     7     7     4     4    10    10ZZZZZEEZZZZZ
PR_14_/04     7253280   -43.90   284.30      15.      5.7     350.       6.    998.5     11.0      9.8      9.0     10.0     3     8     8     4     4    10    10ZZZZZEKZZZZZ
PR_14_/04     7253640   -42.90   284.60      12.      5.7     180.       7.   1000.0     10.5     11.7      7.0      9.0     3     8     8     4     4    10    10ZZZZZEKZZZZZ
PR_14_/04     7254000   -41.60   285.00      20.      5.9     240.       9.   1006.5     10.5     10.0      9.0     10.0    25     8     8     3     6    10    10ZZZZZEKZZZZZ
PR_14_/04     7254360   -40.90   285.10      12.      6.2     250.       7.   1011.0     11.5     12.8     10.0     11.0    25     5     5     3     6    10    10ZZZZZEKZZZZZ
PR_14_/04     7254720   -39.90   285.50      16.      6.2     280.       9.   1012.0     12.0     12.8      7.0      9.5     3     5     5     5     4    10    10ZZZZZEEZZZZZ
PR_14_/04     7255080   -38.70   285.80      12.      5.7     330.      10.   1013.0     11.5     12.8     11.0     11.0    23     5     5     4     4    10    10ZZZZZEEZZZZZ
PR_14_/04     7255440   -37.60   286.10      15.      5.7       0.       9.   1014.2     10.0     12.8      2.0      9.0     3     7     7     4     1    10    10ZZZZZEEZZZZZ
PR_14_/04     7255800   -36.70   286.70      50.      5.7     340.       9.   1016.0     13.5     12.2     12.0     13.0     1     7     7     5     1     3     2ZZZZZEEZZZZZ
Appendix 2
[Does not, will not exist]
The following FORTRAN subroutine can be used to convert the time values from
the COARE ASCII files to two-digit year, month, day, hour, and minute values.
The routine processes individual time values (timestamp), but could be easily
modified to handle an entire time array.  The code can be acquired
electronically from:
	ftp coaremet.fsu.edu
	login anonymous
	cd pub/coare/src
	get invtime.f
and any problems that occur while using the code can be addressed to
coaremet@coaps.fsu.edu.
      subroutine invtime(timestamp,yr,mon,day,hr,min)
c      
c This subroutine will convert a minutes timestamp to a year/month
c date. Based on the function convtime by Shawn Smith (COAPS).
c
c Written the spring of 1995, several iterations.
c James N. Stricherz (stricherz@coaps.fsu.edu)
c
c This code returns correct results for the range of 01 Jan 1980 0000GMT
c thru 31 Dec 1999 2359GMT. I know it does, because I tried each minute
c of that range.
c
      integer year(1980:2000), month(13), leap_mon(13), min_day,
     +        min_hr, yr, mon, day, hr, min,timestamp,itime,tmon,ttime,
     +        thour
     
      data year /0, 527040, 1052640, 1578240, 2103840, 2630880, 3156480,
     +             3682080, 4207680, 4734720, 5260320, 5785920, 6311520,
     +             6838560, 7364160, 7889760, 8415360, 8942400, 9468000,
     +             9993600,10519200/    
      data month /0,  44640,  84960, 129600, 172800, 217440, 260640,
     +       305280, 349920, 393120, 437760, 480960,525600/
      data leap_mon /0,  44640,  86400, 131040, 174240, 218880, 262080,
     +          306720, 351360, 394560, 439200, 482400,527040/
      data min_day, min_hr /1440, 60/
*
*     ok, lets inverse the effects of the years -- subtract off the
*     number of minutes per year until it goes negative. iyr 
*     then gives the year that the time (in minutes) occurs...
*
      if (timestamp.ge.year(2000)) then
         yr=-9999
         return
      endif
      iyr=1979
      itime=timestamp
 10   iyr=iyr+1
      ttime=itime-year(iyr)
      if (ttime.le.0) then
         if (iyr.eq.1980) iyr=iyr+1
         iyr=iyr-1
         itime=itime-year(iyr)
      else
         goto 10
      endif
*
*     assign the return variable
*
      yr=iyr
*
*     ok, the remaining time is less than one full year, so convert
*     by the same method as above into months:
*
      imon=0
*
*     that darn leap month!
*
      if (mod(iyr,4).ne.0) then
*
*     increment the month, and subtract off the minutes from the
*     remaining time for a non-leap year
*
 20      imon=imon+1
         tmon=itime-month(imon)
         if (tmon.gt.0) then
            goto 20
         else if (tmon.lt.0) then
            imon=imon-1
            itime=itime-month(imon)
         else
            if (imon.gt.12) then
               imon=imon-12
               yr=yr+1
            endif
            mon=imon
            day=1
            hr=0
            min=0
            return
         endif
      else
*     
*     same thing, same code, but for a leap year
*
 30      imon=imon+1
         tmon=itime-leap_mon(imon)
         if (tmon.gt.0) then
            goto 30
         elseif (tmon.lt.0) then
            imon=imon-1
            itime=itime-month(imon)
         else
            if (imon.gt.12) then
               imon=imon-12
               yr=yr+1
            endif
            mon=imon
            day=1
            hr=0
            min=0
            return
         endif         
      endif
*
*     assign the return variable
*
      mon=imon
*
*     any remaining minutes will belong to day/hour/minutes
*     ok, let's get those pesky days!
*
      iday=0
 40   iday=iday+1
      ttime=itime-min_day
      if (ttime.ge.0) then
         itime=ttime
         goto 40
      endif
*
*     assign the return variable
*
      if (mod(iyr,4).eq.0.and.mon.gt.2) then
         day=iday-1
      else 
         day=iday
      endif
*
*     pick off the hours of the days...remember, hours can be 0, so
*     we start at -1
*
      ihour=-1
 50   ihour=ihour+1
      thour=itime-min_hr
      if (thour.ge.0) then
         itime=thour
         goto 50
      endif
*
*     assign the return variables
*
      hr=ihour
*
*     the remainder at this point is the minutes, so return them directly!
*
      min=itime
      return
      end