emcsfc_snow2mdl  1.13.0
 All Data Structures Files Functions Variables Pages
program_setup.F90
Go to the documentation of this file.
1 
5 
16 
17  implicit none
18 
19  private
20 
21  character*200, public :: afwa_snow_global_file
22  character*200, public :: afwa_snow_nh_file
23  character*200, public :: afwa_snow_sh_file
24  character*200, public :: afwa_lsmask_nh_file
25  character*200, public :: afwa_lsmask_sh_file
26  character*200, public :: autosnow_file
27  character*200, public :: climo_qc_file
29  character*200, public :: gfs_lpl_file
32  character*200, public :: model_lat_file
33  character*200, public :: model_lon_file
34  character*200, public :: model_lsmask_file
35  character*200, public :: model_snow_file
36  character*200, public :: nesdis_lsmask_file
37  character*200, public :: nesdis_snow_file
38 
39  integer, public :: grib_century
40 
41  integer, public :: grib_day
42  integer, public :: grib_hour
43  integer, public :: grib_month
44  integer, public :: grib_year
45 
46  logical, public :: output_grib2
47 
48  real, public :: lat_threshold
52  real, public :: min_snow_depth
53  real, public :: snow_cvr_threshold
55 
56  public :: read_config_nml
57 
58  contains
59 
80  subroutine read_config_nml
81 
82  implicit none
83 
84  integer, parameter :: iunit=41
85  integer :: istat
86 
87  namelist /source_data/ autosnow_file, &
88  nesdis_snow_file, &
89  nesdis_lsmask_file, &
90  afwa_snow_global_file, &
91  afwa_snow_nh_file, &
92  afwa_snow_sh_file, &
93  afwa_lsmask_nh_file, &
94  afwa_lsmask_sh_file
95 
96  namelist /qc/ climo_qc_file
97 
98  namelist /model_specs/ model_lat_file, &
99  model_lon_file, &
100  model_lsmask_file, &
101  gfs_lpl_file
102 
103  namelist /output_data/ model_snow_file, &
104  output_grib2
105 
106  namelist /output_grib_time/ grib_year, &
107  grib_month, &
108  grib_day, &
109  grib_hour
110 
111  namelist /parameters/ lat_threshold, &
112  min_snow_depth, &
113  snow_cvr_threshold
114 
115  print*,''
116  print*,"- READ CONFIGURATION NAMELIST"
117 
118  open(iunit, iostat=istat)
119 
120  if (istat /= 0) then
121  print*,''
122  print*,'- FATAL ERROR: BAD OPEN ON CONFIG NAMELIST. ISTAT IS ', istat
123  close(iunit)
124  call w3tage('SNOW2MDL')
125  call errexit(77)
126  end if
127 
128  read(iunit, nml=source_data, iostat=istat, err=900)
129 
130  read(iunit, nml=qc, iostat=istat, err=900)
131 
132  read(iunit, nml=model_specs, iostat=istat, err=900)
133 
134  read(iunit, nml=output_data, iostat=istat, err=900)
135 
136  read(iunit, nml=output_grib_time, iostat=istat, err=900)
137 
138  read(iunit, nml=parameters, iostat=istat, err=900)
139 
140  close(iunit)
141 
142 !-----------------------------------------------------------------------
143 ! the user determines the date/time stamp for the final interpolated
144 ! model data.
145 !-----------------------------------------------------------------------
146 
147  grib_century = grib_year / 100
148 
149  grib_year = mod(grib_year,100)
150 
151  if (grib_year == 0) then
152  grib_year = 100
153  else
154  grib_century = grib_century + 1
155  end if
156 
157  return
158 
159  900 continue
160  print*,''
161  print*,'- FATAL ERROR: BAD READ ON CONFIG NAMELIST. ISTAT IS ', istat
162  close(iunit)
163  call w3tage('SNOW2MDL')
164  call errexit(78)
165 
166  end subroutine read_config_nml
167 
168  end module program_setup
This module reads in data from the program's configuration namelist.
subroutine, public read_config_nml
Read namelist control.