IODA Bundle
goes_converter.py
Go to the documentation of this file.
1 #
2 # goes_converter.py
3 #
4 # This class generates two IODAv2 data files from a group of raw data files for all 16 channels of GOES-16 or GOES-17
5 # LB1 products. This class works with the Goes and GoesLatLon classes. The final result of this class is two IODAv2
6 # formatted data files - one for Brightness Temperature and one for Reflectance Factor. The following groups, variables,
7 # dimensions, and attributes are created using this class.
8 #
9 # /GROUP/VARIABLE -> ATTRIBUTE
10 #
11 # / -> date_time
12 # / -> _ioda_layout
13 # / -> _ioda_layout_version
14 # /MetaData/datetime
15 # /MetaData/elevation_angle
16 # /MetaData/latitude
17 # /MetaData/longitude
18 # /MetaData/scan_angle
19 # /MetaData/time
20 # /ObsError/reflectance_factor or /ObsError/brightness_temperature
21 # /ObsValue/reflectance_factor or /ObsValue/brightness_temperature
22 # /ObsError/brightness_temperature -> units
23 # /ObsValue/brightness_temperature -> units
24 # /PreQC/reflectance_factor or /PreQC/brightness_temperature
25 # /PreQC/reflectance_factor -> flag_values or /PreQC/brightness_temperature -> flag_values
26 # /PreQC/reflectance_factor -> flag_meanings or /PreQC/brightness_temperature -> flag_meanings
27 # /VarMetaData/sensor_channel
28 # /VarMetaData/variable_names
29 # /nchans
30 # /ndatetime
31 # /nlocs
32 # /nstring
33 # /nvars
34 #
35 import datetime
36 import os
37 import sys
38 
39 import numpy as np
40 import pytz
41 from netCDF4 import Dataset
42 from numpy import ma
43 from solo.date import JediDate, CoreDate
44 from goes import Goes
45 from goes_latlon import GoesLatLon
46 
47 
49 
50  def __init__(self, input_file_paths, latlon_file_path, output_file_path_rf, output_file_path_bt):
51  """
52  Constructor
53  input_file_paths - A list of the absolute paths to all 16 ABI channels from the same hour
54  latlon_file_path - The path to an existing Goes LatLon file or if it does not exist the path to write the file
55  output_file_path_rf - The path to write the IODAv2 reflectance factor data file
56  output_file_path_bt - The path to write the IODAv2 brightness temperature data file
57  """
58  self._input_file_paths_input_file_paths = input_file_paths
59  self._latlon_file_path_latlon_file_path = latlon_file_path
60  self._output_file_path_rf_output_file_path_rf = output_file_path_rf
61  self._output_file_path_bt_output_file_path_bt = output_file_path_bt
62  self._latlon_dataset_latlon_dataset = None
63  self._output_dataset_bt_output_dataset_bt = None
64  self._output_dataset_rf_output_dataset_rf = None
65  self._check_arguments_check_arguments()
66 
67  def _check_arguments(self):
68  """
69  Checks the input arguments.
70  """
71  good_args = True
72  if len(self._input_file_paths_input_file_paths) != 16:
73  print("ERROR: input_file_paths must contain 16 GOES-16 or GOES-17 data files. One for each ABI channel.")
74  good_args = False
75  if not good_args:
76  sys.exit(2)
77 
79  """
80  Create two local dictionaries contained the Goes class instances for brightness temperature (ABI channels 1-6)
81  and reflectance factor (ABI channels 7-16). Each Goes instance calls the load method. This function also
82  assigns the file path for a template GOES file from ABI channel 7.
83  """
84  self._input_file_paths_input_file_paths.sort()
85  self._goes_dict_rf_goes_dict_rf = {}
86  self._goes_dict_bt_goes_dict_bt = {}
87  for input_file_path in self._input_file_paths_input_file_paths:
88  goes = Goes(input_file_path)
89  goes.load()
90  abi_channel = int(goes.get_abi_channel())
91  if abi_channel < 7:
92  self._goes_dict_rf_goes_dict_rf[abi_channel] = goes
93  else:
94  self._goes_dict_bt_goes_dict_bt[abi_channel] = goes
95  self._template_input_file_path_template_input_file_path = self._goes_dict_bt_goes_dict_bt[7].get_input_file_path()
96 
97  def _check_nadir(self):
98  """
99  Returns a boolean variable indicating whether the nadir has changed by comparing the lat_nadir and lon_nadir
100  attributes extracted from the GoesLatLon data file and the Goes template data file.
101  """
102  lat_nadir_latlon, lon_nadir_latlon = self._get_nadir_attribute_latlon_get_nadir_attribute_latlon()
103  lat_nadir_template, lon_nadir_template = self._get_nadir_attribute_template_get_nadir_attribute_template()
104  return lat_nadir_latlon == lat_nadir_template and lon_nadir_latlon == lon_nadir_template
105 
107  """
108  Returns the lat and lon nadir attribute from the Goes LatLon data file.
109  """
110  dataset = Dataset(self._latlon_file_path_latlon_file_path, 'r')
111  lat_nadir_latlon = dataset['MetaData'].variables['latitude'].getncattr('lat_nadir')
112  lon_nadir_latlon = dataset['MetaData'].variables['longitude'].getncattr('lon_nadir')
113  dataset.close()
114  return lat_nadir_latlon, lon_nadir_latlon
115 
117  """
118  Returns the lat and lon nadir attribute from the Goes template data file.
119  """
120  dataset = Dataset(self._template_input_file_path_template_input_file_path, 'r')
121  lat_nadir_template = dataset.variables['geospatial_lat_lon_extent'].getncattr('geospatial_lat_nadir')
122  lon_nadir_template = dataset.variables['geospatial_lat_lon_extent'].getncattr('geospatial_lon_nadir')
123  dataset.close()
124  return lat_nadir_template, lon_nadir_template
125 
127  """
128  Returns a boolean variable indicating whether the Goes LatLon file exists.
129  """
130  return os.path.exists(self._latlon_file_path_latlon_file_path)
131 
133  """
134  Creates a new Goes LatLon data file using the GoesLatLon class.
135  """
136  self._goes_lat_lon_goes_lat_lon = GoesLatLon(self._template_input_file_path_template_input_file_path, self._latlon_file_path_latlon_file_path)
137  self._goes_lat_lon_goes_lat_lon.create()
138 
139  def _close_datasets(self):
140  """
141  Closes the Goes latlon, reflectance factor, and brightness temperature netCDF4 Datasets.
142  """
143  self._output_dataset_bt_output_dataset_bt.close()
144  self._output_dataset_rf_output_dataset_rf.close()
145  self._latlon_dataset_latlon_dataset.close()
146 
148  """
149  Creates the /MetaData/latitude variable in the reflectance factor and brightness temperature netCDF4 Datasets.
150  """
151  latitude_data_array = self._latlon_dataset_latlon_dataset['MetaData'].variables['latitude'][:].real
152  self._output_dataset_rf_output_dataset_rf.createVariable('/MetaData/latitude', 'f4', 'nlocs', fill_value=-999)
153  self._output_dataset_rf_output_dataset_rf['/MetaData/latitude'][:] = latitude_data_array
154  self._output_dataset_bt_output_dataset_bt.createVariable('/MetaData/latitude', 'f4', 'nlocs', fill_value=-999)
155  self._output_dataset_bt_output_dataset_bt['/MetaData/latitude'][:] = latitude_data_array
156 
158  """
159  Creates the /MetaData/longitude variable in the reflectance factor and brightness temperature netCDF4 Datasets.
160  """
161  longitude_data_array = self._latlon_dataset_latlon_dataset['MetaData'].variables['longitude'][:].real
162  self._output_dataset_rf_output_dataset_rf.createVariable('/MetaData/longitude', 'f4', 'nlocs', fill_value=-999)
163  self._output_dataset_rf_output_dataset_rf['/MetaData/longitude'][:] = longitude_data_array
164  self._output_dataset_bt_output_dataset_bt.createVariable('/MetaData/longitude', 'f4', 'nlocs', fill_value=-999)
165  self._output_dataset_bt_output_dataset_bt['/MetaData/longitude'][:] = longitude_data_array
166 
168  """
169  Creates the /MetaData/scan_angle variable in the reflectance factor and brightness temperature netCDF4 Datasets.
170  """
171  scan_angle_data_array = self._latlon_dataset_latlon_dataset['MetaData'].variables['scan_angle'][:].real
172  self._output_dataset_rf_output_dataset_rf.createVariable('/MetaData/scan_angle', 'f4', 'nlocs', fill_value=-999)
173  self._output_dataset_rf_output_dataset_rf['/MetaData/scan_angle'][:] = scan_angle_data_array
174  self._output_dataset_bt_output_dataset_bt.createVariable('/MetaData/scan_angle', 'f4', 'nlocs', fill_value=-999)
175  self._output_dataset_bt_output_dataset_bt['/MetaData/scan_angle'][:] = scan_angle_data_array
176 
178  """
179  Creates the /MetaData/elevation_angle variable in the reflectance factor and brightness temperature netCDF4
180  Datasets.
181  """
182  elevation_angle_data_array = self._latlon_dataset_latlon_dataset['MetaData'].variables['elevation_angle'][:].real
183  self._output_dataset_rf_output_dataset_rf.createVariable('/MetaData/elevation_angle', 'f4', 'nlocs', fill_value=-999)
184  self._output_dataset_rf_output_dataset_rf['/MetaData/elevation_angle'][:] = elevation_angle_data_array
185  self._output_dataset_bt_output_dataset_bt.createVariable('/MetaData/elevation_angle', 'f4', 'nlocs', fill_value=-999)
186  self._output_dataset_bt_output_dataset_bt['/MetaData/elevation_angle'][:] = elevation_angle_data_array
187 
188  def _create_groups(self):
189  """
190  Creates the required groups in the reflectance factor and brightness temperature netCDF4 Datasets.
191  """
192  self._output_dataset_rf_output_dataset_rf.createGroup('MetaData')
193  self._output_dataset_rf_output_dataset_rf.createGroup('ObsError')
194  self._output_dataset_rf_output_dataset_rf.createGroup('ObsValue')
195  self._output_dataset_rf_output_dataset_rf.createGroup('PreQC')
196  self._output_dataset_rf_output_dataset_rf.createGroup('VarMetaData')
197  self._output_dataset_bt_output_dataset_bt.createGroup('MetaData')
198  self._output_dataset_bt_output_dataset_bt.createGroup('ObsError')
199  self._output_dataset_bt_output_dataset_bt.createGroup('ObsValue')
200  self._output_dataset_bt_output_dataset_bt.createGroup('PreQC')
201  self._output_dataset_bt_output_dataset_bt.createGroup('VarMetaData')
202 
204  """
205  Creates the nlocs dimension in the reflectance factor and brightness temperature netCDF4 Datasets.
206  """
207  nlocs = self._latlon_dataset_latlon_dataset.dimensions['nlocs'].size
208  self._output_dataset_rf_output_dataset_rf.createDimension('nlocs', nlocs)
209  self._output_dataset_rf_output_dataset_rf.createVariable('nlocs', 'i4', 'nlocs')
210  self._output_dataset_rf_output_dataset_rf.variables['nlocs'].setncattr('suggested_chunk_dim', nlocs)
211  self._output_dataset_rf_output_dataset_rf.variables['nlocs'][:] = np.arange(1, nlocs + 1, 1, dtype='int32')
212  self._output_dataset_bt_output_dataset_bt.createDimension('nlocs', nlocs)
213  self._output_dataset_bt_output_dataset_bt.createVariable('nlocs', 'i4', 'nlocs')
214  self._output_dataset_bt_output_dataset_bt.variables['nlocs'].setncattr('suggested_chunk_dim', nlocs)
215  self._output_dataset_bt_output_dataset_bt.variables['nlocs'][:] = np.arange(1, nlocs + 1, 1, dtype='int32')
216 
218  """
219  Creates the nchans dimension in the reflectance factor and brightness temperature netCDF4 Datasets.
220  """
221  nchans_rf = 6
222  nchans_bt = 10
223  self._output_dataset_rf_output_dataset_rf.createDimension('nchans', nchans_rf)
224  self._output_dataset_rf_output_dataset_rf.createVariable('nchans', 'i4', 'nchans')
225  self._output_dataset_rf_output_dataset_rf.variables['nchans'][:] = [1, 2, 3, 4, 5, 6]
226  self._output_dataset_bt_output_dataset_bt.createDimension('nchans', nchans_bt)
227  self._output_dataset_bt_output_dataset_bt.createVariable('nchans', 'i4', 'nchans')
228  self._output_dataset_bt_output_dataset_bt.variables['nchans'][:] = [7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
229 
231  """
232  Creates the nvars dimension in the reflectance factor and brightness temperature netCDF4 Datasets.
233  """
234  nvars_rf = 6
235  nvars_bt = 10
236  self._output_dataset_rf_output_dataset_rf.createDimension('nvars', nvars_rf)
237  self._output_dataset_rf_output_dataset_rf.createVariable('nvars', 'i4', 'nvars')
238  self._output_dataset_rf_output_dataset_rf.variables['nvars'][:] = np.arange(1, nvars_rf + 1, 1, dtype='int32')
239  self._output_dataset_bt_output_dataset_bt.createDimension('nvars', nvars_bt)
240  self._output_dataset_bt_output_dataset_bt.createVariable('nvars', 'i4', 'nvars')
241  self._output_dataset_bt_output_dataset_bt.variables['nvars'][:] = np.arange(1, nvars_bt + 1, 1, dtype='int32')
242 
244  """
245  Creates the ndatetime dimension in the reflectance factor and brightness temperature netCDF4 Datasets.
246  """
247  ndatetime = 20
248  self._output_dataset_rf_output_dataset_rf.createDimension('ndatetime', ndatetime)
249  self._output_dataset_rf_output_dataset_rf.createVariable('ndatetime', 'i4', 'ndatetime')
250  self._output_dataset_rf_output_dataset_rf.variables['ndatetime'][:] = np.arange(1, ndatetime + 1, 1, dtype='int32')
251  self._output_dataset_bt_output_dataset_bt.createDimension('ndatetime', ndatetime)
252  self._output_dataset_bt_output_dataset_bt.createVariable('ndatetime', 'i4', 'ndatetime')
253  self._output_dataset_bt_output_dataset_bt.variables['ndatetime'][:] = np.arange(1, ndatetime + 1, 1, dtype='int32')
254 
256  """
257  Creates the nstring dimension in the reflectance factor and brightness temperature netCDF4 Datasets.
258  """
259  nstring = 50
260  self._output_dataset_rf_output_dataset_rf.createDimension('nstring', nstring)
261  self._output_dataset_rf_output_dataset_rf.createVariable('nstring', 'i4', 'nstring')
262  self._output_dataset_rf_output_dataset_rf.variables['nstring'][:] = np.arange(1, nstring + 1, 1, dtype='int32')
263  self._output_dataset_bt_output_dataset_bt.createDimension('nstring', nstring)
264  self._output_dataset_bt_output_dataset_bt.createVariable('nstring', 'i4', 'nstring')
265  self._output_dataset_bt_output_dataset_bt.variables['nstring'][:] = np.arange(1, nstring + 1, 1, dtype='int32')
266 
267  @staticmethod
268  def _get_nlocs(dataset):
269  """
270  Returns the nlocs dimension size for the provided netCDF4 Dataset.
271  dataset - the dataset to extract the nlocs size
272  """
273  return dataset.dimensions['nlocs'].size
274 
276  """
277  Creates the /PreQC/reflectance_factor variable variable and associated attributes in the reflectance factor
278  netCDF4 Dataset.
279  """
280  temp_dict = {}
281  counter = 0
282  for key in self._goes_dict_rf_goes_dict_rf.keys():
283  goes = self._goes_dict_rf_goes_dict_rf[key]
284  temp_dict[counter] = ma.getdata(goes.get_preqc_data_array())
285  counter += 1
286  data_array = temp_dict[0]
287  for i in range(1, counter):
288  data_array = np.column_stack((data_array, temp_dict[i]))
289  self._output_dataset_rf_output_dataset_rf.createVariable('/PreQC/reflectance_factor', 'f4', ('nlocs', 'nchans'), fill_value=-999)
290  self._output_dataset_rf_output_dataset_rf['/PreQC/reflectance_factor'][:] = data_array
291  self._output_dataset_rf_output_dataset_rf['/PreQC/reflectance_factor'].setncattr('flag_values', '0,1,2,3')
292  self._output_dataset_rf_output_dataset_rf['/PreQC/reflectance_factor'].setncattr('flag_meanings',
293  'good_pixel_qf '
294  'conditionally_usable_pixel_qf '
295  'out_of_range_pixel_qf no_value_pixel_qf')
296 
298  """
299  Creates the /PreQC/brightness_temperature variable and associated attributes in the brightness temperature
300  netCDF4 Dataset.
301  """
302  temp_dict = {}
303  counter = 0
304  for key in self._goes_dict_bt_goes_dict_bt.keys():
305  goes = self._goes_dict_bt_goes_dict_bt[key]
306  temp_dict[counter] = ma.getdata(goes.get_preqc_data_array())
307  counter += 1
308  data_array = temp_dict[0]
309  for i in range(1, counter):
310  data_array = np.column_stack((data_array, temp_dict[i]))
311  self._output_dataset_bt_output_dataset_bt.createVariable('/PreQC/brightness_temperature', 'f4', ('nlocs', 'nchans'),
312  fill_value=-999)
313  self._output_dataset_bt_output_dataset_bt['/PreQC/brightness_temperature'][:] = data_array
314  self._output_dataset_bt_output_dataset_bt['/PreQC/brightness_temperature'].setncattr('flag_values', '0,1,2,3')
315  self._output_dataset_bt_output_dataset_bt['/PreQC/brightness_temperature'].setncattr('flag_meanings',
316  'good_pixel_qf '
317  'conditionally_usable_pixel_qf '
318  'out_of_range_pixel_qf no_value_pixel_qf')
319 
321  """
322  Creates the /ObsValue/reflectance_factor variable in the reflectance factor netCDF4 Dataset.
323  """
324  temp_dict = {}
325  counter = 0
326  for key in self._goes_dict_rf_goes_dict_rf.keys():
327  goes = self._goes_dict_rf_goes_dict_rf[key]
328  temp_dict[counter] = ma.getdata(goes.get_obsvalue_rf_data_array())
329  counter += 1
330  data_array = temp_dict[0]
331  for i in range(1, counter):
332  data_array = np.column_stack((data_array, temp_dict[i]))
333  self._output_dataset_rf_output_dataset_rf.createVariable('/ObsValue/reflectance_factor', 'f4', ('nlocs', 'nchans'),
334  fill_value=-999)
335  self._output_dataset_rf_output_dataset_rf['/ObsValue/reflectance_factor'][:] = data_array
336 
338  """
339  Creates the /ObsValue/brightness_temperature variable in the brightness temperature netCDF4 Dataset.
340  """
341  temp_dict = {}
342  counter = 0
343  for key in self._goes_dict_bt_goes_dict_bt.keys():
344  goes = self._goes_dict_bt_goes_dict_bt[key]
345  temp_dict[counter] = ma.getdata(goes.get_obsvalue_bt_data_array())
346  counter += 1
347  data_array = temp_dict[0]
348  for i in range(1, counter):
349  data_array = np.column_stack((data_array, temp_dict[i]))
350  self._output_dataset_bt_output_dataset_bt.createVariable('/ObsValue/brightness_temperature', 'f4', ('nlocs', 'nchans'),
351  fill_value=-999)
352  self._output_dataset_bt_output_dataset_bt['/ObsValue/brightness_temperature'][:] = data_array
353  self._output_dataset_bt_output_dataset_bt['/ObsValue/brightness_temperature'].setncattr('units', 'K')
354 
356  """
357  Creates the /ObsError/reflectance_factor variable in the reflectance factor netCDF4 Dataset.
358  """
359  temp_dict = {}
360  counter = 0
361  for key in self._goes_dict_rf_goes_dict_rf.keys():
362  goes = self._goes_dict_rf_goes_dict_rf[key]
363  temp_dict[counter] = ma.getdata(goes.get_obserror_rf_data_array())
364  counter += 1
365  data_array = temp_dict[0]
366  for i in range(1, counter):
367  data_array = np.column_stack((data_array, temp_dict[i]))
368  self._output_dataset_rf_output_dataset_rf.createVariable('/ObsError/reflectance_factor', 'f4', ('nlocs', 'nchans'),
369  fill_value=-999)
370  self._output_dataset_rf_output_dataset_rf['/ObsError/reflectance_factor'][:] = data_array
371 
373  """
374  Creates the /ObsError/brightness_temperature variable in the brightness temperature netCDF4 Dataset.
375  """
376  temp_dict = {}
377  counter = 0
378  for key in self._goes_dict_bt_goes_dict_bt.keys():
379  goes = self._goes_dict_bt_goes_dict_bt[key]
380  temp_dict[counter] = ma.getdata(goes.get_obserror_bt_data_array())
381  counter += 1
382  data_array = temp_dict[0]
383  for i in range(1, counter):
384  data_array = np.column_stack((data_array, temp_dict[i]))
385  self._output_dataset_bt_output_dataset_bt.createVariable('/ObsError/brightness_temperature', 'f4', ('nlocs', 'nchans'),
386  fill_value=-999)
387  self._output_dataset_bt_output_dataset_bt['/ObsError/brightness_temperature'][:] = data_array
388  self._output_dataset_bt_output_dataset_bt['/ObsError/brightness_temperature'].setncattr('units', 'K')
389 
391  """
392  Creates the /MetaData/datetime and MetaData/time variables and /date_time attribute in the reflectance factor
393  and brightness temperature netCDF4 Datasets.
394  """
395  dataset = Goes(self._template_input_file_path_template_input_file_path)
396  dataset.load()
397  start_date = str(JediDate(dataset.get_start_date()))
398  datetime_array = np.full(self._get_nlocs_get_nlocs(self._output_dataset_rf_output_dataset_rf), start_date)
399  time_array = np.full(self._get_nlocs_get_nlocs(self._output_dataset_rf_output_dataset_rf), 0.0)
400  self._output_dataset_rf_output_dataset_rf.createVariable('/MetaData/datetime', 'str', 'nlocs')
401  self._output_dataset_rf_output_dataset_rf['/MetaData/datetime'][:] = datetime_array
402  self._output_dataset_bt_output_dataset_bt.createVariable('/MetaData/datetime', 'str', 'nlocs')
403  self._output_dataset_bt_output_dataset_bt['/MetaData/datetime'][:] = datetime_array
404  self._output_dataset_rf_output_dataset_rf.createVariable('/MetaData/time', 'f4', 'nlocs')
405  self._output_dataset_rf_output_dataset_rf['/MetaData/time'][:] = time_array
406  self._output_dataset_bt_output_dataset_bt.createVariable('/MetaData/time', 'f4', 'nlocs')
407  self._output_dataset_bt_output_dataset_bt['/MetaData/time'][:] = time_array
408  self._output_dataset_rf_output_dataset_rf.setncattr("date_time", start_date)
409  self._output_dataset_bt_output_dataset_bt.setncattr("date_time", start_date)
410 
412  """
413  Creates the /VarMetaData/sensor_channel variable in the reflectance factor and brightness temperature netCDF4
414  Datasets.
415  """
416  self._output_dataset_rf_output_dataset_rf.createVariable('/VarMetaData/sensor_channel', 'i4', 'nchans')
417  self._output_dataset_rf_output_dataset_rf['/VarMetaData/sensor_channel'][:] = self._output_dataset_rf_output_dataset_rf['nchans'][:]
418  self._output_dataset_bt_output_dataset_bt.createVariable('/VarMetaData/sensor_channel', 'i4', 'nchans')
419  self._output_dataset_bt_output_dataset_bt['/VarMetaData/sensor_channel'][:] = self._output_dataset_bt_output_dataset_bt['nchans'][:]
420 
422  """
423  Creates the /VarMetaData/variable_names variable in the reflectance factor and brightness temperature netCDF4
424  Datasets.
425  """
426  self._output_dataset_rf_output_dataset_rf.createVariable('/VarMetaData/variable_names', 'str', 'nchans')
427  temp_data_array = ['reflectance_factor_1', 'reflectance_factor_2', 'reflectance_factor_3',
428  'reflectance_factor_4', 'reflectance_factor_5', 'reflectance_factor_6']
429  self._output_dataset_rf_output_dataset_rf['/VarMetaData/variable_names'][:] = np.array(temp_data_array)
430  self._output_dataset_bt_output_dataset_bt.createVariable('/VarMetaData/variable_names', 'str', 'nchans')
431  temp_data_array = ['brightness_temperature_7', 'brightness_temperature_8', 'brightness_temperature_9',
432  'brightness_temperature_10', 'brightness_temperature_11', 'brightness_temperature_12',
433  'brightness_temperature_13', 'brightness_temperature_14', 'brightness_temperature_15',
434  'brightness_temperature_16']
435  self._output_dataset_bt_output_dataset_bt['/VarMetaData/variable_names'][:] = np.array(temp_data_array)
436 
438  """
439  Creates several root group attributes in the reflectance factor and brightness temperature netCDF4 Datasets.
440  """
441  self._output_dataset_rf_output_dataset_rf.setncattr('_ioda_layout', 'ObsGroup')
442  self._output_dataset_bt_output_dataset_bt.setncattr('_ioda_layout', 'ObsGroup')
443  self._output_dataset_rf_output_dataset_rf.setncattr('_ioda_layout_version', '0')
444  self._output_dataset_bt_output_dataset_bt.setncattr('_ioda_layout_version', '0')
445 
446  def convert(self):
447  """
448  Creates the reflectance factor and brightness temperature IODAv2 data files. This functions also checks for
449  the existence and nadir change of the Goes LatLon data file.
450  """
451  self._create_input_data_file_dicts_create_input_data_file_dicts()
452  if self._check_latlon_file_path_check_latlon_file_path():
453  if not self._check_nadir_check_nadir():
454  self._create_latlon_dataset_create_latlon_dataset()
455  else:
456  self._create_latlon_dataset_create_latlon_dataset()
457  self._output_dataset_rf_output_dataset_rf = Dataset(self._output_file_path_rf_output_file_path_rf, 'w')
458  self._output_dataset_bt_output_dataset_bt = Dataset(self._output_file_path_bt_output_file_path_bt, 'w')
459  self._latlon_dataset_latlon_dataset = Dataset(self._latlon_file_path_latlon_file_path, 'r')
460  self._create_groups_create_groups()
461  self._create_nlocs_dimensions_create_nlocs_dimensions()
462  self._create_nchans_dimensions_create_nchans_dimensions()
463  self._create_nvars_dimensions_create_nvars_dimensions()
464  self._create_ndatetime_dimensions_create_ndatetime_dimensions()
465  self._create_nstring_dimensions_create_nstring_dimensions()
466  self._create_metadata_latitude_variables_create_metadata_latitude_variables()
467  self._create_metadata_longitude_variables_create_metadata_longitude_variables()
468  self._create_metadata_elevation_angle_variables_create_metadata_elevation_angle_variables()
469  self._create_metadata_scan_angle_variables_create_metadata_scan_angle_variables()
470  self._create_obsvalue_reflectance_factor_variable_create_obsvalue_reflectance_factor_variable()
471  self._create_obsvalue_brightness_temperature_variable_create_obsvalue_brightness_temperature_variable()
472  self._create_obserror_reflectance_factor_variable_create_obserror_reflectance_factor_variable()
473  self._create_obserror_brightness_temperature_variable_create_obserror_brightness_temperature_variable()
474  self._create_preqc_reflectance_factor_variable_create_preqc_reflectance_factor_variable()
475  self._create_preqc_brightness_temperature_variable_create_preqc_brightness_temperature_variable()
476  self._create_metadata_time_variables_create_metadata_time_variables()
477  self._create_varmetadata_sensor_channel_variables_create_varmetadata_sensor_channel_variables()
478  self._create_varmetadata_variable_names_variables_create_varmetadata_variable_names_variables()
479  self._create_root_group_attributes_create_root_group_attributes()
480  self._close_datasets_close_datasets()
def _create_obserror_reflectance_factor_variable(self)
def __init__(self, input_file_paths, latlon_file_path, output_file_path_rf, output_file_path_bt)
def _create_preqc_reflectance_factor_variable(self)
def _create_varmetadata_variable_names_variables(self)
def _create_obsvalue_brightness_temperature_variable(self)
def _create_preqc_brightness_temperature_variable(self)
def _create_metadata_scan_angle_variables(self)
def _create_metadata_latitude_variables(self)
def _create_metadata_longitude_variables(self)
def _create_metadata_elevation_angle_variables(self)
def _create_obserror_brightness_temperature_variable(self)
def _create_obsvalue_reflectance_factor_variable(self)
def _create_varmetadata_sensor_channel_variables(self)