MODULE MOD_NETCDF
  use netcdf

 IMPLICIT NONE
   PRIVATE
   INTEGER, PARAMETER :: &
            r4 = SELECTED_REAL_KIND(6)  ! Kind for 32-bits Real Numbers
   INTEGER, PARAMETER :: &
            r8 = SELECTED_REAL_KIND(15) ! Kind for 64-bits Real Numbers
   INTEGER, PARAMETER    :: nFile      =   1
   integer, parameter    :: nMaxFile   =   1
   integer, parameter    :: nvar       =  65
   integer, parameter    :: natrb      =   5
   INTEGER, PARAMETER    :: MAX_ATT_LEN= 800
   INTEGER, PUBLIC       :: xsize, ysize , tsize

   INTEGER, PARAMETER, PUBLIC :: nVarNetcdf(1:nvar)=RESHAPE((/&
       1          ,2            ,3            ,4           ,5           , 6          , 7          , 8          ,9           ,10          ,&
      11          ,12           ,13           ,14          ,15          ,16          ,17          ,18          ,19          ,20          ,&
      21          ,22           ,23           ,24          ,25          ,26          ,27          ,28          ,29          ,30          ,&
      31          ,32           ,33           ,34          ,35          ,36          ,37          ,38          ,39          ,40          ,&
      41          ,42           ,43           ,44          ,45          ,46          ,47          ,48          ,49          ,50          ,&
      51          ,52           ,53           ,54          ,55          ,56          ,57          ,58          ,59          ,60          ,&
      61          ,62           ,63           ,64          ,65/),(/nvar/))

  CHARACTER (len = 20), PARAMETER,PUBLIC :: VAR_NAME(1:nvar,1:nMaxFile)=RESHAPE((/&
      "grid_xt   ","lon        ","grid_yt    ","lat        ","time       ","alnsf      ","alnwf      ","alvsf      ","alvwf      ","cnwat      ",&
      "crain     ","f10m       ","facsf      ","facwf      ","ffhh       ","ffmm       ","fricv      ","icec       ","icetk      ","land       ",&
      "orog      ","sfcr       ","shdmax     ","shdmin     ","sltyp      ","snoalb     ","snod       ","soill1     ","soill2     ","soill3     ",&
      "soill4    ","soilt1     ","soilt2     ","soilt3     ","soilt4     ","soilw1     ","soilw2     ","soilw3     ","soilw4     ","sotyp      ",&
      "spfh2m    ","tg3        ","tisfc      ","tmp2m      ","tmpsfc     ","tprcp      ","veg        ","vtype      ","weasd      ","c0         ",&
      "cd        ","dconv      ","dtcool     ","qrain      ","tref       ","w0         ","wd         ","xs         ","xt         ","xtts       ",&
      "xu        ","xv         ","xz         ","xzts       ","zc         "/),(/nvar,nMaxFile/))

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_latitude
     character (len =  9) :: long_name               = "long_name" ;
     character (len =  9) :: units                   = "units" ;

     character (len = 15) :: var_long_name            != "T-cell latitude" ;
     character (len = 99) :: var_units                != "degrees_N" ;
  END TYPE attribute_latitude
  TYPE(attribute_latitude) :: Coord_lat


  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_Longitude
     character (len =  9) :: long_name               = "long_name" ;
     character (len =  9) :: units                   = "units" ;

     character (len = 99) :: var_long_name                != "T-cell longitude" ;
     character (len = 99) :: var_units                    != "degrees_E" ;
  END TYPE attribute_Longitude
  TYPE(attribute_Longitude) :: Coord_lon
 
  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_time
     character (len =  9) :: long_name             = "long_name"
     character (len =  9) :: units                 = "units" ;
     character (len = 14) :: cartesian_axis        = "cartesian_axis"
     character (len = 13) :: calendar_type         = "calendar_type"  
     character (len =  9) :: calendar              = "calendar" ;

     character (len = 99) :: var_long_name           != "Time" ;
     character (len = 99) :: var_units               != "hours since 2022-08-04 00:00:00" ;
     character (len = 99) :: var_cartesian_axis      != "T" ;
     character (len = 99) :: var_calendar_type       != "JULIAN"    
     character (len = 99) :: var_calendar            != "JULIAN" ;
  END TYPE attribute_time
  TYPE(attribute_time) :: Coordtime


  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_alnsf
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "mean nir albedo with strong cosz dependency" ;
     character (len = 99)  :: var_units           != "%" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_alnsf
  TYPE(attribute_atmos_alnsf) :: atmos_alnsf

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_alnwf
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "mean nir albedo with weak cosz dependency" ;
     character (len = 99)  :: var_units           != "%" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_alnwf
  TYPE(attribute_atmos_alnwf) :: atmos_alnwf

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_alvsf
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "mean vis albedo with strong cosz dependency" ;
     character (len = 99)  :: var_units           != "%" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_alvsf
  TYPE(attribute_atmos_alvsf) :: atmos_alvsf

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_alvwf
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "mean vis albedo with weak cosz dependency" ;
     character (len = 99)  :: var_units           != "%" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_alvwf
  TYPE(attribute_atmos_alvwf) :: atmos_alvwf

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_cnwat
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "canopy water (cnwat in gfs data)" ;
     character (len = 99)  :: var_units           != "%" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_cnwat
  TYPE(attribute_atmos_cnwat) :: atmos_cnwat


  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_crain
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "instantaneous categorical rain" ;
     character (len = 99)  :: var_units           != "%" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_crain
  TYPE(attribute_atmos_crain) :: atmos_crain
  
  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_f10m
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "10-meter wind speed divided by lowest model wind speed" ;
     character (len = 99)  :: var_units           != "%" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_f10m
  TYPE(attribute_atmos_f10m) :: atmos_f10m  
  
  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_facsf
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "fractional coverage with strong cosz dependency" ;
     character (len = 99)  :: var_units           != "%" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_facsf
  TYPE(attribute_atmos_facsf) :: atmos_facsf  

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_facwf
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "fractional coverage with weak cosz dependency" ;
     character (len = 99)  :: var_units           != "%" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_facwf
  TYPE(attribute_atmos_facwf) :: atmos_facwf

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_ffhh
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "fh parameter from PBL scheme" ;
     character (len = 99)  :: var_units           != "XXX" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_ffhh
  TYPE(attribute_atmos_ffhh) :: atmos_ffhh

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_ffmm
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "fm parameter from PBL scheme" ;
     character (len = 99)  :: var_units           != "XXX" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_ffmm
  TYPE(attribute_atmos_ffmm) :: atmos_ffmm

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_fricv
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "uustar surface frictional wind" ;
     character (len = 99)  :: var_units           != "XXX" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_fricv
  TYPE(attribute_atmos_fricv) :: atmos_fricv

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_icec
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "surface ice concentration (ice=1; no ice=0)" ;
     character (len = 99)  :: var_units           != "fraction" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_icec
  TYPE(attribute_atmos_icec) :: atmos_icec

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_icetk
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "sea ice thickness (icetk in gfs_data)" ;
     character (len = 99)  :: var_units           != "XXX" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_icetk
  TYPE(attribute_atmos_icetk) :: atmos_icetk  

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_land
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "sea-land-ice mask (0-sea, 1-land, 2-ice)" ;
     character (len = 99)  :: var_units           != "numerical" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_land
  TYPE(attribute_atmos_land) :: atmos_land 


  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_orog
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "surface geopotential height" ;
     character (len = 99)  :: var_units           != "gpm" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_orog
  TYPE(attribute_atmos_orog) :: atmos_orog 

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_sfcr
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "surface roughness" ;
     character (len = 99)  :: var_units           != "m" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_sfcr
  TYPE(attribute_atmos_sfcr) :: atmos_sfcr 

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_shdmax
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "maximum fractional coverage of green vegetation" ;
     character (len = 99)  :: var_units           != "XXX" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_shdmax
  TYPE(attribute_atmos_shdmax) :: atmos_shdmax 

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_shdmin
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "minimum fractional coverage of green vegetation" ;
     character (len = 99)  :: var_units           != "XXX" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_shdmin
  TYPE(attribute_atmos_shdmin) :: atmos_shdmin 

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_sltyp
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "surface slope type" ;
     character (len = 99)  :: var_units           != "XXX" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_sltyp
  TYPE(attribute_atmos_sltyp) :: atmos_sltyp 

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_snoalb
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "maximum snow albedo in fraction" ;
     character (len = 99)  :: var_units           != "XXX" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_snoalb
  TYPE(attribute_atmos_snoalb) :: atmos_snoalb 

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_snod
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "surface snow depth" ;
     character (len = 99)  :: var_units           != "m" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_snod
  TYPE(attribute_atmos_snod) :: atmos_snod 

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_soill1
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "liquid soil moisture at layer-1" ;
     character (len = 99)  :: var_units           != "XXX" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_soill1
  TYPE(attribute_atmos_soill1) :: atmos_soill1 
  
  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_soill2
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "liquid soil moisture at layer-2" ;
     character (len = 99)  :: var_units           != "XXX" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_soill2
  TYPE(attribute_atmos_soill2) :: atmos_soill2 

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_soill3
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "liquid soil moisture at layer-3" ;
     character (len = 99)  :: var_units           != "XXX" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_soill3
  TYPE(attribute_atmos_soill3) :: atmos_soill3 
  
  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_soill4
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "liquid soil moisture at layer-4" ;
     character (len = 99)  :: var_units           != "XXX" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_soill4
  TYPE(attribute_atmos_soill4) :: atmos_soill4

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_soilt1
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "soil temperature 0-10cm" ;
     character (len = 99)  :: var_units           != "K" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_soilt1
  TYPE(attribute_atmos_soilt1) :: atmos_soilt1

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_soilt2
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "soil temperature 10-40cm" ;
     character (len = 99)  :: var_units           != "K" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_soilt2
  TYPE(attribute_atmos_soilt2) :: atmos_soilt2

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_soilt3
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "soil temperature 40-100cm" ;
     character (len = 99)  :: var_units           != "K" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_soilt3
  TYPE(attribute_atmos_soilt3) :: atmos_soilt3  

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_soilt4
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "soil temperature 100-200cm" ;
     character (len = 99)  :: var_units           != "K" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_soilt4
  TYPE(attribute_atmos_soilt4) :: atmos_soilt4

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_soilw1
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "volumetric soil moisture 0-10cm" ;
     character (len = 99)  :: var_units           != "fraction" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_soilw1
  TYPE(attribute_atmos_soilw1) :: atmos_soilw1

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_soilw2
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "volumetric soil moisture 10-40cm" ;
     character (len = 99)  :: var_units           != "fraction" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_soilw2
  TYPE(attribute_atmos_soilw2) :: atmos_soilw2

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_soilw3
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "volumetric soil moisture 40-100cm" ;
     character (len = 99)  :: var_units           != "fraction" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_soilw3
  TYPE(attribute_atmos_soilw3) :: atmos_soilw3

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_soilw4
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "volumetric soil moisture 100-200cm" ;
     character (len = 99)  :: var_units           != "fraction" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_soilw4
  TYPE(attribute_atmos_soilw4) :: atmos_soilw4

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_sotyp
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "soil type in integer" ;
     character (len = 99)  :: var_units           != "number" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_sotyp
  TYPE(attribute_atmos_sotyp) :: atmos_sotyp


  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_spfh2m
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "2m specific humidity" ;
     character (len = 99)  :: var_units           != "kg/kg" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_spfh2m
  TYPE(attribute_atmos_spfh2m) :: atmos_spfh2m

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_tg3
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "deep soil temperature" ;
     character (len = 99)  :: var_units           != "K" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_tg3
  TYPE(attribute_atmos_tg3) :: atmos_tg3

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_tisfc
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "deep soil temperature" ;
     character (len = 99)  :: var_units           != "K" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_tisfc
  TYPE(attribute_atmos_tisfc) :: atmos_tisfc

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_tmp2m
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "2m temperature" ;
     character (len = 99)  :: var_units           != "K" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_tmp2m
  TYPE(attribute_atmos_tmp2m) :: atmos_tmp2m

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_tmpsfc
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "surface temperature" ;
     character (len = 99)  :: var_units           != "K" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_tmpsfc
  TYPE(attribute_atmos_tmpsfc) :: atmos_tmpsfc

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_tprcp
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "total precipitation" ;
     character (len = 99)  :: var_units           != "kg/m**2" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_tprcp
  TYPE(attribute_atmos_tprcp) :: atmos_tprcp

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_veg
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "vegetation fraction" ;
     character (len = 99)  :: var_units           != "fraction" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_veg
  TYPE(attribute_atmos_veg) :: atmos_veg

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_vtype
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "vegetation type in integer" ;
     character (len = 99)  :: var_units           != "number" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_vtype
  TYPE(attribute_atmos_vtype) :: atmos_vtype

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_weasd
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "surface snow water equivalent" ;
     character (len = 99)  :: var_units           != "number" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_weasd
  TYPE(attribute_atmos_weasd) :: atmos_weasd  

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_c0
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "nsst coefficient1 to calculate d(tz)/d(ts)" ;
     character (len = 99)  :: var_units           != "number" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_c0
  TYPE(attribute_atmos_c0) :: atmos_c0

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_cd
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "nsst coefficient2 to calculate d(tz)/d(ts)" ;
     character (len = 99)  :: var_units           != "number" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_cd
  TYPE(attribute_atmos_cd) :: atmos_cd

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_dconv
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "nsst coefficient2 to calculate d(tz)/d(ts)" ;
     character (len = 99)  :: var_units           != "number" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_dconv
  TYPE(attribute_atmos_dconv) :: atmos_dconv

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_dtcool
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "nsst sub-layer cooling amount" ;
     character (len = 99)  :: var_units           != "k" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_dtcool
  TYPE(attribute_atmos_dtcool) :: atmos_dtcool


  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_qrain
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "nsst sensible heat flux due to rainfall" ;
     character (len = 99)  :: var_units           != "w/m2" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_qrain
  TYPE(attribute_atmos_qrain) :: atmos_qrain


  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_tref
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "nsst reference or foundation temperature" ;
     character (len = 99)  :: var_units           != "K" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_tref
  TYPE(attribute_atmos_tref) :: atmos_tref
  
  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_w0
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "nsst coefficient3 to calculate d(tz)/d(ts)" ;
     character (len = 99)  :: var_units           != "K" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_w0
  TYPE(attribute_atmos_w0) :: atmos_w0
  
  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_wd
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "nsst coefficient4 to calculate d(tz)/d(ts)" ;
     character (len = 99)  :: var_units           != "K" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_wd
  TYPE(attribute_atmos_wd) :: atmos_wd  

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_xs
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "nsst salinity content in diurnal thermocline layer" ;
     character (len = 99)  :: var_units           != "K" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_xs
  TYPE(attribute_atmos_xs) :: atmos_xs  

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_xt
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "nsst heat content in diurnal thermocline layer" ;
     character (len = 99)  :: var_units           != "k*m" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_xt
  TYPE(attribute_atmos_xt) :: atmos_xt  

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_xtts
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "nsst d(xt)/d(ts)" ;
     character (len = 99)  :: var_units           != m" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_xtts
  TYPE(attribute_atmos_xtts) :: atmos_xtts  

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_xu
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "nsst u-current content in diurnal thermocline layer" ;
     character (len = 99)  :: var_units           != m2/s" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_xu
  TYPE(attribute_atmos_xu) :: atmos_xu  

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_xv
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "nsst v-current content in diurnal thermocline layer" ;
     character (len = 99)  :: var_units           != m2/s" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_xv
  TYPE(attribute_atmos_xv) :: atmos_xv  

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_xz
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "nsst diurnal thermocline layer thickness" ;
     character (len = 99)  :: var_units           != m" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_xz
  TYPE(attribute_atmos_xz) :: atmos_xz  

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_xzts
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "" ;
     character (len = 99)  :: var_units           != m/k" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_xzts
  TYPE(attribute_atmos_xzts) :: atmos_xzts 

  ! We recommend that each variable carry a "units" attribute.
  TYPE :: attribute_atmos_zc
     character (len =  9) :: long_name        = "long_name" ;
     character (len =  9) :: units            = "units" ;
     character (len = 13) :: missing_value    = "missing" ;
     character (len = 12) :: cell_methods     = "cell_methods"
     character (len = 11) :: output_file      = "output_file"

     character (len = 99)  :: var_long_name       != "nsst sub-layer cooling thickness" ;
     character (len = 99)  :: var_units           != m" ;
     REAL(KIND=r4)         :: var_missing_value   != 9.99e+20 ;
     character (len = 99)  :: var_cell_methods    ! = "time: point"
     character (len = 99)  :: var_output_file     ! = "sfc"
   END TYPE attribute_atmos_zc
  TYPE(attribute_atmos_zc) :: atmos_zc


   CHARACTER (len = 526) :: FILE_NAME
   integer               :: ncid
   INTEGER               :: ndims_in  
   INTEGER               :: nvars_in
   INTEGER               :: ngatts_in 
   INTEGER               :: unlimdimid_in
   CHARACTER(LEN=50)     :: xname, yname,zname,zname2, tname
   INTEGER               :: ivar 
   ! We will read surface temperature and pressure fields. In netCDF
   ! terminology these are called "variables."
   CHARACTER (len = 26), PARAMETER :: ATR_NAME(1:natrb)=RESHAPE((/&
      "nsoil           ",&
      "source          ",&
      "grid            ",&
      "im              ",&
      "jm              "/),(/natrb/))

  TYPE :: GBL_attribute
    INTEGER                       :: IntegerGlobal          !"= "UNCLASSIFIED" ;
    CHARACTER (len = MAX_ATT_LEN) :: StringGlobal(natrb)    !"= "UNCLASSIFIED" ;
    INTEGER                       :: IntegerGlobal_im       !"= "UNCLASSIFIED" ;
    INTEGER                       :: IntegerGlobal_jm       !"= "UNCLASSIFIED" ;
  END TYPE GBL_attribute
  TYPE(GBL_attribute), ALLOCATABLE :: Agbl(:)


  integer, ALLOCATABLE :: var_varid    (:,:)
  integer, ALLOCATABLE :: start        (:)
  INTEGER, ALLOCATABLE :: count        (:)
  REAL (KIND=r4)    , ALLOCATABLE  :: buff(:)

  PUBLIC :: Init_Netcdf_Parameter 
  PUBLIC :: READ_Netcdf_Field
  PUBLIC :: Finalize_Netcdf_Parameter
  
