import icebear import icebear.utils as util import os # Set plotting step size plotting_step = [0, 0, 0, 1, 0] plotting_spacing = 5 # Gather all the level1 data file paths filepath = '/beaver/backup/level1/' files = util.get_all_data_files(filepath, '2017_12_06', '2020_11_16') # Create plots for file in files: config = util.Config(file) config.add_attr('number_ranges', 2000) config.add_attr('range_resolution', 1.5) config.add_attr('timestamp_correction', 30) # timestamp_corr config.add_attr('clutter_gates', 100) config.add_attr('code_length', 20000) config.plotting_source = '/'.join(file.split('/')[0:-1])+'/' config.plotting_destination = config.plotting_source + f'plots/{plotting_spacing}sec/' os.makedirs(config.plotting_source + f'plots/{plotting_spacing}sec', exist_ok=True) plotting_start, plotting_stop = util.get_data_file_times(file) print(config.plotting_destination, plotting_start, plotting_stop) time = util.Time(plotting_start, plotting_stop, plotting_step) icebear.plotting.plot.range_doppler_snr(config, time, plotting_spacing)
import h5py import numpy as np import matplotlib.pyplot as plt import icebear.utils as utils import icebear filepath = 'E:/icebear/level2b/' # Enter file path to level 1 directory files = utils.get_all_data_files( filepath, '2020_12_12', '2020_12_15') # Enter first sub directory and last #files = ['E:/icebear/level2/2019_12_19/ib3d_normal_swht_01deg_2019_12_19_05_prelate_bakker.h5'] # Alternate; make a list of files with file paths. #files = ['E:/icebear/level2a/2019_12_19/ib3d_normal_swht_10deg_2019_12_19_05_prelate_bakker_old.h5'] # Alternate; make a list of files with file paths. #files = ['E:/icebear/level2a/2019_12_19/ib3d_normal_swht_10deg_2019_12_19_05_prelate_bakker_new.h5'] # Alternate; make a list of files with file paths. el = np.array([]) rng = np.array([]) dop = np.array([]) snr = np.array([]) az = np.array([]) for file in files: f = h5py.File(file, 'r') print(file) group = f['data'] keys = group.keys() for key in keys: data = group[f'{key}'] rf_distance = data['rf_distance'][()] snr_db = data['snr_db'][()] doppler_shift = data['doppler_shift'][()] azimuth = data['azimuth'][()] elevation = data['elevation'][()]
f.create_dataset('dev/raw_elevation', data=raw_elevation) f.create_dataset('dev/azimuth_extent', data=azimuth_extent) f.create_dataset('dev/elevation_extent', data=elevation_extent) f.create_dataset('dev/area', data=area) # f.create_dataset('dev/doppler_spectra', data=doppler_spectra) f.close() return None if __name__ == '__main__': # Load the level 2 data file. filepath = '/beaver/backup/level2_download/' # Enter file path to level 2 directory date_dir = '2021_03_31' files = utils.get_all_data_files( filepath, date_dir, date_dir) # Enter first sub directory and last print(f'files: {files}') rf_distance = np.array([]) snr_db = np.array([]) doppler_shift = np.array([]) azimuth = np.array([]) elevation = np.array([]) elevation_extent = np.array([]) azimuth_extent = np.array([]) area = np.array([]) t = np.array([]) for file in files: f = h5py.File(file, 'r') config = utils.Config(file) print(file)