This page was created by the IDL library routine `mk_html_help2`.

Last modified: Fri Sep 26 18:17:39 2025.

# Directory Listing of Routines

# projects/maven/sta

- MVN_STA_CURRENT_SW_VERSION
  Records the current MAVEN STATIC SW version number
- MVN_STA_GEN_QL
  To generate quicklook data plots and a tplot save file, assumes "timespan" has been run
- MVN_STA_HKP_CAL
  Calibrates STATIC tplot housekeeping generated by mav_sta_misg_decom.pro
- MVN_STA_L0_CRIB
  crib file to demonstrate static functions and test software
- MVN_STA_L0_LOAD
  To generate quicklook data plots and a tplot save file
- MVN_STA_L2_CRIB
  Crib for loading MAVEN L2 STATIC data
- MVN_STA_L2_GEN_KP
  To generate tplotsave files of static KP data, if pathname or files not set, will query the user
- MVN_STA_L2_LOAD
  Loads MVN L2 data for a given file(s), or time_range
- MVN_STA_L2_TPLOT
  Creates tplot data from the STATIC common blocks
- MVN_STA_L3_LOAD
- MVN_STA_PROD_CAL
  Calibrates STATIC data products generated by mvn_sta_apid_handler.pro

# Routine Descriptions

## MVN_STA_CURRENT_SW_VERSION

[Next Routine] [List of Routines]

    NAME:
     mvn_sta_current_sw_version
    PURPOSE:
     Records the current MAVEN STATIC SW version number
    CALLING SEQUENCE:
     version = mvn_sta_current_sw_version()
    HISTORY:
     2015-01-23
     $LastChangedBy: jimm $
     $LastChangedDate: 2020-12-17 09:54:25 -0800 (Thu, 17 Dec 2020) $
     $LastChangedRevision: 29541 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/sta/mvn_sta_current_sw_version.pro $

(See projects/maven/sta/mvn_sta_current_sw_version.pro)

## MVN_STA_GEN_QL

[Previous Routine] [Next Routine] [List of Routines]

    PROCEDURE:	mvn_sta_gen_ql,pathname=pathname,files=files,mag=mag,all=all
    PURPOSE:
    	To generate quicklook data plots and a tplot save file, assumes "timespan" has been run
    INPUT:

    KEYWORDS:
    	all		0/1		if not set, housekeeping and raw variables 'mvn_STA_*' are deleted from tplot after data is loaded
    	mag		0/1		if set, mag data is loaded

    CREATED BY:	J. McFadden	  13-05-07
    VERSION:	1
    LAST MODIFICATION:  14-03-17
    MOD HISTORY:

    NOTES:

(See projects/maven/sta/mvn_sta_gen_ql.pro)

## MVN_STA_HKP_CAL

[Previous Routine] [Next Routine] [List of Routines]

    PROCEDURE:	mvn_sta_hkp_cal
    PURPOSE:
    	Calibrates STATIC tplot housekeeping generated by mav_sta_misg_decom.pro
    INPUT:
    	time:		dbl		time of data to be returned

    KEYWORDS:

    CREATED BY:	J. McFadden
    VERSION:	1
    LAST MODIFICATION:  2013/05/07
    MOD HISTORY:

    NOTES:

(See projects/maven/sta/mvn_sta_hkp_cal.pro)

## MVN_STA_L0_CRIB

[Previous Routine] [Next Routine] [List of Routines]

    PROCEDURE:	mvn_sta_l0_crib
    PURPOSE:
    	crib file to demonstrate static functions and test software

    INPUT:

    KEYWORDS:

    CREATED BY:	J. McFadden
    VERSION:	1
    LAST MODIFICATION:  14-05-16
    MOD HISTORY:

    NOTES:

(See projects/maven/sta/mvn_sta_l0_crib.pro)

## MVN_STA_L0_LOAD