CONTAINS

 SUBROUTINE Init_Netcdf_Parameter(FILE_NAME)
   IMPLICIT NONE
   CHARACTER(LEN=*), INTENT(IN   ) :: FILE_NAME

   PRINT*,TRIM(FILE_NAME)

   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   ! Allocate memory.
   !  IF(ALLOC_INIT)THEN
   IF (.not. Allocated( Agbl      ) )   ALLOCATE(Agbl      (1:nMaxFile))
   If (.not. Allocated( var_varid ) )   ALLOCATE(var_varid (1:nvar,1:nMaxFile))
   !     ALLOC_INIT=.FALSE.
   !  END IF 
   ! Open the input file. 
   CALL check( nf90_open  (TRIM(FILE_NAME)    , nf90_nowrite, ncid) )

   !PRINT*,'passei 0'

  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  !
  !
  ! There are a number of inquiry functions in netCDF which can be
  ! used to learn about an unknown netCDF file. NF90_INQ tells how maysize
  ! netCDF variables, dimensions, and global attributes are in the
  ! file; also the dimension id of the unlimited dimension, if there
  ! is one.
  CALL check( nf90_inquire(ncid, ndims_in, nvars_in, ngatts_in, unlimdimid_in))


  !PRINT*,'passei 1'
  
  !Inquire about the dimensions
  !:-------:-------:-------:-------:-------:-------:-------:
  CALL check(nf90_inquire_dimension(ncid,1,xname ,xsize))
  CALL check(nf90_inquire_dimension(ncid,2,yname ,ysize))
  CALL check(nf90_inquire_dimension(ncid,3,tname ,tsize))
  !PRINT*,'passei 2'
  !
  ! Get the varids of the pressure and temperature netCDF variables.
  !
  !:-------:-------:-------:-------:-------:-------:-------:
  call check( nf90_get_att(ncid, nf90_global,  ATR_NAME(1)    , Agbl(nFile)%IntegerGlobal))
  call check( nf90_get_att(ncid, nf90_global,  ATR_NAME(2)    , Agbl(nFile)%StringGlobal(2)))
  call check( nf90_get_att(ncid, nf90_global,  ATR_NAME(3)    , Agbl(nFile)%StringGlobal(3)))
  call check( nf90_get_att(ncid, nf90_global,  ATR_NAME(4)    , Agbl(nFile)%IntegerGlobal_im))
  call check( nf90_get_att(ncid, nf90_global,  ATR_NAME(5)    , Agbl(nFile)%IntegerGlobal_jm))

  !PRINT*,'passei 3'

  ! Get the varids of the latitude and longitude coordinate variables.

  DO ivar=1,nvar
     call check( nf90_inq_varid(ncid, VAR_NAME(ivar,nFile) , var_varid(ivar,nFile)) )
  END DO 

  !PRINT*,'passei 4'

  ! Define the coordinate variables. We will only define coordinate
  ! variables for lat and lon.  Ordinarily we would need to provide
  ! an array of dimension IDs for each variable's dimensions, but
  ! since coordinate variables only have one dimension, we can
  ! simply provide the address of that dimension ID (lat_dimid) and
  ! similarly for (lon_dimid).

  ! Assign units attributes to the netCDF variables.

  ! We recommend that each variable carry a "units" attribute.

    call check( nf90_get_att(ncid    ,var_varid(2,nFile),  Coord_lon%long_name            , Coord_lon%var_long_name         ) )
    call check( nf90_get_att(ncid    ,var_varid(2,nFile),  Coord_lon%units                , Coord_lon%var_units             ) )
  !PRINT*,'passei 5'

    call check( nf90_get_att(ncid    ,var_varid(4,nFile), Coord_lat%long_name             , Coord_lat%var_long_name         ) )
    call check( nf90_get_att(ncid    ,var_varid(4,nFile), Coord_lat%units                 , Coord_lat%var_units             ) )
  !PRINT*,'passei 6'

    call check( nf90_get_att(ncid    ,var_varid(5,nFile),  Coordtime%long_name            , Coordtime%var_long_name         ) )
    call check( nf90_get_att(ncid    ,var_varid(5,nFile),  Coordtime%units                , Coordtime%var_units             ) )
    call check( nf90_get_att(ncid    ,var_varid(5,nFile),  Coordtime%cartesian_axis       , Coordtime%var_cartesian_axis    ) )
    call check( nf90_get_att(ncid    ,var_varid(5,nFile),  Coordtime%calendar_type        , Coordtime%var_calendar_type     ) )
    call check( nf90_get_att(ncid    ,var_varid(5,nFile),  Coordtime%calendar             , Coordtime%var_calendar          ) )
  !PRINT*,'passei 7'
    
    call check( nf90_get_att(ncid    ,var_varid(6,nFile),  atmos_alnsf%long_name          ,  atmos_alnsf%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(6,nFile),  atmos_alnsf%units              ,  atmos_alnsf%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(6,nFile),  atmos_alnsf%missing_value      ,  atmos_alnsf%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(6,nFile),  atmos_alnsf%cell_methods       ,  atmos_alnsf%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(6,nFile),  atmos_alnsf%output_file        ,  atmos_alnsf%var_output_file    ))
  !PRINT*,'passei 8'

    call check( nf90_get_att(ncid    ,var_varid(7,nFile),  atmos_alnwf%long_name          ,  atmos_alnwf%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(7,nFile),  atmos_alnwf%units              ,  atmos_alnwf%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(7,nFile),  atmos_alnwf%missing_value      ,  atmos_alnwf%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(7,nFile),  atmos_alnwf%cell_methods       ,  atmos_alnwf%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(7,nFile),  atmos_alnwf%output_file        ,  atmos_alnwf%var_output_file    ))

  !PRINT*,'passei 9'

    call check( nf90_get_att(ncid    ,var_varid(8,nFile),  atmos_alvsf%long_name          ,  atmos_alvsf%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(8,nFile),  atmos_alvsf%units              ,  atmos_alvsf%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(8,nFile),  atmos_alvsf%missing_value      ,  atmos_alvsf%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(8,nFile),  atmos_alvsf%cell_methods       ,  atmos_alvsf%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(8,nFile),  atmos_alvsf%output_file        ,  atmos_alvsf%var_output_file    ))


    call check( nf90_get_att(ncid    ,var_varid(9,nFile),  atmos_alvwf%long_name          ,  atmos_alvwf%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(9,nFile),  atmos_alvwf%units              ,  atmos_alvwf%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(9,nFile),  atmos_alvwf%missing_value      ,  atmos_alvwf%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(9,nFile),  atmos_alvwf%cell_methods       ,  atmos_alvwf%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(9,nFile),  atmos_alvwf%output_file        ,  atmos_alvwf%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(10,nFile),  atmos_cnwat%long_name          ,  atmos_cnwat%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(10,nFile),  atmos_cnwat%units              ,  atmos_cnwat%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(10,nFile),  atmos_cnwat%missing_value      ,  atmos_cnwat%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(10,nFile),  atmos_cnwat%cell_methods       ,  atmos_cnwat%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(10,nFile),  atmos_cnwat%output_file        ,  atmos_cnwat%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(11,nFile),  atmos_crain%long_name          ,  atmos_crain%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(11,nFile),  atmos_crain%units              ,  atmos_crain%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(11,nFile),  atmos_crain%missing_value      ,  atmos_crain%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(11,nFile),  atmos_crain%cell_methods       ,  atmos_crain%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(11,nFile),  atmos_crain%output_file        ,  atmos_crain%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(12,nFile),  atmos_f10m%long_name          ,  atmos_f10m%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(12,nFile),  atmos_f10m%units              ,  atmos_f10m%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(12,nFile),  atmos_f10m%missing_value      ,  atmos_f10m%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(12,nFile),  atmos_f10m%cell_methods       ,  atmos_f10m%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(12,nFile),  atmos_f10m%output_file        ,  atmos_f10m%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(13,nFile),  atmos_facsf%long_name          ,  atmos_facsf%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(13,nFile),  atmos_facsf%units              ,  atmos_facsf%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(13,nFile),  atmos_facsf%missing_value      ,  atmos_facsf%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(13,nFile),  atmos_facsf%cell_methods       ,  atmos_facsf%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(13,nFile),  atmos_facsf%output_file        ,  atmos_facsf%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(14,nFile),  atmos_facwf%long_name          ,  atmos_facwf%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(14,nFile),  atmos_facwf%units              ,  atmos_facwf%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(14,nFile),  atmos_facwf%missing_value      ,  atmos_facwf%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(14,nFile),  atmos_facwf%cell_methods       ,  atmos_facwf%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(14,nFile),  atmos_facwf%output_file        ,  atmos_facwf%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(15,nFile),  atmos_ffhh%long_name          ,  atmos_ffhh%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(15,nFile),  atmos_ffhh%units              ,  atmos_ffhh%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(15,nFile),  atmos_ffhh%missing_value      ,  atmos_ffhh%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(15,nFile),  atmos_ffhh%cell_methods       ,  atmos_ffhh%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(15,nFile),  atmos_ffhh%output_file        ,  atmos_ffhh%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(16,nFile),  atmos_ffmm%long_name          ,  atmos_ffmm%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(16,nFile),  atmos_ffmm%units              ,  atmos_ffmm%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(16,nFile),  atmos_ffmm%missing_value      ,  atmos_ffmm%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(16,nFile),  atmos_ffmm%cell_methods       ,  atmos_ffmm%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(16,nFile),  atmos_ffmm%output_file        ,  atmos_ffmm%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(17,nFile),  atmos_fricv%long_name          ,  atmos_fricv%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(17,nFile),  atmos_fricv%units              ,  atmos_fricv%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(17,nFile),  atmos_fricv%missing_value      ,  atmos_fricv%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(17,nFile),  atmos_fricv%cell_methods       ,  atmos_fricv%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(17,nFile),  atmos_fricv%output_file        ,  atmos_fricv%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(18,nFile),  atmos_icec%long_name          ,  atmos_icec%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(18,nFile),  atmos_icec%units              ,  atmos_icec%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(18,nFile),  atmos_icec%missing_value      ,  atmos_icec%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(18,nFile),  atmos_icec%cell_methods       ,  atmos_icec%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(18,nFile),  atmos_icec%output_file        ,  atmos_icec%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(19,nFile),  atmos_icetk%long_name          ,  atmos_icetk%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(19,nFile),  atmos_icetk%units              ,  atmos_icetk%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(19,nFile),  atmos_icetk%missing_value      ,  atmos_icetk%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(19,nFile),  atmos_icetk%cell_methods       ,  atmos_icetk%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(19,nFile),  atmos_icetk%output_file        ,  atmos_icetk%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(20,nFile),  atmos_land%long_name          ,  atmos_land%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(20,nFile),  atmos_land%units              ,  atmos_land%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(20,nFile),  atmos_land%missing_value      ,  atmos_land%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(20,nFile),  atmos_land%cell_methods       ,  atmos_land%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(20,nFile),  atmos_land%output_file        ,  atmos_land%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(21,nFile),  atmos_orog%long_name          ,  atmos_orog%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(21,nFile),  atmos_orog%units              ,  atmos_orog%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(21,nFile),  atmos_orog%missing_value      ,  atmos_orog%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(21,nFile),  atmos_orog%cell_methods       ,  atmos_orog%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(21,nFile),  atmos_orog%output_file        ,  atmos_orog%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(22,nFile),  atmos_sfcr%long_name          ,  atmos_sfcr%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(22,nFile),  atmos_sfcr%units              ,  atmos_sfcr%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(22,nFile),  atmos_sfcr%missing_value      ,  atmos_sfcr%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(22,nFile),  atmos_sfcr%cell_methods       ,  atmos_sfcr%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(22,nFile),  atmos_sfcr%output_file        ,  atmos_sfcr%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(23,nFile),  atmos_shdmax%long_name        ,  atmos_shdmax%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(23,nFile),  atmos_shdmax%units            ,  atmos_shdmax%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(23,nFile),  atmos_shdmax%missing_value    ,  atmos_shdmax%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(23,nFile),  atmos_shdmax%cell_methods     ,  atmos_shdmax%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(23,nFile),  atmos_shdmax%output_file      ,  atmos_shdmax%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(24,nFile),  atmos_shdmin%long_name        ,  atmos_shdmin%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(24,nFile),  atmos_shdmin%units            ,  atmos_shdmin%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(24,nFile),  atmos_shdmin%missing_value    ,  atmos_shdmin%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(24,nFile),  atmos_shdmin%cell_methods     ,  atmos_shdmin%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(24,nFile),  atmos_shdmin%output_file      ,  atmos_shdmin%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(25,nFile),  atmos_sltyp%long_name        ,  atmos_sltyp%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(25,nFile),  atmos_sltyp%units            ,  atmos_sltyp%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(25,nFile),  atmos_sltyp%missing_value    ,  atmos_sltyp%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(25,nFile),  atmos_sltyp%cell_methods     ,  atmos_sltyp%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(25,nFile),  atmos_sltyp%output_file      ,  atmos_sltyp%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(26,nFile),  atmos_snoalb%long_name        ,  atmos_snoalb%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(26,nFile),  atmos_snoalb%units            ,  atmos_snoalb%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(26,nFile),  atmos_snoalb%missing_value    ,  atmos_snoalb%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(26,nFile),  atmos_snoalb%cell_methods     ,  atmos_snoalb%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(26,nFile),  atmos_snoalb%output_file      ,  atmos_snoalb%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(27,nFile),  atmos_snod%long_name        ,  atmos_snod%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(27,nFile),  atmos_snod%units            ,  atmos_snod%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(27,nFile),  atmos_snod%missing_value    ,  atmos_snod%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(27,nFile),  atmos_snod%cell_methods     ,  atmos_snod%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(27,nFile),  atmos_snod%output_file      ,  atmos_snod%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(28,nFile),  atmos_soill1%long_name        ,  atmos_soill1%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(28,nFile),  atmos_soill1%units            ,  atmos_soill1%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(28,nFile),  atmos_soill1%missing_value    ,  atmos_soill1%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(28,nFile),  atmos_soill1%cell_methods     ,  atmos_soill1%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(28,nFile),  atmos_soill1%output_file      ,  atmos_soill1%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(29,nFile),  atmos_soill2%long_name        ,  atmos_soill2%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(29,nFile),  atmos_soill2%units            ,  atmos_soill2%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(29,nFile),  atmos_soill2%missing_value    ,  atmos_soill2%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(29,nFile),  atmos_soill2%cell_methods     ,  atmos_soill2%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(29,nFile),  atmos_soill2%output_file      ,  atmos_soill2%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(30,nFile),  atmos_soill3%long_name        ,  atmos_soill3%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(30,nFile),  atmos_soill3%units            ,  atmos_soill3%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(30,nFile),  atmos_soill3%missing_value    ,  atmos_soill3%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(30,nFile),  atmos_soill3%cell_methods     ,  atmos_soill3%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(30,nFile),  atmos_soill3%output_file      ,  atmos_soill3%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(31,nFile),  atmos_soill4%long_name        ,  atmos_soill4%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(31,nFile),  atmos_soill4%units            ,  atmos_soill4%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(31,nFile),  atmos_soill4%missing_value    ,  atmos_soill4%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(31,nFile),  atmos_soill4%cell_methods     ,  atmos_soill4%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(31,nFile),  atmos_soill4%output_file      ,  atmos_soill4%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(32,nFile),  atmos_soilt1%long_name        ,  atmos_soilt1%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(32,nFile),  atmos_soilt1%units            ,  atmos_soilt1%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(32,nFile),  atmos_soilt1%missing_value    ,  atmos_soilt1%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(32,nFile),  atmos_soilt1%cell_methods     ,  atmos_soilt1%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(32,nFile),  atmos_soilt1%output_file      ,  atmos_soilt1%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(33,nFile),  atmos_soilt2%long_name        ,  atmos_soilt2%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(33,nFile),  atmos_soilt2%units            ,  atmos_soilt2%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(33,nFile),  atmos_soilt2%missing_value    ,  atmos_soilt2%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(33,nFile),  atmos_soilt2%cell_methods     ,  atmos_soilt2%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(33,nFile),  atmos_soilt2%output_file      ,  atmos_soilt2%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(34,nFile),  atmos_soilt3%long_name        ,  atmos_soilt3%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(34,nFile),  atmos_soilt3%units            ,  atmos_soilt3%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(34,nFile),  atmos_soilt3%missing_value    ,  atmos_soilt3%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(34,nFile),  atmos_soilt3%cell_methods     ,  atmos_soilt3%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(34,nFile),  atmos_soilt3%output_file      ,  atmos_soilt3%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(35,nFile),  atmos_soilt4%long_name        ,  atmos_soilt4%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(35,nFile),  atmos_soilt4%units            ,  atmos_soilt4%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(35,nFile),  atmos_soilt4%missing_value    ,  atmos_soilt4%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(35,nFile),  atmos_soilt4%cell_methods     ,  atmos_soilt4%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(35,nFile),  atmos_soilt4%output_file      ,  atmos_soilt4%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(36,nFile),  atmos_soilw1%long_name        ,  atmos_soilw1%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(36,nFile),  atmos_soilw1%units            ,  atmos_soilw1%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(36,nFile),  atmos_soilw1%missing_value    ,  atmos_soilw1%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(36,nFile),  atmos_soilw1%cell_methods     ,  atmos_soilw1%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(36,nFile),  atmos_soilw1%output_file      ,  atmos_soilw1%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(37,nFile),  atmos_soilw2%long_name        ,  atmos_soilw2%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(37,nFile),  atmos_soilw2%units            ,  atmos_soilw2%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(37,nFile),  atmos_soilw2%missing_value    ,  atmos_soilw2%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(37,nFile),  atmos_soilw2%cell_methods     ,  atmos_soilw2%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(37,nFile),  atmos_soilw2%output_file      ,  atmos_soilw2%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(38,nFile),  atmos_soilw3%long_name        ,  atmos_soilw3%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(38,nFile),  atmos_soilw3%units            ,  atmos_soilw3%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(38,nFile),  atmos_soilw3%missing_value    ,  atmos_soilw3%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(38,nFile),  atmos_soilw3%cell_methods     ,  atmos_soilw3%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(38,nFile),  atmos_soilw3%output_file      ,  atmos_soilw3%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(39,nFile),  atmos_soilw4%long_name        ,  atmos_soilw4%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(39,nFile),  atmos_soilw4%units            ,  atmos_soilw4%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(39,nFile),  atmos_soilw4%missing_value    ,  atmos_soilw4%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(39,nFile),  atmos_soilw4%cell_methods     ,  atmos_soilw4%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(39,nFile),  atmos_soilw4%output_file      ,  atmos_soilw4%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(40,nFile),  atmos_sotyp%long_name        ,  atmos_sotyp%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(40,nFile),  atmos_sotyp%units            ,  atmos_sotyp%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(40,nFile),  atmos_sotyp%missing_value    ,  atmos_sotyp%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(40,nFile),  atmos_sotyp%cell_methods     ,  atmos_sotyp%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(40,nFile),  atmos_sotyp%output_file      ,  atmos_sotyp%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(41,nFile),  atmos_spfh2m%long_name        ,  atmos_spfh2m%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(41,nFile),  atmos_spfh2m%units            ,  atmos_spfh2m%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(41,nFile),  atmos_spfh2m%missing_value    ,  atmos_spfh2m%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(41,nFile),  atmos_spfh2m%cell_methods     ,  atmos_spfh2m%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(41,nFile),  atmos_spfh2m%output_file      ,  atmos_spfh2m%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(42,nFile),  atmos_tg3%long_name        ,  atmos_tg3%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(42,nFile),  atmos_tg3%units            ,  atmos_tg3%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(42,nFile),  atmos_tg3%missing_value    ,  atmos_tg3%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(42,nFile),  atmos_tg3%cell_methods     ,  atmos_tg3%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(42,nFile),  atmos_tg3%output_file      ,  atmos_tg3%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(43,nFile),  atmos_tisfc%long_name        ,  atmos_tisfc%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(43,nFile),  atmos_tisfc%units            ,  atmos_tisfc%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(43,nFile),  atmos_tisfc%missing_value    ,  atmos_tisfc%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(43,nFile),  atmos_tisfc%cell_methods     ,  atmos_tisfc%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(43,nFile),  atmos_tisfc%output_file      ,  atmos_tisfc%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(44,nFile),  atmos_tmp2m%long_name        ,  atmos_tmp2m%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(44,nFile),  atmos_tmp2m%units            ,  atmos_tmp2m%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(44,nFile),  atmos_tmp2m%missing_value    ,  atmos_tmp2m%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(44,nFile),  atmos_tmp2m%cell_methods     ,  atmos_tmp2m%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(44,nFile),  atmos_tmp2m%output_file      ,  atmos_tmp2m%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(45,nFile),  atmos_tmpsfc%long_name        ,  atmos_tmpsfc%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(45,nFile),  atmos_tmpsfc%units            ,  atmos_tmpsfc%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(45,nFile),  atmos_tmpsfc%missing_value    ,  atmos_tmpsfc%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(45,nFile),  atmos_tmpsfc%cell_methods     ,  atmos_tmpsfc%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(45,nFile),  atmos_tmpsfc%output_file      ,  atmos_tmpsfc%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(46,nFile),  atmos_tprcp%long_name        ,  atmos_tprcp%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(46,nFile),  atmos_tprcp%units            ,  atmos_tprcp%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(46,nFile),  atmos_tprcp%missing_value    ,  atmos_tprcp%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(46,nFile),  atmos_tprcp%cell_methods     ,  atmos_tprcp%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(46,nFile),  atmos_tprcp%output_file      ,  atmos_tprcp%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(47,nFile),  atmos_veg%long_name        ,  atmos_veg%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(47,nFile),  atmos_veg%units            ,  atmos_veg%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(47,nFile),  atmos_veg%missing_value    ,  atmos_veg%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(47,nFile),  atmos_veg%cell_methods     ,  atmos_veg%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(47,nFile),  atmos_veg%output_file      ,  atmos_veg%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(48,nFile),  atmos_vtype%long_name        ,  atmos_vtype%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(48,nFile),  atmos_vtype%units            ,  atmos_vtype%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(48,nFile),  atmos_vtype%missing_value    ,  atmos_vtype%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(48,nFile),  atmos_vtype%cell_methods     ,  atmos_vtype%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(48,nFile),  atmos_vtype%output_file      ,  atmos_vtype%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(49,nFile),  atmos_weasd%long_name        ,  atmos_weasd%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(49,nFile),  atmos_weasd%units            ,  atmos_weasd%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(49,nFile),  atmos_weasd%missing_value    ,  atmos_weasd%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(49,nFile),  atmos_weasd%cell_methods     ,  atmos_weasd%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(49,nFile),  atmos_weasd%output_file      ,  atmos_weasd%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(50,nFile),  atmos_c0%long_name        ,  atmos_c0%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(50,nFile),  atmos_c0%units            ,  atmos_c0%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(50,nFile),  atmos_c0%missing_value    ,  atmos_c0%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(50,nFile),  atmos_c0%cell_methods     ,  atmos_c0%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(50,nFile),  atmos_c0%output_file      ,  atmos_c0%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(51,nFile),  atmos_cd%long_name        ,  atmos_cd%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(51,nFile),  atmos_cd%units            ,  atmos_cd%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(51,nFile),  atmos_cd%missing_value    ,  atmos_cd%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(51,nFile),  atmos_cd%cell_methods     ,  atmos_cd%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(51,nFile),  atmos_cd%output_file      ,  atmos_cd%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(52,nFile),  atmos_dconv%long_name        ,  atmos_dconv%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(52,nFile),  atmos_dconv%units            ,  atmos_dconv%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(52,nFile),  atmos_dconv%missing_value    ,  atmos_dconv%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(52,nFile),  atmos_dconv%cell_methods     ,  atmos_dconv%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(52,nFile),  atmos_dconv%output_file      ,  atmos_dconv%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(53,nFile),  atmos_dtcool%long_name        ,  atmos_dtcool%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(53,nFile),  atmos_dtcool%units            ,  atmos_dtcool%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(53,nFile),  atmos_dtcool%missing_value    ,  atmos_dtcool%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(53,nFile),  atmos_dtcool%cell_methods     ,  atmos_dtcool%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(53,nFile),  atmos_dtcool%output_file      ,  atmos_dtcool%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(54,nFile),  atmos_qrain%long_name        ,  atmos_qrain%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(54,nFile),  atmos_qrain%units            ,  atmos_qrain%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(54,nFile),  atmos_qrain%missing_value    ,  atmos_qrain%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(54,nFile),  atmos_qrain%cell_methods     ,  atmos_qrain%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(54,nFile),  atmos_qrain%output_file      ,  atmos_qrain%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(55,nFile),  atmos_tref%long_name        ,  atmos_tref%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(55,nFile),  atmos_tref%units            ,  atmos_tref%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(55,nFile),  atmos_tref%missing_value    ,  atmos_tref%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(55,nFile),  atmos_tref%cell_methods     ,  atmos_tref%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(55,nFile),  atmos_tref%output_file      ,  atmos_tref%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(56,nFile),  atmos_w0%long_name        ,  atmos_w0%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(56,nFile),  atmos_w0%units            ,  atmos_w0%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(56,nFile),  atmos_w0%missing_value    ,  atmos_w0%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(56,nFile),  atmos_w0%cell_methods     ,  atmos_w0%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(56,nFile),  atmos_w0%output_file      ,  atmos_w0%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(57,nFile),  atmos_wd%long_name        ,  atmos_wd%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(57,nFile),  atmos_wd%units            ,  atmos_wd%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(57,nFile),  atmos_wd%missing_value    ,  atmos_wd%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(57,nFile),  atmos_wd%cell_methods     ,  atmos_wd%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(57,nFile),  atmos_wd%output_file      ,  atmos_wd%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(58,nFile),  atmos_xs%long_name        ,  atmos_xs%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(58,nFile),  atmos_xs%units            ,  atmos_xs%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(58,nFile),  atmos_xs%missing_value    ,  atmos_xs%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(58,nFile),  atmos_xs%cell_methods     ,  atmos_xs%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(58,nFile),  atmos_xs%output_file      ,  atmos_xs%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(59,nFile),  atmos_xt%long_name        ,  atmos_xt%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(59,nFile),  atmos_xt%units            ,  atmos_xt%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(59,nFile),  atmos_xt%missing_value    ,  atmos_xt%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(59,nFile),  atmos_xt%cell_methods     ,  atmos_xt%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(59,nFile),  atmos_xt%output_file      ,  atmos_xt%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(60,nFile),  atmos_xtts%long_name        ,  atmos_xtts%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(60,nFile),  atmos_xtts%units            ,  atmos_xtts%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(60,nFile),  atmos_xtts%missing_value    ,  atmos_xtts%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(60,nFile),  atmos_xtts%cell_methods     ,  atmos_xtts%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(60,nFile),  atmos_xtts%output_file      ,  atmos_xtts%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(61,nFile),  atmos_xu%long_name        ,  atmos_xu%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(61,nFile),  atmos_xu%units            ,  atmos_xu%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(61,nFile),  atmos_xu%missing_value    ,  atmos_xu%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(61,nFile),  atmos_xu%cell_methods     ,  atmos_xu%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(61,nFile),  atmos_xu%output_file      ,  atmos_xu%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(62,nFile),  atmos_xv%long_name        ,  atmos_xv%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(62,nFile),  atmos_xv%units            ,  atmos_xv%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(62,nFile),  atmos_xv%missing_value    ,  atmos_xv%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(62,nFile),  atmos_xv%cell_methods     ,  atmos_xv%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(62,nFile),  atmos_xv%output_file      ,  atmos_xv%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(63,nFile),  atmos_xz%long_name        ,  atmos_xz%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(63,nFile),  atmos_xz%units            ,  atmos_xz%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(63,nFile),  atmos_xz%missing_value    ,  atmos_xz%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(63,nFile),  atmos_xz%cell_methods     ,  atmos_xz%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(63,nFile),  atmos_xz%output_file      ,  atmos_xz%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(64,nFile),  atmos_xzts%long_name        ,  atmos_xzts%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(64,nFile),  atmos_xzts%units            ,  atmos_xzts%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(64,nFile),  atmos_xzts%missing_value    ,  atmos_xzts%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(64,nFile),  atmos_xzts%cell_methods     ,  atmos_xzts%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(64,nFile),  atmos_xzts%output_file      ,  atmos_xzts%var_output_file    ))

    call check( nf90_get_att(ncid    ,var_varid(65,nFile),  atmos_zc%long_name        ,  atmos_zc%var_long_name      ))
    call check( nf90_get_att(ncid    ,var_varid(65,nFile),  atmos_zc%units            ,  atmos_zc%var_units          ))
    call check( nf90_get_att(ncid    ,var_varid(65,nFile),  atmos_zc%missing_value    ,  atmos_zc%var_missing_value  ))
    call check( nf90_get_att(ncid    ,var_varid(65,nFile),  atmos_zc%cell_methods     ,  atmos_zc%var_cell_methods   ))
    call check( nf90_get_att(ncid    ,var_varid(65,nFile),  atmos_zc%output_file      ,  atmos_zc%var_output_file    ))


  !PRINT*,'passei 10'

 END SUBROUTINE Init_Netcdf_Parameter

 SUBROUTINE READ_Netcdf_Field(SoilGdas,nfield)
  IMPLICIT NONE
  REAL(KIND=r8), INTENT(OUT  ) :: SoilGdas(:,:)
  INTEGER      , INTENT(IN   ) :: nfield
  INTEGER :: fieldsize,im,jm,i,j,ij
  im=Agbl(1)%IntegerGlobal_im
  jm=Agbl(1)%IntegerGlobal_jm
  fieldsize = im*jm
  If (.not. Allocated( count      ) )   ALLOCATE(count      (3))
  If (.not. Allocated( start      ) )   ALLOCATE(start      (3))
  If (.not. Allocated( buff       ) )   ALLOCATE(buff(fieldsize))

  ! Fields DIMS
  count     = (/    im,    jm,   1 /)
  start     = (/     1,     1,   1 /)
  start(3) = 1
  
  call check( nf90_get_var(ncid, var_varid(nfield,nFile),buff,start = start  , count = count))
  WRITE (UNIT=*, FMT='(A20,I5,1P3G12.5)') TRIM(VAR_NAME(nfield,1)),start(3), buff(1),MINVAL(buff),MAXVAL(buff)
  ij=0
  DO j=1,jm
     DO i=1,im
       ij=ij+1
       SoilGdas(i,j) = REAL(buff(ij),KIND=r8)
     END DO
  END DO
  If (Allocated( count      ) )   DEALLOCATE(count      )
  If (Allocated( start      ) )   DEALLOCATE(start      )
 END SUBROUTINE READ_Netcdf_Field

 SUBROUTINE Finalize_Netcdf_Parameter()
   IMPLICIT NONE
  !Close netcdf files
   call check( nf90_close(ncid) )

 END SUBROUTINE Finalize_Netcdf_Parameter

  SUBROUTINE check(status)
  USE netcdf
    INTEGER, INTENT ( in) :: status
    IF(status /= nf90_noerr) THEN 
      STOP 2
    END IF
  END SUBROUTINE check  

END MODULE MOD_NETCDF
