# -*- coding: utf-8 -*- """ Created on Thu Jan 28 14:52:44 2021 @author: ppantina """ ##TEMP TEMP TEMP ##This is only created since the original L1B code is failing to generate plots at the last step using screen### ###Jun 1 2023## ##Import the required libraries import glob import sys import os import h5py import numpy as np from matplotlib import pyplot as plt import L1B_sub_plotter import sub_cmap #for colorbar import sub_params #for parameters import sub_flightLines #for flightLines ##Change these variables as needed radName = input('Which radar? CRS, EXRAD, HIWRAP_KU, HIWRAP_KA: ') flightDate = input('Which date? yyyymmdd (append flight number if needed) ') versionLetter = input('Which version?: A, B, C, ... ') ##Next, read the parameter file to fine radar-relevant variables. fileNameParams = 'radar_params_irma.xlsx' config = sub_params.sub_params(fileNameParams, flightDate, radName) ##Define the colorbar cmap_n0q = sub_cmap.make_cmap('n0q', bit = True) ######Define paths and filenames###### ##First locate L1A paths/files L1A_dir = config['Directory_L1A'] if radName== 'EXRAD_SCAN': L1A_file = np.sort(glob.glob(L1A_dir + '*' + radName + '*' + flightDate + '*.h5')) L1A = h5py.File(L1A_file[0], 'r') else: L1A_file = glob.glob(L1A_dir + '*' + radName + '*' + flightDate + '*.h5')[0] print(L1A_file) L1A = h5py.File(L1A_file, 'r') ##Next locate L1B paths/files. Create the output dir if necessary. L1B_dir = config['Directory_L1B'] L1B_file = config['experimentName'] + '_' + radName + '_L1B_Rev'+ versionLetter + '_' + flightDate + '.h5' L1B_filepath = L1B_dir + L1B_file L1B_plotpath = L1B_dir + 'plots/' + radName + '/' + flightDate + '/' if not(os.path.isdir(os.path.dirname(L1B_filepath))): os.makedirs(os.path.dirname(L1B_filepath)) ##make the output dir if needed. if not(os.path.isdir(os.path.dirname(L1B_plotpath))): os.makedirs(os.path.dirname(L1B_plotpath)) ##make the output dir if needed. L1B = h5py.File(L1B_dir + L1B_file, 'r') flightLines = sub_flightLines.sub_flightLines (flightDate) L1B_sub_plotter.L1B_sub_plotter (radName, L1B, flightLines, '', L1B_plotpath, cmap_n0q, flightDate, versionLetter)