[Previous Routine] [Next Routine] [List of Routines]

    PROCEDURE:	mvn_sta_l0_load,pathname=pathname,trange=trange,files=files,mag=mag,pfdpu=pfdpu,sep=sep,lpw=lpw,RT=RT,download_only=download_only
    PURPOSE:
    	To generate quicklook data plots and a tplot save file
    INPUT:

    KEYWORDS:
    	all		0/1		if not set, housekeeping and raw variables 'mvn_STA_*' are deleted from tplot after data is loaded

    CREATED BY:	J. McFadden	  13-05-07
    VERSION:	1
    LAST MODIFICATION:  14-03-17		copied davin file retrieve and load routine
    MOD HISTORY:

    NOTES:

(See projects/maven/sta/mvn_sta_l0_load.pro)

## MVN_STA_L2_CRIB

[Previous Routine] [Next Routine] [List of Routines]

    NAME:
    mvn_sta_l2_crib
    PURPOSE:
    	Crib for loading MAVEN L2 STATIC data

(See projects/maven/sta/mvn_sta_l2_crib.pro)

## MVN_STA_L2_GEN_KP

[Previous Routine] [Next Routine] [List of Routines]

    PROCEDURE:	mvn_sta_l2_gen_kp
    PURPOSE:
    	To generate tplotsave files of static KP data, if pathname or files not set, will query the user

    INPUT:

    KEYWORDS:
    	test		1/0		If set, will make plots while running and makepng files
    	def_min		float		minimum number of counts before KP data set to NANs

    CREATED BY:	J. McFadden	  14-10-30
    VERSION:	1
    LAST MODIFICATION:  14-10-30
    MOD HISTORY:

    NOTES:
    	Once MAVEN arrives at Mars, change def_min to 100. or an appropriate value
    	def_min no longer used

(See projects/maven/sta/mvn_sta_l2_gen_kp.pro)

## MVN_STA_L2_LOAD

[Previous Routine] [Next Routine] [List of Routines]

    NAME:
     mvn_sta_l2_load
    PURPOSE:
     Loads MVN L2 data for a given file(s), or time_range
    CALLING SEQUENCE:
     mvn_sta_l2_load, files = files, trange=trange, sta_apid=sta_apid, $
                      tplot_vars_create = tplot_vars_create
    INPUT:
     All via keyword, if none are set, then the output of timerange() is
     used, which may prompt for a time interval
    KEYWORDS:
     files = if set, then read from these files, otherwise, files are
             figured out from the time range.
     trange = read in the data from this time range, note that if both
              files and time range are set, files takes precedence in
              finding files.
     sta_apid = an apid for the data, e.g. ['c0', 'c6'], if not set all
                are included.
     user_pass = a user, password combination to be passed through to
                 file_retrieve.pro, a string with format:
                 'user:password' for sites that require Basic
                 authentication. Digest authentication is not supported.
     no_time_clip = if set do not clip the data to the time range. The
                    trange is only used for file selection.
     tplot_vars_create = if set, call mvn_sta_l2_tplot to get tplot
                         variables
     tvar_names = list of the STA tplot variable names loaded
     l2_version_in = if set, input this version, the default is to use
                     the current version, but that may not exist yet if
                     you are reprocessing
     iv_level = Loads data from intermediate (iv?) files with background
                estimates, fills the bkg tag in the data structure, and
                recalculates the eflux value, subtracting background.
     bkg_only = if set, only load background data, iv_level, (or
                iv*_load) must be set
     no_download = if set, do not download data, passed through to
                   mvn_pfp_spd_download.pro
     no_update = if set, do not check for files if a file exists
     parent_files = an array of the files input, only file basenames,
                    only files that exist
    OUTPUT:
     No variables, data are loaded into common blocks
    HISTORY:
     16-may-2014, jmm, jimm@ssl.berkeley.edu
     $LastChangedBy: jimm $
     $LastChangedDate: 2024-06-27 12:54:12 -0700 (Thu, 27 Jun 2024) $
     $LastChangedRevision: 32711 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/sta/mvn_sta_l2_load.pro $

(See projects/maven/sta/mvn_sta_l2_load.pro)

## MVN_STA_L2_TPLOT

