OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
get_lut_211sfc_nc4.f90
Go to the documentation of this file.
1 subroutine get_lut_211sfc( lut_file, status)
2  !
3  !f90
4  !description:
5  ! This subroutine reads LUTs for 2.1um sfc refl. calculation
6  ! file= 'nvalx21um4sfc.hdf'
7  ! array dimension [10,46,30,4]
8 
9  ! ver. 1.0 modified by MJ (aug 2011)
10  !
11  ! use GeneralAuxType
12  ! use lut_arrays
13 
14 ! include 'hdf.f90'
15 ! include 'dffunc.f90'
16  use netcdf
17 
18  implicit none
19  include 'sfc21tbl90.inc'
20 
21  character(*), intent (in) :: lut_file
22  integer, intent (out) :: status
23  integer, dimension (4) :: start, edges, stride
24 
25  integer :: number_type, nattrs
26  integer :: sds_id, sds_index, attr_index, hdfid
27  character(len=255) :: sds_name
28  character(len=255) :: dset_name
29  character(len=255) :: attr_name
30  character(len=255) :: group_name
31 
32  integer :: nc_id
33  integer :: dim_id
34  integer :: dset_id
35  integer :: grp_id
36 
37  start = (/ 1,1,1,1 /)
38  edges = (/ 10,46,30,4 /)
39  stride = (/ 1,1,1,1 /)
40 
41  status = nf90_open(lut_file, nf90_nowrite, nc_id)
42  if (status /= nf90_noerr) then
43  print *, "ERROR: Failed to open deepblue lut_nc4 file: ", status
44  return
45  end if
46 
47  group_name = 'VEG_21SFC'
48  status = nf90_inq_ncid(nc_id, group_name, grp_id)
49  if (status /= nf90_noerr) then
50  print *, "ERROR: Failed to get ID of group "//trim(group_name)//": ", status
51  return
52  end if
53 
54  dset_name = 'NVALX21_SFC'
55  status = nf90_inq_varid(grp_id, dset_name, dset_id)
56  if (status /= nf90_noerr) then
57  print *, "ERROR: Failed to get ID of dataset "//trim(dset_name)//": ", status
58  return
59  end if
60  status = nf90_get_var(grp_id, dset_id, nvalx21, start=start, &
61  stride=stride, count=edges)
62  if (status /= nf90_noerr) then
63  print *, "ERROR: Failed to read dataset "//trim(dset_name)//": ", status
64  return
65  end if
66 
67  dset_name = 'R0X21_SFC'
68  status = nf90_inq_varid(grp_id, dset_name, dset_id)
69  if (status /= nf90_noerr) then
70  print *, "ERROR: Failed to get ID of dataset "//trim(dset_name)//": ", status
71  return
72  end if
73  status = nf90_get_var(grp_id, dset_id, r0x_21, start=start, &
74  stride=stride, count=edges)
75  if (status /= nf90_noerr) then
76  print *, "ERROR: Failed to read dataset "//trim(dset_name)//": ", status
77  return
78  end if
79 
80  dset_name = 'SX21_SFC'
81  status = nf90_inq_varid(grp_id, dset_name, dset_id)
82  if (status /= nf90_noerr) then
83  print *, "ERROR: Failed to get ID of dataset "//trim(dset_name)//": ", status
84  return
85  end if
86  status = nf90_get_var(grp_id, dset_id, sx_21, start=start, &
87  stride=stride, count=edges)
88  if (status /= nf90_noerr) then
89  print *, "ERROR: Failed to read dataset "//trim(dset_name)//": ", status
90  return
91  end if
92 
93  dset_name = 'TX21_SFC'
94  status = nf90_inq_varid(grp_id, dset_name, dset_id)
95  if (status /= nf90_noerr) then
96  print *, "ERROR: Failed to get ID of dataset "//trim(dset_name)//": ", status
97  return
98  end if
99  status = nf90_get_var(grp_id, dset_id, tx_21, start=start, &
100  stride=stride, count=edges)
101  if (status /= nf90_noerr) then
102  print *, "ERROR: Failed to read dataset "//trim(dset_name)//": ", status
103  return
104  end if
105 
106  dset_name = 'NVALX672_SFC'
107  status = nf90_inq_varid(grp_id, dset_name, dset_id)
108  if (status /= nf90_noerr) then
109  print *, "ERROR: Failed to get ID of dataset "//trim(dset_name)//": ", status
110  return
111  end if
112  status = nf90_get_var(grp_id, dset_id, nvalx672, start=start, &
113  stride=stride, count=edges)
114  if (status /= nf90_noerr) then
115  print *, "ERROR: Failed to read dataset "//trim(dset_name)//": ", status
116  return
117  end if
118 
119  dset_name = 'R0X672_SFC'
120  status = nf90_inq_varid(grp_id, dset_name, dset_id)
121  if (status /= nf90_noerr) then
122  print *, "ERROR: Failed to get ID of dataset "//trim(dset_name)//": ", status
123  return
124  end if
125  status = nf90_get_var(grp_id, dset_id, r0x_672, start=start, &
126  stride=stride, count=edges)
127  if (status /= nf90_noerr) then
128  print *, "ERROR: Failed to read dataset "//trim(dset_name)//": ", status
129  return
130  end if
131 
132  dset_name = 'SX672_SFC'
133  status = nf90_inq_varid(grp_id, dset_name, dset_id)
134  if (status /= nf90_noerr) then
135  print *, "ERROR: Failed to get ID of dataset "//trim(dset_name)//": ", status
136  return
137  end if
138  status = nf90_get_var(grp_id, dset_id, sx_672, start=start, &
139  stride=stride, count=edges)
140  if (status /= nf90_noerr) then
141  print *, "ERROR: Failed to read dataset "//trim(dset_name)//": ", status
142  return
143  end if
144 
145  dset_name = 'TX672_SFC'
146  status = nf90_inq_varid(grp_id, dset_name, dset_id)
147  if (status /= nf90_noerr) then
148  print *, "ERROR: Failed to get ID of dataset "//trim(dset_name)//": ", status
149  return
150  end if
151  status = nf90_get_var(grp_id, dset_id, tx_672, start=start, &
152  stride=stride, count=edges)
153  if (status /= nf90_noerr) then
154  print *, "ERROR: Failed to read dataset "//trim(dset_name)//": ", status
155  return
156  end if
157 
158  dset_name = 'NVALX865_SFC'
159  status = nf90_inq_varid(grp_id, dset_name, dset_id)
160  if (status /= nf90_noerr) then
161  print *, "ERROR: Failed to get ID of dataset "//trim(dset_name)//": ", status
162  return
163  end if
164  status = nf90_get_var(grp_id, dset_id, nvalx865, start=start, &
165  stride=stride, count=edges)
166  if (status /= nf90_noerr) then
167  print *, "ERROR: Failed to read dataset "//trim(dset_name)//": ", status
168  return
169  end if
170 
171  dset_name = 'R0X865_SFC'
172  status = nf90_inq_varid(grp_id, dset_name, dset_id)
173  if (status /= nf90_noerr) then
174  print *, "ERROR: Failed to get ID of dataset "//trim(dset_name)//": ", status
175  return
176  end if
177  status = nf90_get_var(grp_id, dset_id, r0x_865, start=start, &
178  stride=stride, count=edges)
179  if (status /= nf90_noerr) then
180  print *, "ERROR: Failed to read dataset "//trim(dset_name)//": ", status
181  return
182  end if
183 
184  dset_name = 'SX865_SFC'
185  status = nf90_inq_varid(grp_id, dset_name, dset_id)
186  if (status /= nf90_noerr) then
187  print *, "ERROR: Failed to get ID of dataset "//trim(dset_name)//": ", status
188  return
189  end if
190  status = nf90_get_var(grp_id, dset_id, sx_865, start=start, &
191  stride=stride, count=edges)
192  if (status /= nf90_noerr) then
193  print *, "ERROR: Failed to read dataset "//trim(dset_name)//": ", status
194  return
195  end if
196 
197  dset_name = 'TX865_SFC'
198  status = nf90_inq_varid(grp_id, dset_name, dset_id)
199  if (status /= nf90_noerr) then
200  print *, "ERROR: Failed to get ID of dataset "//trim(dset_name)//": ", status
201  return
202  end if
203  status = nf90_get_var(grp_id, dset_id, tx_865, start=start, &
204  stride=stride, count=edges)
205  if (status /= nf90_noerr) then
206  print *, "ERROR: Failed to read dataset "//trim(dset_name)//": ", status
207  return
208  end if
209 
210  status = nf90_close(nc_id)
211  if (status /= nf90_noerr) then
212  print *, "ERROR: Failed to close lut_nc4 file: ", status
213  return
214  end if
215 
216 end subroutine get_lut_211sfc
217 
subroutine get_lut_211sfc(lut_file, status)
string & trim(string &s, const string &delimiters)
Definition: EnvsatUtil.cpp:29