Selenium Analysis Class
Classes that take in dataframes and can output completed data frame for analysis
- class selenium.AnalyzeSeleniumData(selenium_data_frame, ozone_mls_hdf_file=None, ozone_omi_hdf_file=None, external_telemetry=None, qe=None, lat=None, lon=None, irradiance_spectrum=None)
Bases:
object
Takes in a dataframe of a specific format to process selenium data
- Parameters:
selenium_data_frame (pd.DataFrame) – A dataframe of selenium data
ozone_mls_hdf_file (str) – The path to the ozone mls hdf file
ozone_omi_hdf_file (str) – The path to the ozone omi hdf file
external_telemetry (pd.DataFrame) – A dataframe of external telemetry data
qe (np.ndarray) – A numpy array of quantum efficiency data where columbn 0 is wavelength and column 1 is QE
lat (float) – The latitude of the location of the selenium data if GPS data was not recorded
lon (float) – The longitude of the location of the selenium data if GPS data was not recorded
irradiance_spectrum (np.ndarray) – A numpy array of the irradiance spectrum
- filter_dataframe_for_altitude(min_altitude_m=24000, max_altitude_m=34000, altitude_column='Altitude_from_Pressure (m)')
Filter the dataframe for a specific altitude range. You can use ‘Altitude (m)’ or ‘Altitude_from_Pressure (m)’ if you don’t have gps altitude
- Parameters:
min_altitude_m (float) – minimum altitude in meters where 24000 is default because it is well above the tropopauseand from experience you have little atmospheic interference above this altitude
max_altitude_m (float) – maximum altitude of the flight or where ever the balloon popped
altitude_column (str) – ‘Altitude (m)’ or ‘Altitude_from_Pressure (m)’ if you don’t have gps altitude
- Returns:
dataframe filtered for altitude
- Return type:
dataframe (pd.DataFrame)
- filter_dataframe_for_angles(x_angle_limit=2.5, y_angle_limit=2.5)
- filter_dataframe_for_presssure(max_pressure_hPa=100)
Filter the dataframe for a specific pressure range.
- Parameters:
max_pressure_hPa (float) – maximum pressure in hPa
- Returns:
dataframe filtered for altitude
- Return type:
dataframe (pd.DataFrame)
- filtered_indices(x_angles, y_angles, x_angle_limit, y_angle_limit)
- generate_dataframe_with_ozone_corrections(dataframe, ozone, QE)
- generate_dataframe_with_ozone_corrections_basic(dataframe, ozone, lat, lon, QE)
- generate_dataframe_with_sts_data(dataframe, sts_files, ozone_file, qe)
Generates the ozone related data such as ‘O3 Correction Factor’, ‘O3 DU’, ‘Zenith’, and ‘Pressure (hPa)’ and adds it to the dataframe.
- Parameters:
dataframe (pd.DataFrame) – The dataframe to generate the ozone related data for. In the init function this is the self.dataframe or the input dataframe
ozone (auraMLSO3Profile | auraOmiO3Profile) – The ozone profile to use for the correction
qe (np.ndarray) – The quantum efficiency of the device where column 0 is wavelength in nm and column 1 is the quantum efficiency
lat (float) – The latitude of the device if no gps coordinates are available
lon (float) – The longitude of the device if no gps coordinates are available
irradiance_spectrum (np.ndarray) – The spectrum of the irradiance where column 0 is wavelength in nm and column 1 is the irradiance
- Returns:
The dataframe with ozone related data ‘O3 Correction Factor’, ‘O3 DU’, ‘Zenith’, and ‘Pressure (hPa)’ added to the dataframe
- Return type:
pd.DataFrame
- ozone_correct_data(dataframe_column_name)
Corrects the data in the dataframe for ozone. Can be used for example with Isc (A), or Imax (A) etc.
- Parameters:
dataframe_column_name (str) – The name of the column in the dataframe to correct for ozone
- Returns:
The dataframe with the ozone corrected data
- Return type:
pd.DataFrame
- plot_param(param, style='o')
- temperature_correct_jsc(param, target_temp, temp_co)
- class selenium.auraMLSO3Profile(filename)
Bases:
object
Takes in an AURA MLS ozone hdf file from GES DISC and processes it into a format that is useful for the selenium analysis.
- Parameters:
filename (str) – an AURA MLS ozone hdf file from GES DISC
- get_O3_profile(latitude, longitude)
Returns the ozone profile for a given latitude and longitude
- Parameters:
latitude (float) – latitude of interest
longitude (float) – longitude of interest
- Returns:
ozone profile for a given latitude and longitude where column 0 is ozone and column 1 is pressure (hPa)
- Return type:
np.ndarray
- get_O3_profile_max(latitude, longitude)
Returns the max ozone profile for a given latitude and longitude using precision included int the MLS file :param latitude: latitude of interest :type latitude: float :param longitude: longitude of interest :type longitude: float
- Returns:
ozone profile for a given latitude and longitude where column 0 is ozone with the max precision and column 1 is pressure (hPa)
- Return type:
np.ndarray
- Parameters:
latitude (float) –
longitude (float) –
- get_O3_profile_min(latitude, longitude)
Returns the min ozone profile for a given latitude and longitude using precision included int the MLS file
- Parameters:
latitude (float) – latitude of interest
longitude (float) – longitude of interest
- Returns:
ozone profile for a given latitude and longitude where column 0 is ozone with the min precision and column 1 is pressure (hPa)
- Return type:
np.ndarray
Selenium Functions
A library of functions used to analyze selenium data
- selenium.selenium_analysis.average_qe_spectra(qe_spectra=[])
- Parameters:
qe_spectra – list of 2d data
Returns:
- selenium.selenium_analysis.calibrationCorrection(dataSpectrum, lampSpectrum, standardLampSpectrum, units='photon flux vs nm')
Takes a given spectrum, such as an luminescence spectrum, and corrects it using a standard lamp spectrum.
- Parameters:
dataSpectrum (2-D array) – the spectrum to be corrected
lampSpectrum (2-D array) – the spectrum of a lamp taken with the spectrometer to be calibrated
standardLampSpectrum (2-D array) – the known/calibrated spectrum of the lamp used, i.e. NIST Calibration
units (2-D array) – what units you wish to convert the instrument response to: ‘irradiance vs nm’, ‘photon flux vs nm’
- Returns:
2-D array of dataSpectrum that has been corrected for a standard lamp spectrum
- selenium.selenium_analysis.combine_external_telem_with_selenium(telem_dataframe, selenium_dataframe)
- selenium.selenium_analysis.concatDirectoryFiles(dirName)
- selenium.selenium_analysis.convert_vmr_pressure_to_mol_m3_altitude_km(vmr_pressure, molecular_weight=47.997, temp_K=273.15)
- selenium.selenium_analysis.correct_angle_coefficients(angle, coefficents)
- selenium.selenium_analysis.correct_current_for_ozone(current, ozone_correction_factor)
- selenium.selenium_analysis.correct_current_for_sun_earth_distance(current, utc_time, delta_t=None)
Current current of solar cell for sun earth distance
- Parameters:
current – Current of the cell
utc_time – Time in UTC as a python datetime object
- Returns:
Current corrected for earth sun distance
- selenium.selenium_analysis.correct_datetime_index_if_gps_data_was_intermittent(dataframe)
- selenium.selenium_analysis.correct_for_temperature(parameter, temp_of_measurment, target_temp, temperature_coeffecient)
Corrects a solar cell parameter such as current or voltage to the what the value should be at a target temperature
- Parameters:
parameter – Solar cell parameter to be corrected such as current or voltage
temp_of_measurement – Temperature at which the measurement was taken
target_temp – The target temperature at which to correct the measured parameter
temperature_coeffecient – The linear temperature coefficient of the parameter
- Returns:
Parameter corrected to what its value would be at the target temperature
- selenium.selenium_analysis.current_angle_correction(current, pan_angle=None, tilt_angle=None)
Corrects current for off pointing by taking the dot product of the pan and tilt angle deviation
- Parameters:
current – Current to be corrected such as short circuit current
pan_angle – The pan angle from direct incidence angle
tilt_angle – The tilt angle from direct incidence angle
- Returns:
Current corrected to what it would be if the intensity was at an angle of incidence of 0 degrees
- selenium.selenium_analysis.filterCorrection(dataSpectrum, transmissionSpectraofFilter)
Corrects a spectrum by a given transmission spectrum. Interpolates the transmission spectrum to the same units as the dataSpectrum then the dataSpectrum is passed through the transmission spectrum given a spectrum corrected for a transmission spectrum of a filter
- Parameters:
dataSpectrum (2-D array) – The spectrum to be corrected by the filter
transmissionSpectraofFilter (2-D array) – Transmission spectra of a filter
- Returns:
2-D array of a dataSpectrum corrected for the transmission spectrum of filter
- selenium.selenium_analysis.filter_for_angle(parameter, pan_angles, tilt_angles, pan_angle_limit, tilt_angle_limit)
Filter data for angles that fall within a specified range. Parameter, x-angles, and y-angles need to be the same size and shape
- Parameters:
parameter – float or 1d array of parameter interest
pan_angles – float or 1d array of angles to filter by
tilt_angles – float or 1d array of angles to filter by
pan_angle_limit – x-angle to limit filter
tilt_angle_limit – y-angle to limit filter
- Returns:
Filtered data
- selenium.selenium_analysis.findIndicesofDuplicates(list=[])
- selenium.selenium_analysis.gas_attenuated_irradiance(DU, absorption_coeff, zenith_angle=0, irradiance_spectrum=None)
- selenium.selenium_analysis.generate_gas_transmission_spectrum(DU, abs_coeff, zenith_angle=0)
- selenium.selenium_analysis.generate_ozone_transmission_spectrum(ozone_DU, zenith_angle=0)
- selenium.selenium_analysis.get_coeffecients(measured_angle, real_angle)
- selenium.selenium_analysis.get_jsc_from_quantum_efficiency(quantum_efficiency, irradiance_spectrum, interpolation_method='QE')
Calculates the short circuit current from an give quantum efficiency curve and irradiance spectrum
- Parameters:
quantum_efficiency (ndarray) – 2D array of Quantum Efficiency data of shape x = wavelength, y = quantum efficiency (%)
irradiance_spectrum (ndarray) – 2D array that has x = nm, y = W/cm^2/nm
interpolation_method (ndarray) – ‘QE’ interpolates the irradiance spectrum to the QE spacing whereas ‘Irr’ interpolates the quantum efficiency spectrum to the irradiance spectrum
- Returns:
Integrated current in mA/cm^2
- selenium.selenium_analysis.get_jsc_from_spectral_response(spectral_response, irradiance_spectrum, interpolation_method='SR')
Calculates the short circuit current density using give spectral response spectrum and irradiance spectrum
- Parameters:
spectral_response (ndarray) – spectral response data is x = nm and y = A/cm^2
(ndarray (irradiance_spectrum) – 2D array that has x = nm, y = W/cm^2/nm
interpolation_method (ndarray) – ‘SR’ interpolates the irradiance spectrum to the spectral response spacing whereas ‘Irr’ interpolates the spectral response spectrum to the irradiance spectrum
- Returns:
a single value that is in the units of mA/cm^2
- selenium.selenium_analysis.get_ozone_correction_factor(ozone_attenuated_am0, ref_spectrum=None, qe=None, interpolation_method='QE')
- selenium.selenium_analysis.get_temperature_coefficient(parameter, temperatures)
- selenium.selenium_analysis.get_temperature_coefficient_Huber(parameter, temperatures)
Fits a HuberRegressor to the data and returns the slope, intercept, score, and r_value. The slope is the temperature coefficient
- Parameters:
parameter (np.ndarray) – any solar parameter (e.g. Jsc, Voc, FF, PCE)
temperatures (np.ndarray) – temperature data
- Returns:
dictionary containing the slope, intercept, score, and r_value of the fit where the slope is the temperature coefficient
- Return type:
fits (dict)
- selenium.selenium_analysis.high_freq_data_df(selenium_flight_data_folder_path, start_time=None)
- selenium.selenium_analysis.interpolate_larger_data_to_smaller_data(large_data, small_data)
- selenium.selenium_analysis.mg_m3_to_ppmV(mg_m3, molecular_weight=47.997, temp_K=273.15)
- selenium.selenium_analysis.ozone_attenuated_irradiance(ozone_DU=0, zenith_angle=0, irradiance_spectrum=None)
- selenium.selenium_analysis.pitch_from_sun_sensor(TL, BL, BR, TR, r, h)
- selenium.selenium_analysis.ppmV_to_mol_m3(ppmV, molecular_weight=47.997, temp_K=273.15)
- selenium.selenium_analysis.sortTwoArrays(sortByThisArray, arrayToBeSorted)
- selenium.selenium_analysis.standardize_selenium_dataframe(dataframe)
Finds column names that may be labeled funny or similar from past naming conventions and standardizes them to a common naming convention
- Parameters:
dataframe (pd.DataFrame) – Pandas dataframe containing selenium data
- Returns:
Pandas dataframe containing selenium data with standardized column names
- Return type:
dataframe (pd.DataFrame)
- selenium.selenium_analysis.total_ozone_above_pressure(ozone_profile_ppmV, pressure_limit_hPa)
- selenium.selenium_analysis.total_ozone_dobson_from_ppmV_vs_pressure(vmr_pressure)
Use conversions.pdf to convert vmr data to Dobson Units
- Parameters:
vmr_pressure – data from satellite in units vmr vs pressure
- Returns:
total gas in Dobson units
- selenium.selenium_analysis.total_ozone_from_mol_m3_vs_altitude_km(mol_m3_altitude_km)
- selenium.selenium_analysis.yaw_from_sun_sensor(TL, BL, BR, TR, r, h)