[Previous Routine] [Next Routine] [List of Routines]

    PROCEDURE:	mvn_sta_l2_tplot,all=all,units=units,apids=apids,test=test,gf_nor=gf_nor
    PURPOSE:
    	Creates tplot data from the STATIC common blocks
    INPUT:

    KEYWORDS:
    	all	0/1		if not set, deletes all currently stored STATIC tplot structures (mvn_sta* and mvn_STA*) before generating new structures
    					generally this is only used for code diagnostics
    	units	string		select the units for generated tplot structures - not working yet
    	apids	strarr		if set, selectes subset of apids to generate tplot structures - not working yet
    	test	0/1		if set, diagnostic tplot structures (APIDs: 2A,d6,d7,d8,d9,da) are made
    					generates "rate" tplot structures for all APIDs,
    						default only generates c6 rate tplot structures
    	gf_nor	0/1		if set, keyword for testing - not working yet
    	dead_c0 flt		not used -- only for testing
    	scale	flt		not used -- only for develpment testing for crude background subtraction for 'mvn_sta_c0_H_E'
    	replace 0/1		if set, replaces eflux with values calculated as this routine is run
    					allows new dead time or background subtraction routines to be run with recalculations of eflux
    'mvn_sta_c0_H_E'

    CREATED BY:	J. McFadden	2014/03/14
    VERSION:	1
    LAST MODIFICATION:  2014/09/08
    MOD HISTORY:

(See projects/maven/sta/mvn_sta_l2_tplot.pro)

## MVN_STA_L3_LOAD

