19 from netCDF4
import Dataset
21 from solo.date
import Date
29 input_file_path - a GOES-16 or GOES-17 raw data file for a single ABI channel
42 Creates a dictionary of file metadata from input_file_path
45 'processing_level':
'L1b',
46 'product_acronym':
'Rad'}
47 metadata_array = os.path.splitext(os.path.basename(self.
_input_file_path_input_file_path))[0].split(
'_')
48 self.
_metadata_dict_metadata_dict[
'system_environment'] = metadata_array[0]
49 self.
_metadata_dict_metadata_dict[
'abi_sector_type'] = Goes._string_to_abisectortype(metadata_array[1])
50 self.
_metadata_dict_metadata_dict[
'abi_mode'] = Goes._string_to_abimode(metadata_array[1])
52 self.
_metadata_dict_metadata_dict[
'platform_identifier'] = metadata_array[2]
53 self.
_metadata_dict_metadata_dict[
'start_date'] = Date(metadata_array[3][1:-1])
54 self.
_metadata_dict_metadata_dict[
'end_date'] = Date(metadata_array[4][1:-1])
55 self.
_metadata_dict_metadata_dict[
'creation_date'] = Date(metadata_array[5][1:-1])
59 Opens a netCDF4 dataset using input_file_path.
65 Creates a local yaw_flip_flag variable.
71 Creates a local kappa0 variable.
77 Creates a local variables for the four Planck constants.
86 Creates a local variable for the standard deviation of radiance for only valid pixels.
89 self.
_input_dataset_input_dataset.variables[
'std_dev_radiance_value_of_valid_pixels'][0]
93 Creates a local variable of valid pixel counts.
99 Creates a local data array for the DQF variable.
105 Creates a local data array for the Rad variable.
112 Returns the dqf and rad data arrays after being subsampled with the given increment (aka step)
113 between data points using array slicing.
115 current_dim = len(rad_data_array)
116 rad_data_array = np.asarray(rad_data_array)
117 new_rad_data_array = rad_data_array[0:current_dim:increment, 0:current_dim:increment]
118 dqf_data_array = np.asarray(dqf_data_array)
119 new_dqf_data_array = dqf_data_array[0:current_dim:increment, 0:current_dim:increment]
120 return new_rad_data_array, new_dqf_data_array
125 Returns the dqf and rad data arrays after being subsampled with the given increment (aka step)
126 between data points using array looping.
128 current_dim = len(rad_data_array)
129 new_dim =
int(current_dim / increment)
130 new_rad_data_array = [[0] * new_dim] * new_dim
131 new_dqf_data_array = [[0] * new_dim] * new_dim
134 for i
in range(0, current_dim, increment):
135 for j
in range(0, current_dim, increment):
136 new_rad_data_array[k][n] = rad_data_array[i][j]
137 new_dqf_data_array[k][n] = dqf_data_array[i][j]
143 return new_rad_data_array, new_dqf_data_array
148 Returns the dqf and rad data arrays after being down-sampled from 1km to 2km resolution taking account for
149 pixel averaging and the DQF valid pixel flags. This routine is computationally expensive.
151 current_dim = len(rad_data_array)
153 new_dim =
int(current_dim / increment)
154 new_rad_data_array = [[0] * new_dim] * new_dim
155 new_dqf_data_array = [[0] * new_dim] * new_dim
158 for i
in range(0, current_dim, increment):
159 for j
in range(0, current_dim, increment):
160 point_array = [(i, j), (i + 1, j),
161 (i, j + 1), (i + 1, j + 1)]
163 for point
in point_array:
164 dqf = dqf_data_array[point[0]][point[1]]
165 if dqf == 0
or dqf == 1:
166 mean_array.append(rad_data_array[point[0]][point[1]])
167 if len(mean_array) != 0:
168 new_rad_data_array[k][n] = np.mean(mean_array)
169 new_dqf_data_array[k][n] = 0
171 new_rad_data_array[k][n] = -999
172 new_dqf_data_array[k][n] = -1
178 return new_rad_data_array, new_dqf_data_array
183 Returns the dqf and rad data arrays after being down-sampled from 0.5km to 2km resolution taking account for
184 pixel averaging and the DQF valid pixel flags. This routine is computationally expensive.
186 current_dim = len(rad_data_array)
188 new_dim =
int(current_dim / increment)
189 new_rad_data_array = [[0] * new_dim] * new_dim
190 new_dqf_data_array = [[0] * new_dim] * new_dim
193 for i
in range(0, current_dim, increment):
194 for j
in range(0, current_dim, increment):
195 point_array = [(i, j), (i + 1, j), (i + 2, j), (i + 3, j),
196 (i, j + 1), (i + 1, j + 1), (i + 2, j + 1), (i + 3, j + 1),
197 (i, j + 2), (i + 1, j + 2), (i + 2, j + 2), (i + 3, j + 2),
198 (i, j + 3), (i + 1, j + 3), (i + 2, j + 3), (i + 3, j + 3)]
200 for point
in point_array:
201 dqf = dqf_data_array[point[0]][point[1]]
202 if dqf == 0
or dqf == 1:
203 mean_array.append(rad_data_array[point[0]][point[1]])
204 if len(mean_array) != 0:
205 new_rad_data_array[k][n] = np.mean(mean_array)
206 new_dqf_data_array[k][n] = 0
208 new_rad_data_array[k][n] = -999
209 new_dqf_data_array[k][n] = -1
215 return new_rad_data_array, new_dqf_data_array
220 Selects the ABI Mode Enum constant from string.
221 string - the string used for the match
224 return ABIMode.ABI_SCAN_MODE_4
226 return ABIMode.ABI_SCAN_MODE_6
231 Selects the ABI Sector Type constant from string.
232 string - the string used for the match
235 return ABISectorType.FULL_DISK
237 return ABISectorType.CONUS
239 return ABISectorType.MESOSCALE_REGION_1
241 return ABISectorType.MESOSCALE_REGION_2
245 Returns data_array after filtering by the yaw_flip_flag.
246 data_array - the data array to filter
249 return data_array[::-1]
255 Creates a local data array variable containing the calculated obsvalue reflectance factor data
256 after fill value filtering by the DQF flags.
263 Creates a local data array variable containing the calculated obsvalue brightness temperature data
264 after fill value filtering by the DQF flags.
272 Creates a local data array variable containing the calculated obserror reflectance factor data
273 after fill value filtering by the DQF flags.
276 temp_data_array = np.sqrt(sqrt_comp) / np.sqrt(self.
_valid_pixel_count_valid_pixel_count)
281 Creates a local data array variable containing the calculated obserror brightness temperature data
282 after fill value filtering by the DQF flags.
284 sqrt_comp_1 = (-1.0 * self.
_planck_fk2_planck_fk2) / \
288 temp_data_array = np.sqrt(sqrt_comp) / np.sqrt(self.
_valid_pixel_count_valid_pixel_count)
293 Returns the ABI channel.
299 Returns the platform identifier.
305 Returns the scan's start date.
311 Returns the input_file_path.
317 Returns the obsvalue reflectance factor data array.
323 Returns the obsvalue brightness temperature data array.
329 Returns the obserror reflectance factor data array.
335 Returns the obserror brightness temperature data array.
341 Returns the preqc data array.
347 Closes this netCDF4 Dataset.
353 Loads, calculates, subsamples, reshapes, and filters all data arrays required by the GoesConverter class.
410 MESOSCALE_REGION_1 = 3
411 MESOSCALE_REGION_2 = 4
def _load_std_dev_radiance_value_of_valid_pixels_variable(self)
def _create_obserror_bt_data_array(self)
def get_platform_identifier(self)
def _load_rad_data_array(self)
def _load_yaw_flip_flag_variable(self)
def get_input_file_path(self)
def _load_kappa0_variable(self)
def _get_metadata_from_input_file_path(self)
def _string_to_abimode(string)
_std_dev_radiance_value_of_valid_pixels
def _downscale_05km_to_2km(rad_data_array, dqf_data_array)
def _subsample2(rad_data_array, dqf_data_array, increment)
def get_abi_channel(self)
def get_obserror_bt_data_array(self)
def _downscale_1km_to_2km(rad_data_array, dqf_data_array)
def _filter_data_array_by_yaw_flip_flag(self, data_array)
def _create_obserror_rf_data_array(self)
def _string_to_abisectortype(string)
def _load_valid_pixel_count_variable(self)
def _load_dqf_data_array(self)
def _load_planck_variables(self)
def _subsample(rad_data_array, dqf_data_array, increment)
def get_obsvalue_rf_data_array(self)
def _create_obsvalue_rf_data_array(self)
def get_obsvalue_bt_data_array(self)
def _create_obsvalue_bt_data_array(self)
def get_preqc_data_array(self)
def __init__(self, input_file_path)
def get_obserror_rf_data_array(self)