API Reference
SyntheticData
- class amisrsynthdata.syntheticdata.SyntheticData(config)[source]
Bases:
objectClass for creating synthetic amisr data based on config options.
- Parameters:
config (
yaml) – Configuration parameters
- create_hdf5_output(outfilename)[source]
Generate output parameter arrays and save them to an hdf5 file.
- Parameters:
outfilename (str) – Name of output file
- create_summary_plots(plot_time=None, plot_beam=None, output_prefix='synthdata_summary_', alt_slices=[100000.0, 200000.0, 300000.0, 400000.0, 500000.0], slice_xrng=[-500000.0, 500000.0, 10000.0], slice_yrng=[-200000.0, 800000.0, 10000.0], dens_colors={'cmap': 'viridis', 'vmax': 400000000000.0, 'vmin': 0.0}, itemp_colors={'cmap': 'magma', 'vmax': 3000.0, 'vmin': 0.0}, etemp_colors={'cmap': 'inferno', 'vmax': 5000.0, 'vmin': 0.0}, vlos_colors={'cmap': 'coolwarm', 'vmax': 500.0, 'vmin': -500.0})[source]
Create basic summary plots of the synthetic dataset. These are thumbnail plots intended to confirm you set up your dataset correctly rather than for any kind of analysis. They include altitude slices of the ionosphere at different altitudes, a RTI plot of a particular beam, and a 3D plot of the full radar FoV. A seperate png will be created for each of the four ISR parameters.
- Parameters:
plot_time (
datetime.datetime) – Time to plot in the aliude slice and 3D FoV plotsplot_beam (float) – Beamcode of beam to plot for the RTI
output_prefix (str) – Start of the name of the saved output plots, including path
alt_slices (list of floats) – Altitudes at which to create the slice plots
slice_xrng (list of floats) – Definition of the horizontal grid in the x-drection (start, stop, step)
slice_yrng (list of floats) – Definition of the horizontal grid in the y-drection (start, stop, step)
dens_colors (dict) – Dictionary listing plotting parameters for electron density, specifically
vmin,vmax, andcmapitemp_colors (dict) – Dictionary listing plotting parameters for ion temperature, specifically
vmin,vmax, andcmapetemp_colors (dict) – Dictionary listing plotting parameters for electron temperature, specifically
vmin,vmax, andcmapvlos_colors (dict) – Dictionary listing plotting parameters for line-of-sight velocity, specifically
vmin,vmax, andcmap
- generate_beamcodes()[source]
Generate beamcode array. This is a Nbeam x 4 array where the four columns are beamcode, azimuth, elevation, and ksys.
- Returns:
beamcodes – Radar beamcode array
- Return type:
np.ndarray
- generate_errors(rel_err, err_ref_rng)[source]
Generate error values associated with each radar measurment. This is a simple approximation where errors are proportional to the distance to the radar squared.
err = C*r^2
Here, C is rel_err and r is the radar slant range divided by err_ref_rng, such that the ouput will have the specified relative error at the specified reference range.
- Parameters:
rel_err (float) – Relative error
err_ref_rng (float) – Error reference range, or the range at which the output error equals the specified rel_err
- Returns:
ne_err (np.ndarray) – Electron density error at the fitted range gates
ti_err (np.ndarray) – Ion temperatrue error at the fitted range gates
te_err (np.ndarray) – Electron temperatrue error at the fitted range gates
vlos_err (np.ndarray) – LoS velocity error at the fitted range gates
ne_notr_err (np.ndarray) – Electron density error at the ACF range gates
- generate_fitted_params()[source]
Generate FittedParams, FitInfo, and NeFromPower output dictionaries. These are the main outputs that contain actual measurements and information about the measurements.
- Returns:
FittedParams (dict) – Main fitted meausrement output
FitInfo (dict) – Information about the quality of fit
NeFromPower (dict) – Measruements from the ACF range gates (electron density only)
- generate_geomag()[source]
Generate dictionary with fitted range gate coordinates and information.
- Returns:
Geomag – Coordinates of fitted range gates
- Return type:
dict
- generate_radar_measurements()[source]
Generate the basic radar measurmeents at each point in the field-of-view. These include: * Elecron density (Ne) * Ion temperature (Ti) * Electron temperature (Te) * Line-of-Site plasma velocity (Vlos)
- Returns:
ne (np.ndarray) – Electron density at the fitted range gates
ti (np.ndarray) – Ion temperature at the fitted range gates
te (np.ndarray) – Electron temperature at the fitted range gates
vlos (np.ndarray) – Line-of-Site velocity at the fitted range gates
ne_notr (np.ndarray) – Electron density at the ACF range gates
- generate_site()[source]
Generate Site dictionary containing information about the site coordinates.
- Returns:
Site – Coordinates for the site in various systems
- Return type:
dict
- generate_time()[source]
Generate dictionary of the various time formats included in the standard output.
- Returns:
Time – Various formats for output timestamps
- Return type:
dict
- generate_time_array(starttime, endtime)[source]
Generate time arrays.
- Parameters:
starttime (
datetime.datetime) – Start time for synthetic dataendtime (
datetime.datetime) – End time for synthetic data
- Returns:
utime (np.ndarray of floats) – Array of unix timestamps
time (np.ndarray of
datetime.datetime) – Array of datetime.datetime objects
- noisy_measurements()[source]
Return the radar measurements with gaussian random noise proportional to their error measurements.
- Returns:
ne (np.ndarray) – Noisy electron density at the fitted range gates
ti (np.ndarray) – Noisy ion temperature at the fitted range gates
te (np.ndarray) – Noisy electron temperature at the fitted range gates
vlos (np.ndarray) – Noisy line-of-Site velocity at the fitted range gates
ne_notr (np.ndarray) – Noisy electron density at the ACF range gates
Radar
- class amisrsynthdata.radar.Radar(config)[source]
Bases:
objectClass describing the radar attributes used to create synthetic data.
- Parameters:
config (
yaml) – Radar configuration parameters
- beams_from_az_el(beam_azimuth, beam_elevation)[source]
Generate beamcodes and ksys constants for beams defined by an arbitrary azimuth and elevation. Beamcodes are assigned sequentially starting at 90001 to differentiate them easily from “standard” beamcodes.
- Parameters:
beam_azimuth (np.ndarray) – Azimuth of each beam [deg]
beam_elevation (np.ndarray) – Elevation of each beam [deg]
- Returns:
beamcodes (np.ndarray) – Beamcode number for each beam
beam_ksys (np.ndarray) – Ksys of each beam
Note
The ksys values are usually determined experimentally and are not significant for any of the geometry-based calculations performed by this code. The array returned is the correct size, but filled with NaNs as placeholders.
- beams_from_beam_codes(beamcodes)[source]
Find the azimuth, elevation and ksys constant for beams given their standard beamcode.
- Parameters:
beamcodes (np.ndarray) – List of AMISR beamcodes
- Returns:
beam_azimuth (np.ndarray) – Azimuth of each beam [deg]
beam_elevation (np.ndarray) – Elevation of each beam [deg]
beam_ksys (np.ndarray) – Ksys of each beam
Note
The ksys values are usually determined experimentally and are not significant for any of the geometry-based calculations performed by this code. The array returned is the correct size, but filled with NaNs as placeholders.
- calculate_acf_gates(slant_range_config)[source]
Calculate the position of the range gates used by the autocorrelation functions pre-summing. These positions are used for the non-fitted density calculations (NeFromPower) and are at a higher resolution than the typical fitted parameters.
- Parameters:
slant_range_config (list of floats) – [start, stop, step] of the ACF slant ranges [m]
- Returns:
slant_range (np.ndarray) – Slant range positions [m]
lat (np.ndarray) – Geodetic latitude of each range gate in each beam [deg]
lon (np.ndarray) – Geodetic longitude of each range gate in each beam [deg]
alt (np.ndarray) – Geodetic altitude of each range gate in each beam [m]
- calculate_gates(alt_bins_config)[source]
Calculate the positions of the fitted parameter range gates
- Parameters:
alt_bins_config (list of floats) – [start, stop, step] of the altitude bins to be used for fitted parameter range gates
- Returns:
slant_range (np.ndarray) – Slant range positions [m]
lat (np.ndarray) – Geodetic latitude of each range gate in each beam [deg]
lon (np.ndarray) – Geodetic longitude of each range gate in each beam [deg]
alt (np.ndarray) – Geodetic altitude of each range gate in each beam [m]
Ionosphere
- class amisrsynthdata.ionosphere.Ionosphere(config)[source]
Bases:
objectClass describing the ionosphere used to create synthetic data.
- Parameters:
config (
yaml) – Ionosphere configuration parameters
- density(utime, glat, glon, galt)[source]
Calculate density at the requested times and locations
- Parameters:
utime (float or np.ndarray) – Unix Time
glat (float or np.ndarray) – Geodetic Latitude
glon (float or np.ndarray) – Geodetic Longitude
galt (float or np.ndarray) – Geodetic Altitude
- Returns:
Density values at each of the input times and locations
- Return type:
float or np.ndarray
- etemp(utime, glat, glon, galt)[source]
Calculate electron temperature at the requested times and locations
- Parameters:
utime (float or np.ndarray) – Unix Time
glat (float or np.ndarray) – Geodetic Latitude
glon (float or np.ndarray) – Geodetic Longitude
galt (float or np.ndarray) – Geodetic Altitude
- Returns:
Electron temperature values at each of the input times and locations
- Return type:
float or np.ndarray
- itemp(utime, glat, glon, galt)[source]
Calculate ion temperature at the requested times and locations
- Parameters:
utime (float or np.ndarray) – Unix Time
glat (float or np.ndarray) – Geodetic Latitude
glon (float or np.ndarray) – Geodetic Longitude
galt (float or np.ndarray) – Geodetic Altitude
- Returns:
Ion temperature values at each of the input times and locations
- Return type:
float or np.ndarray
- velocity(utime, glat, glon, galt)[source]
Calculate velocity at the requested times and locations
- Parameters:
utime (float or np.ndarray) – Unix Time
glat (float or np.ndarray) – Geodetic Latitude
glon (float or np.ndarray) – Geodetic Longitude
galt (float or np.ndarray) – Geodetic Altitude
- Returns:
Velocity components at each of the input times and locations
- Return type:
np.ndarray
Note
The returned velocity array will be one dimension larger than the input time and coordinate arrays to account for the three velocity components (east, north, up)
- zero_array(ut, x, vec=False)[source]
Generate an array of zeros of the correct output shape based on input time an coordinate arrays. This can then be indexed and populated with values.
- Parameters:
ut (float or np.ndarray) – time or time array
x (float or np.ndarray) – coordinate or coordinate array
vec (bool) – Flag indicating whether or not the returned array should add a dimension for vector components
- Returns:
Either float 0.0 for scalar input or an array full of zeros of the correct shape
- Return type:
float or np.ndarray