[Previous Routine] [Next Routine] [List of Routines]

    Routine to load STATIC L3 moments into IDL tplot: density, temperature, and eventually flow and winds.

    KEYWORDS:
    Set /den to load STATIC densities for the five major species: H+, m/q=2 (typically He++ in the solar wind), O+, O2+, CO2+.
    Set /temp to load STATIC O2+ temperatures.

     - Setting no keywords will by default load all moment types.

    Set /append to append the output tplot variables to IDL tplot memory. This means that if the loaded tplot variables already exist,
         they will be appended to, rather than being overwritten. By default, when this keyword is not set, any tplot variables with the same
         names that already exist are overwritten.

    success: set to a named variable to return: 0: unsuccessful - no data loaded.
                                                1: successful - data (probably) loaded.
                                                The routine is not clever enough to provide more details - 0 means it could not find any
                                                files to load, 1 means it found some (could be density or temperature) files and loaded them.

    Set /margin to extend the left hand side margin so that tplot panel titles show properly. The default settings in tplot mean that
    these don't always fit. These are changed to tplot_options, 'xmargin', [16,8].

    Set /anc to load ancillary data files that include more detailed information from the density and temperature calculations. These are
    typically used for calibration and checks by the instrument team, and should not be needed for most users. It is recommended that you
    contact the instrument team if you wish to use any parameters loaded using this keyword.

    Set /flag to load a second set of ancillary data files that contain additional flag information, that was used to create the final flag variable
         mvn_sta_l3_density_quality_flag.

    Set coltab as a float/integer to the desired color table, so that tplot variable labels can be colored correctly. If not set, the default
         value of 43 is used, via loadct2, 43. Note: in the latest version this keyword no longer works.

    Set /qualc if you are using Mike Chaffins qualcolors colortable software. This supercedes the coltab keyword. If qualc is not set,
         then the keyword coltab is used instead, which defaults to 43 if not set. Note: this routine used to run loadct2, if qualc was not set. This
         no longer happens: the user must run loadct2 before running this routine, if they want to set a specific colortable. If this routine cannot find
         an structure of array colors to use (which is obtained through either loadct2 or qualcolors), then it will use placeholder values, to avoid a crash.
         NOTE: If you use the qualcolors software, you may get a red background when loading the data if you don't use the /qualc keyword.
               To fix this, run the following:
                   @'qualcolors'
                   !p.background = qualcolors.white
                   !p.color = qualcolors.black

    If you set /leavecolors, the routine will not set any colors and will ignore the coltab and qualc keywords. Use this if you do not
         want this routine loading a new colortable. You can fix the tplot colors outside of this routine using
             options, 'tplotname', colors=[1,2,3,4,5]

    Set filesloaded to a variable that will contain the filenames of the tplot files loaded. This output will be in string format. Files are appended in the order loaded,
         so science, ancillary and flag filenames, if /anc and /flag are set.

    OUTPUTS:
    The following IDL tplot variables:
    DENSITY:
    mvn_sta_l3_density : densities in cm^-3, for H+, m/q=2 (usually He++ in the solar wind, sometimes H2+ in the ionosphere), O+, O2+, CO2+.

    mvn_sta_l3_density_abs_uncertainty - absolute statistical uncertainty in densities (cm^-3). Note, this is the statisical uncertainty
                                         associated with the number of counts observed. There can be other sources of uncertainty, for example
                                         from blockage caused by the spacecraft or gaps in STATICs field of view. These are not accounted for
                                         (and are difficult to do so in an automated fashion).

    mvn_sta_l3_density_perc_uncertainty - statistical uncertainty in densities as a percentage of the total density for that species.

    mvn_sta_l3_density_quality_flag - quality flag assigned to each data point and ion species:
                                   0 = ok
                                   1 = use caution (recommend not using)
                                   Quality flag takes into account the statistical significance of the observed count rates, changes in
                                   attenuator states, whether STATIC is pointed optimally.

    mvn_sta_l3_density_light_method &
    mvn_sta_l3_density_heavy_method - methods used to determine light and heavy ion densities.
                                      0 = moment; 1, 2, or 3 = beam for O+, O2+, CO2+ respectively (different values used for viewing purposes).

    mvn_sta_c6_att_mode -   indicates which mode & attenuator state STATIC is in  (see STATIC readme)

    mvn_sta_l3_density_mvn_pos_mso - MAVENs position in the MSO coordinate system, in units of km, generated using SPICE.

    mvn_sta_l3_density_mvn_sza - MAVENs solar zenith angle in the MSO coordinate system, in degrees, generated using SPICE.

    mvn_sta_l3_density_mvn_alt_iau - MAVENs altitude in the IAU coordinate system (ie Mars is an oblate spheroid), in units of km, generated using SPICE.

    TEMPERATURE:

    mvn_sta_l3_temperature_o2+: O2+ temperature, mostly at c6 time cadence (4s) in eV

    mvn_sta_l3_temperature_abs_uncertainty: absolute statistical uncertainty in temperature (eV). Note, this is the statisical uncertainty
                                         associated with the number of counts observed. There can be other sources of uncertainty, for example
                                         from blockage caused by the spacecraft or gaps in STATICs field of view. These are not accounted for
                                         (and are difficult to do so in an automated fashion).;

    mvn_sta_l3_temperature_quality_flag - quality flag assigned to each data point and ion species:
                                   0 = ok
                                   1 = use caution (recommend not using)
                                   Quality flag takes into account the availability of corrections to s/c potential based on LPW data,
                                   and the ratio of the temperature corrections to the temperature (T_AC/T_ion, see temperature paper for
                                   definition of T_AC)

    mvn_sta_l3_temperature_product - indicates which STATIC data product was used to calculate O2+ temperature.
                                   0 = c6 energy beamwidth (default)
                                   1 = c8 angular beamwidth

    mvn_sta_l3_sta_att_mode - indicates which mode & attenuator state STATIC is in  (see STATIC readme; same as mvn_sta_c6_att_mode)

    mvn_sta_l3_temperature_mvn_pos_mso - MAVEN's position in the MSO coordinate system, in units of km, generated using SPICE.

    mvn_sta_l3_temperature_mvn_pos_geo - MAVEN's position in the planetocentric coordinate system, in units of km, generated using SPICE.

    mvn_sta_l3_temperature_mvn_sza - MAVEN's solar zenith angle in the MSO coordinate system, in degrees, generated using SPICE.

    mvn_sta_l3_temperature_mvn_alt_iau - MAVEN's altitude in the IAU coordinate system (ie Mars is an oblate spheroid), in units of km, generated using SPICE.

    mvn_sta_l3_temperature_mvn_lst - MAVEN's local solar time, in hours.

    BULK FLOW VELOCITY:
    TBD

    EXAMPLES:
    timespan, '2019-04-03', 1.  ;set timespan
    mvn_sta_l3_load  ;load all STATIC moments into tplot.

(See projects/maven/sta/mvn_sta_l3_load.pro)

## MVN_STA_PROD_CAL

[Previous Routine] [List of Routines]

    PROCEDURE:	mvn_sta_prod_cal,all=all,units=units,apids=apids,test=test,gf_nor=gf_nor,return_nrg=return_nrg,nrg_swp
    PURPOSE:
    	Calibrates STATIC data products generated by mvn_sta_apid_handler.pro
    INPUT:

    KEYWORDS:
    	all		0/1		if not set, then raw tplot structures are deleted
    	units		string		select the units for generated tplot structures
    	apids		strarr		if set, selectes subset of apids to generate tplot structures
    	test		0/1		if set, prints out MLUT check
    	gf_nor		0/1		if set, keyword for testing mechanical attenuator - ignores attM open or closed
    	return_ngr	0/1		if set, returns energy sweep table in "nrg" keyword
    	nrg_swp		fltarr		returned sweep table if return_nrg keyword is set

    CREATED BY:	J. McFadden	2012/10/04
    VERSION:	1
    LAST MODIFICATION:  2014/03/14
    MOD HISTORY:

    NOTES:	 L0 files changed to APID 0x62 (instead of 0x51)

     TBDs to make the code consistent with SIS:

    	tbd	modify code to account for non-perfect attenuation of attE and lowest energy sample where attE is activated

    	tbd	correct program for leakage by electrostatic attenuator at low energy -
    			currently these data are flagged with the quality flag

    	tbd	current code uses swp2gfan and swp2gfdf to help approximate gf for omni-directional apids - c0,c2,c4,c6
    			need to check whether this properly handles theta and azimuthal angle ranges
    	add	gf_corr[npts,nenergy] to common blocks for apids c0,c2,c4,c6,c8 to account for sensitivity variation with ion flux direction

    	tbd	may need to change the code that throws away extra data at end of file

    	fix	eff array
    	add	eff_ind coding from time and swp_ind
    	mod	eff dimension

    	mod	bkg so it varies with time (it will contain the estimated straggling counts)

    	change	"test" keyword -- may have conflicts

    	add	change gf to account for narrow cold beams centered on a sector - no losses from ESA exit posts or TOF posts, see lines 178 and 600

    		quality_flag definition						 determined from

    			bit 0	test pulser on					- testpulser header bit set
    			bit 1	diagnostic mode					- diagnostic header bit set
    			bit 2	dead time correction >2 flag			- deadtime correction > 2
    			bit 3	detector droop correction >2 flag 		- mcp droop flagged if correction > 2
    			bit 4	dead time correction not at event time		- missing data quantity for deadtime
    			bit 5	electrostatic attenuator failing at low energy	- attE on and eprom_ver<2
    			bit 6   attenuator change during accumulation		- att 1->2 or 2->1 transition (one measurement)
    			bit 7	mode change during accumulation			- only needed for packets that average data during mode transition
    			bit 8	lpw sweeps interfering with data 		- lpw mode not dust mode
    			bit 9	high background 		 		- minimum value in DA > 10000 Hz
    			bit 10	no background subtraction array		 	- dat.bkg = 0		- may not be needed
    			bit 11	missing spacecraft potential			- dat.sc_pot = 0	- may not be needed
    			bit 12	inflight calibration incomplete			- date determined, set to 1 until calibration finalized
    			bit 13	geometric factor problem			-
    			bit 14	ion suppression problem				- low energy ions <6eV have wrong geometric factor
    			bit 15	not used =0

(See projects/maven/sta/mvn_sta_prod_cal.pro)