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

Last modified: Mon Aug 25 17:03:11 2025.

# Directory Listing of Routines

# projects/maven/l2gen

- CDF_LOAD_VARS2
- CDF_SAVE_VARS2
- DUMMY_MAVEN_L2_STRUCT
- MVN_CALL_SWE_L2GEN
- MVN_CALL_SWE_RESAMPLE_PAD_DAILY
  Wrapper for mvn_swe_resample_pad_daily.pro, checks time for most
- MVN_L2FILE_COMPRESS
  compresses an output L2 file and creates an md5 file
- MVN_L2GEN_MULTIPROCESS_A
- MVN_L2GEN_OUTDIR
- MVN_L2GEN_REMOVE_0LOGS
- MVN_SWE_KPGEN
  Loads L0 data, creates L2 files for 1 day
- MVN_SWE_L2GEN
  Loads L0 data, creates L2 files for 1 day
- MVN_SWE_L2GEN_1DAY
  reads in a start and end date, and reprocesses all of the days in
- MVN_SWE_QUALITY_DAILY
  Calculates the quality flag for the low-energy suppression anomaly.
- MVN_SWE_RESAMPLE_PAD_DAILY
  Resamples SWEA pitch angle distributions for one or more UT days and saves
- RUN_SWE_L2GEN
  Designed to run from a cronjob, sets up a lock file, and
- RUN_SWE_REPAD
  Designed to run from a cronjob, sets up a lock file, and

# Routine Descriptions

## CDF_LOAD_VARS2

[Next Routine] [List of Routines]

     FUNCTION cdfi = cdf_load_vars2(file)
     INPUT:
       file = CDF filename(s)
     OUTPUT:
       CDFI = A structure containing pointers to the data and attributes
              for the files, with tags:
       CDFI.FILENAME = The filename(s)

       CDFI.INQ = A structure with information about the file:
       CDFI.INQ.NDIMS = CDF Dims attribute, for rVariables typically 0
                      (rVariables are rarely used anymore See http://cdf.gsfc.nasa.gov/html/FAQ.html#intro)
       CDFI.INQ.DECODING = 'HOST_DECODING' (can be network or host)
       CDFI.INQ.ENCODING = 'NETWORK_ENCODING' (can be network or host)
       CDFI.INQ.MAJORITY = 'ROW_MAJOR' (can be row or column)
       CDFI.INQ.MAXREC = Max number of records (Default is -1)
       CDFI.INQ.NVARS =  number of rVariables, usually 0
       CDFI.INQ.NZVARS = number of zVariables, usually all of them
       CDFI.INQ.NATTS = number of variable attributes
       CDFI.INQ.DIM = dimensions of rVariables

       CDFI.g_atttributes = CDF global attributes, structure varies
       Here is a sample from THEMIS EFI:

       PROJECT         STRING    'THEMIS'
       SOURCE_NAME     STRING    'THA>Themis Probe A'
       DISCIPLINE      STRING    'Space Physics>Magnetospheric Science'
       DATA_TYPE       STRING    'EFI'
       DESCRIPTOR      STRING    'L2>L2 DATA'
       DATA_VERSION    STRING    '1'
       PI_NAME         STRING    'V. Angelopoulos, J. Bonnell & F. Mozer'
       PI_AFFILIATION  STRING    'UCB, NASA NAS5-02099'
       TITLE           STRING    'Electric Field Instrument (EFI) Measurements'
       TEXT            STRING    'THEMIS-A: Electric Field Instrument (EFI) Electric field measurements. The L2 product is a 3D estimate of'...
       INSTRUMENT_TYPE STRING    'Electric Fields (space)'
       MISSION_GROUP   STRING    'THEMIS'
       LOGICAL_SOURCE  STRING    'tha_l2_efi'
       LOGICAL_FILE_ID STRING    'tha_l2_efi_20131001_v01'
       LOGICAL_SOURCE_DESCRIPTION
                       STRING    'Spacecraft-collected (EFI) Electric field'
       TIME_RESOLUTION STRING    '3-1/8s'
       RULES_OF_USE    STRING    'Open Data for Scientific Use'
       GENERATED_BY    STRING    'THEMIS SOC'
       GENERATION_DATE STRING    'Sun Oct  6 03:11:38 2013'
       ACKNOWLEDGEMENT STRING    'NASA Contract NAS5-02099'
       MODS            STRING    'Rev- 2009-09-16'
       ADID_REF        STRING    'NSSD0110'
       LINK_TEXT       STRING    Array[3]
       LINK_TITLE      STRING    Array[3]
       HTTP_LINK       STRING    Array[3]
       FILE_NAMING_CONVENTION
                       STRING    'source_descriptor_datatype'
       CAVEATS         STRING    'See THEMIS website for caveats'
       VALIDITY        STRING    'to be validated'
       VALIDATOR       STRING    'tbd'
       VALIDATE        STRING    'Compatible with the ISTP CDF Standards'
       INST_MOD        STRING    'THM>xxxx'
       PARENTS         STRING    'xxxx'
       INST_SETTINGS   STRING    'Not used'
       SOFTWARE_VERSION
                       STRING    '13273'

      CDFI.NV = Number of variables

      CDFI.VARS = AN array of CDFI.NV structures, one for each zvariable:
      CDFI.VARS.NAME = The variable name
      CDFI.VARS.NUM  = The index of the given variable in the cdfi.vars array
      CDFI.VARS.IS_ZVAR = 1 for a zVariable
      CDFI.VARS.DATATYPE = The data type, e.g.'CDF_FLOAT'
      CDFI.VARS.TYPE = The nummerical IDL data type (float is 4, etc...)
      CDFI.VARS.NUMATTR = -1,  Not sure about this one, returned from CDF_VARGET
      CDFI.VARS.NUMELEM = Number of elements in a record, returned from CDF_VARGET
      CDFI.VARS.RECVARY = Set to 1 if variable varies from record to record
      CDFI.VARS.NUMREC = the number of records input.
      CDFI.VARS.NDIMEN = the number dimensions in the data
      CDFI.VARS.D = A six-element array with the number of dimensions for
                    each index
      CDFI.VARS.DATAPTR = A pointer to the data array:
      CDFI.VARS.ATTRPTR  = A pointer to the variable attributes
                           structure for each variable. Content varies,
                           here is a sample from THEMIS EFI Electric
                           field data:
       CATDESC         STRING    'EFF_DOT0 (fast-survey, 1/8 sec time resolution, using E dot B=0) electric field vector in GSM coordinates'...
       FIELDNAM        STRING    'EFF_DOT0 (fast-survey, 1/8 sec time resolution, using E dot B=0) electric field vector in GSM coordinates'...
       FILLVAL         FLOAT               NaN
       VALIDMIN        FLOAT     Array[3]
       VALIDMAX        FLOAT     Array[3]
       VAR_TYPE        STRING    'data'
       DISPLAY_TYPE    STRING    'time_series'
       FORMAT          STRING    'E13.6'
       LABL_PTR_1      STRING    'tha_eff_dot0_gsm_labl'
       UNITS           STRING    'mV/m'
       DEPEND_TIME     STRING    'tha_eff_dot0_time'
       DEPEND_EPOCH0   STRING    'tha_eff_dot0_epoch0'
       DEPEND_0        STRING    'tha_eff_dot0_epoch'
       DEPEND_1        STRING    'tha_eff_dot0_gsm_compno'
       VAR_NOTES       STRING    'Units are in mV/m'
       COORDINATE_SYSTEM
                       STRING    'GSM'
       REPRESENTATION_1
                       STRING    'Rep_xyz_gsm'
       TENSOR_ORDER    STRING    '1'
       AVG_TYPE        STRING    'standard'
       PROPERTY        STRING    'vector'
       SC_ID           STRING    'a'
       SCALE_TYP       STRING    'linear'
       DICT_KEY        STRING    'electric_field>vector_GSM'
       SI_CONVERSION   STRING    '1e-3>V/m'
       LABEL_1         STRING    'tha_eff_dot0_gsm_labl'

     Each variable may have a different set of attributes, but this
     example is a minimal structure that will be ISTP compliant.

     KEYWORDS:
       VARFORMAT = string or string array:  a string or string array (which may contain wildcard
                             characters) that specifies the CDF variable names to load.  Use
                              'VARFORMAT='*' to load all variables. NOTE
                              THAT VARFORMAT MUST BE SET IF YOU ACTUALLY
                              WANT TO READ DATA.
       VARNAMES = named variable   ;output variable for variable names that were loaded.
       SPDF_DEPENDENCIES :   Set to 1 to have SPDF defined dependent variables also loaded.
       VAR_TYPE = string or string array;  Variables that have a VAR_TYPE matching these strings will
                             be loaded.
       CONVERT_INT1_TO_INT2  Set this keyword to convert signed one byte to signed 2 byte integers.
                             This is useful because IDL does not have the equivalent of INT1   (bytes are unsigned)
       RECORD: Specify the record index where you want to start reading.  By default, this option will read one record.
       NUMBER_RECORDS: Specify the number of records that you want to read.  By default, this option will begin at record zero.

     Note: Record & Number_Records can be used together to specify a range of records to be read.

     Author: Davin Larson - 2006

     Side Effects:
       Data is returned in pointer variables. Calling routine is responsible for freeing up heap memory - otherwise a memory leak will occur.

     $LastChangedBy: jwl $
     $LastChangedDate: 2025-08-20 11:11:05 -0700 (Wed, 20 Aug 2025) $
     $LastChangedRevision: 33563 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/l2gen/cdf_load_vars2.pro $

(See projects/maven/l2gen/cdf_load_vars2.pro)

## CDF_SAVE_VARS2

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

     Version of CDF_SAVE_VARS with some fixes, square brackets. Hopefully
     temporary, need to reconcile with data_dimen issues in CDF_SAVE_VARS

     FUNCTION: dummy = cdf_save_vars(cdf_structure,new_cdf_name)
     PURPOSE:  To dump data and metadata from an IDL structure into a CDF file.
    		The structure format is the structure produced by cdf_load_vars.pro
     INPUTS:   cdf_structure : IDL structure defined by cdf_load_vars.pro
    	    new_cdf_name  : a string to name the new CDF file with
     OUTPUTS:  CDF file named by the new_cdf_name input

     KEYWORDS: SET_COMPRESSION
     Set this keyword to the compression type to be used for the
     single-file CDF file. Note that individual CDF variables may use
     compression types different than the one for the rest of the CDF
     file. Valid compression types are:
        0 = No Compression
        1 = Run-Length Encoding
        2 = Huffman
        3 = Adaptive Huffman
        5 = GZIP (see the optional GZIP_LEVEL keyword)
     SET_GZIP_LEVEL
     This keyword is used to indicate the desired effort for the GZIP
     compression. This effort must be expressed as a scalar in the range
     (1-9). If GZIP_LEVEL is not specified upon entry then the default
     effort level is taken to be 5. If the SET_GZIP_LEVEL keyword is set
     to a valid value, and the keyword SET_COMPRESSION is not specified,
     the SET_COMPRESSION is set to GZIP (5).

     EXAMPLE:  dummy = cdf_save_vars(cdfi,'newcdf.cdf')

     Written by: Matt Davis

    Note: To use this routine you must have the CDF_EPOCH/CDF_EPOCH16 bug patch on your IDL6.3
    and if you are using Solaris you need to be in 32-bit mode NOT 64-bit
    (ie, idl -32)
     $LastChangedBy: jimm $
     $LastChangedDate: 2024-03-05 14:35:54 -0800 (Tue, 05 Mar 2024) $
     $LastChangedRevision: 32477 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/l2gen/cdf_save_vars2.pro $

(See projects/maven/l2gen/cdf_save_vars2.pro)

## DUMMY_MAVEN_L2_STRUCT

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

    unction dummy_maven_l2_struct, vars, only_1_time_array = only_1_time_array, $
                                   instrument = instrument, _extra=_extra
     Takes an array of tplot variables, creates a dummy CDF master
     structure, inserts data, returns structure suitable for output.
     If you set the only_1_time_array keyword, then there will be only 1
     time_array, the instrument keyword also needs to be set, so that the
     time variable name is 'instrument_time' (e.g., instrument = 'swe_l2'
     will give a time variable name of 'swe_l2_time'. Otherwise, the time
     variable name will be 'L2_time').

(See projects/maven/l2gen/dummy_maven_l2_struct.pro)

## MVN_CALL_SWE_L2GEN

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

    NAME:
     mvn_call_swe_l2gen
    CALLING SEQUENCE:
     mvn_call_swe_l2gen
    INPUT:
     None -- the default is to read in a file
             /disks/data/maven/data/sci/swe/l2/most_recent_l0_processed.txt
             and process all files after that time
    KEYWORDS:
     time_in = the time for which old files created *after* this date
               will be processed. E.g., if you pass in '2017-11-07'
               then all files created after 7-nov-2017/00:00:00 will
               be reprocessed
     before_time = if set, process all of the files created *before* the
                  input time
     days_in = An array of dates, e.g., ['2009-01-30','2009-02-01'] to
               process. This ignores the input time. This option
               replicates the proceesing done by
               thm_reprocess_l2gen_days.
     out_dir = the directory in which you write the data, default defined
               by the MAVEN directory structure, e.g.:
                   '/disks/data/maven/data/sci/swe/l2/YYYY/MM/'
     use_file4time = if set, use filenames for time test instead of file
                     modified time, useful for reprocessing
     search_time_range = if set, then use this time range to find files
                         to be processed, instead of just before or after
                         time.
     use_l2_files = if set, then use L2 files as input, and not
                    L0's. Note that L0 is still used for file
                    searching, so you might want to use this with the
                    days_in option. (passed through to mvn_swe_l2gen.pro)
     l2only = if set, then insist on using L2 MAG data for generating
              L2 PAD data
     no_reset_time = if set, then don't reset the time in
                     most_recent_l0_processed.txt (useful for repocessing
                     data without affecting the cron job)
     max_l0_files = This is the maximum number of L0 files that can be
                    processed, the deault is 30. This is a fail-safe to
                    avoid mass reprocessing of data, if a bunch of file
                    ctime values are inadvertently changed. If more files
                    than this limit are tried, an error email will be sent.
     allbad = if set, mark all data as affected by the low-energy anomaly.
              Permanently set to zero.  This will never be done again.
     refresh = action to take if quality save file is not found: 0 = do nothing,
               1 = create only if missing, 2 = create/overwrite any existing file
               Default = 2, because muser is processing the latest data, and the
               coverage can change with each revision.
     kp_comp = controls processing of spacecraft potentials when calculating key
               parameters.  0 = ignore composite potential and use the SWE+ method,
               1=try to use the composite potential first; if that fails use the
               SWE+ method.  Default = 1.
     mail_xtra = send emails to this address as well as to the default address

    HISTORY:
    Hacked from mvn_call_sta_l2gen, 17-Apr-2014, jmm
     $LastChangedBy: xussui_lap $
     $LastChangedDate: 2025-04-30 13:04:10 -0700 (Wed, 30 Apr 2025) $
     $LastChangedRevision: 33281 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/l2gen/mvn_call_swe_l2gen.pro $

(See projects/maven/l2gen/mvn_call_swe_l2gen.pro)

## MVN_CALL_SWE_RESAMPLE_PAD_DAILY

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

    NAME:
     mvn_call_swe_resample_pad_daily
    PURPOSE:
     Wrapper for mvn_swe_resample_pad_daily.pro, checks time for most
     recent mag L1 data, and processes the new days.
    CALLING SEQUENCE:
     mvn_call_swe_resample_pad_daily
    INPUT:
     None -- the default is to process all files after a given time, from
             a file
             /disks/data/maven/data/sci/swe/l2/most_recent_l1mag_processed.txt
             and process all files after that time.
    KEYWORDS:
     time_in = the time for which old files created *after* this date
               will be processed. E.g., if you pass in '2017-11-07'
               then all files created after 7-nov-2017/00:00:00 will
               be reprocessed.
     before_time = if set, process all of the files created *before* the
                  input time
     days_in = An array of dates, e.g., ['2009-01-30','2009-02-01'] to
               process. This ignores the input time. This option
               replicates the proceesing done by
               thm_reprocess_l2gen_days.
     use_file4time = if set, use filenames for time test instead of file
                     modified time, useful for reprocessing
     search_time_range = if set, then use this time range to find files
                         to be processed, instead of just before or after
                         time.
     out_rootdir = if set, reset the root_data_dir variable to this
                   value, for testing,
     l2only = if set, then insist on using L2 MAG data for generating
              L2 PAD data
     no_reset_time = if set, then don't reset the time in
                     most_recent_l1mag_processed.txt (useful for repocessing
                     data without affecting the cron job)
    HISTORY:
     Hacked from mvn_call_swe_l2gen, 14-Oct-2015, jmm
     $LastChangedBy: jimm $
     $LastChangedDate: 2015-10-13 16:02:56 -0700 (Tue, 13 Oct 2015) $
     $LastChangedRevision: 19066 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/l2gen/mvn_call_swe_resample_pad_daily.pro $

(See projects/maven/l2gen/mvn_call_swe_resample_pad_daily.pro)

## MVN_L2FILE_COMPRESS

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

    NAME:
     mvn_l2file_compress
    PURPOSE:
     compresses an output L2 file and creates an md5 file
    CALLING SEQUENCE:
     mvn_l2file_compress, fullfile0
    INPUT:
     fullfile0 = the full-path filename for the revisionless cdf file
    OUTPUT:
     No explicit output, the revisioned file is written, an md5 sum file
     is written in the same directory, and the revisionless file is
     linked to the revsioned file
    KEYWORDS:
    None, so far
    HISTORY:
     26-nov-2014, jmm, jimm@ssl.berkeley.edu
     $LastChangedBy: muser $
     $LastChangedDate: 2022-03-08 09:46:33 -0800 (Tue, 08 Mar 2022) $
     $LastChangedRevision: 30657 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/l2gen/mvn_l2file_compress.pro $

(See projects/maven/l2gen/mvn_l2file_compress.pro)

## MVN_L2GEN_MULTIPROCESS_A

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

    ro mvn_l2gen_multiprocess_a, function_in, nproc, offset, time_range, $
                                 proc_workdir, remove_lock = remove_lock
     function_in is an IDL main program (LEAVE OUT THE .pro)
     THis function needs to run on inputs read in from start and end time files.
     nproc is the number of processes that are desired
     time_range is a 2xN array of start and end times,
     proc_workdir is the directory where the function_in program lives,
     each subprocess will create a directory, copy the function_in
     program into that directory, and run it there. The function_in
     program must pick up its start_time from a file
     'function_in_start_time.txt' in that directory, and not work
     past 'function_in_end_time.txt'. These files are created for the
     first process, and the start_time file gets updated each time the
     program runs.
     23-apr-2009, jmm, Now only sets up the process, processing is handled
     be generic_multiprocess_b.sh
     Changed name, removed the SSW calls, for use for overplotting. Note
     also that this version overwrites start and end times if the
     subdirectories exist, jmm, 21-nov-2011
     Added offset to be able to use multiple computers, jmm, 6-oct-2013

(See projects/maven/l2gen/mvn_l2gen_multiprocess_a.pro)

## MVN_L2GEN_OUTDIR

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

    NAME: mvn_l2gen_outdir
    PURPOSE: helper function to create output directories,
    group-writeable, with group set to 'maven'.
    CALLING SEQUENCE:
    mvn_l2gen_outdir, directory, year = year, month = month
    KEYWORDS:
     year = 'yyyy' will create directory+year+'/'
     month = 'mm' will create directory+year+'/'+month+'/'
    HISTORY:
     $LastChangedBy: jimm $
     $LastChangedDate: 2020-08-18 09:56:24 -0700 (Tue, 18 Aug 2020) $
     $LastChangedRevision: 29042 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/l2gen/mvn_l2gen_outdir.pro $

(See projects/maven/l2gen/mvn_l2gen_outdir.pro)

## MVN_L2GEN_REMOVE_0LOGS

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

    Remove zero length static log files from log directory
    ro mvn_l2gen_remove_0logs, dir = dir, _extra = _extra

(See projects/maven/l2gen/mvn_l2gen_remove_0logs.pro)

## MVN_SWE_KPGEN

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

    NAME:
     mvn_swe_kpgen
    PURPOSE:
     Loads L0 data, creates L2 files for 1 day
    CALLING SEQUENCE:
     mvn_swe_kpgen, date = date
    INPUT:
     date keyword
    KEYWORDS:
     date = If set, the input date. The default is today
     directory = If set, output into this directory, for testing
                 purposes, don't forget a slash '/'  at the end.
     allbad = If set, mark all data as affected by low-energy anomaly.
    HISTORY:
     Hacked from mvn_swe_l2gen, 2015-01-25, jmm, jimm@ssl.berkeley.edu
     jimm@ssl.berkeley.edu
     $LastChangedBy: dmitchell $
     $LastChangedDate: 2021-02-18 13:40:21 -0800 (Thu, 18 Feb 2021) $
     $LastChangedRevision: 29670 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/l2gen/mvn_swe_kpgen.pro $

(See projects/maven/l2gen/mvn_swe_kpgen.pro)

## MVN_SWE_L2GEN

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

    NAME:
     mvn_swe_l2gen
    PURPOSE:
     Loads L0 data, creates L2 files for 1 day

    CALLING SEQUENCE:
     mvn_swe_l2gen, date=date
    INPUT:
       None.
    KEYWORDS:
       DATE:      If set, the input date. The default is today.

       DIRECTORY: If set, output into this directory, for testing
                   purposes, don't forget a slash '/'  at the end.

       L2ONLY:    If set, only generate PAD L2 data if MAG L2 data are available.

       NOL2:      If set, do not generate SWEA L2 data.  Takes precedence over the
                  next three keywords.

       DOSPEC:    Process the SPEC data.  Default = 1 (yes).

       DOPAD:     Process the PAD data.  Default = 1 (yes).

       DO3D:      Process the 3D data.  Default = 1 (yes).

       DOKP:      Process the KP data.  Default = 1 (yes).

       ABINS:     Anode bin mask -> 16 elements (0 = off, 1 = on)
                  Default = replicate(1,16)

       DBINS:     Deflector bin mask -> 6 elements (0 = off, 1 = on)
                  Default = replicate(1,6)

       OBINS:     3D solid angle bin mask -> 96 elements (0 = off, 1 = on)
                  Default = reform(ABINS # DBINS)

       MASK_SC:   Mask the spacecraft blockage.  This is in addition to any
                  masking defined by the ABINS, DBINS, and OBINS.
                  Default = 1 (yes).  Set this to 0 to disable and use the
                  above 3 keywords only (not recommended!).

       KP_QLEV:   Minimum quality level for calculating key parameters.  Filters out
                  the vast majority of spectra affected by the sporadic low energy
                  anomaly below 28 eV.  The validity levels are:

                    0B = Data are affected by the low-energy anomaly.  There
                         are significant systematic errors below 28 eV.
                    1B = Unknown because: (1) the variability is too large to
                         confidently identify anomalous spectra, as in the
                         sheath, or (2) secondary electrons mask the anomaly,
                         as in the sheath just downstream of the bow shock.
                    2B = Data are not affected by the low-energy anomaly.
                         Caveat: There is increased noise around 23 eV, even
                         for "good" spectra.

                  Default for this procedure is 1B.

       KP_COMP:   Value for COMPOSITE keyword for mvn_swe_kp.

       HIRES:     Use the constant flux method for identifing the hires sweep
                  tables (7-9).  Only needed during hires campaigns.

       REFRESH:   Action to take if a quality save file is not found.
                  This keyword can have one of three integer values:

                    0 : Do nothing.  Just fill the quality flag array
                        with 1's (unknown) for all times covered by the
                        missing file.

                    1 : Attempt to create the missing file, then try to
                        load it.

                    2 : Create or recreate all files, overwriting any
                        existing file(s).  Default.

                  *** This keyword only works for authorized users! ***

    HISTORY:
     Hacked from Matt F's crib_l0_to_l2.txt, 2014-11-14: jmm
     Better memory management and added keywords to control processing: dlm

     $LastChangedBy: dmitchell $
     $LastChangedDate: 2025-08-06 08:57:18 -0700 (Wed, 06 Aug 2025) $
     $LastChangedRevision: 33541 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/l2gen/mvn_swe_l2gen.pro $

(See projects/maven/l2gen/mvn_swe_l2gen.pro)

## MVN_SWE_L2GEN_1DAY

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

    NAME:
    mvn_swe_l2gen_1day
    PURPOSE:
    reads in a start and end date, and reprocesses all of the days in
    the interval. This is a main program, designed to be called from a
    shell script. Processes 1 day at a time
    CALLING SEQUENCE:
     .run mvn_swe_l2gen_1day
    INPUT:
    start_time, end_time are input from files
    mvn_swe_l2gen_1day_start_time.txt and
    mvn_swe_l2gen_1day_end_time.txt.
    OUTPUT:
     Maven SWE L2 files
    HISTORY:
     2014-11-05, jmm, jimm@ssl.berkeley.edu

(See projects/maven/l2gen/mvn_swe_l2gen_1day.pro)

## MVN_SWE_QUALITY_DAILY

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

    PROCEDURE:   mvn_swe_quality_daily
    PURPOSE:
      Calculates the quality flag for the low-energy suppression anomaly.
      Quality flag data are stored in daily IDL save/restore files.

      Quality flag definitions:

          0B = Data are affected by the low-energy anomaly.  There
               are significant systematic errors below 28 eV.
          1B = Unknown because: (1) the variability is too large to
               confidently identify anomalous spectra, as in the
               sheath, or (2) secondary electrons mask the anomaly,
               as in the sheath just downstream of the bow shock.
          2B = Data are not affected by the low-energy anomaly.
               Caveat: There is increased noise around 23 eV, even
               for "good" spectra.

    USAGE:
      mvn_swe_quality_daily, trange

    INPUTS:
           trange:       One or more dates, in any format accepted by time_double.
                         Only full UT days are processed; any fractional part of
                         the day is ignored.  When trange has more than one element,
                         all days between the earliest and the latest (inclusive)
                         are processed.

    KEYWORDS:
           NOLOAD:       Do not initialize SPICE and do not load data.  Assumes that
                         these steps are performed before calling this routine.

     $LastChangedBy: dmitchell $
     $LastChangedDate: 2024-02-27 11:55:04 -0800 (Tue, 27 Feb 2024) $
     $LastChangedRevision: 32459 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/l2gen/mvn_swe_quality_daily.pro $

    CREATED BY:    David L. Mitchell

(See projects/maven/l2gen/mvn_swe_quality_daily.pro)

## MVN_SWE_RESAMPLE_PAD_DAILY

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

    PROCEDURE:   mvn_swe_resample_pad_daily
    PURPOSE:
      Resamples SWEA pitch angle distributions for one or more UT days and saves
      the results in a tplot save/restore file(s).  These can then be loaded with
      mvn_swe_pad_restore.  This pre-calculation saves time.

    USAGE:
      mvn_swe_resample_pad, trange

    INPUTS:
           trange:       One or more dates, in any format accepted by time_double.
                         Only full UT days are processed; any fractional part of
                         the day is ignored.  When trange has more than one element,
                         all days between the earliest and the latest (inclusive)
                         are processed.

    KEYWORDS:

           L2ONLY:       Use L2 MAG data only.  Skip any date(s) where L2 data are
                         incomplete or not available.

     $LastChangedBy: dmitchell $
     $LastChangedDate: 2024-01-25 09:06:24 -0800 (Thu, 25 Jan 2024) $
     $LastChangedRevision: 32412 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/l2gen/mvn_swe_resample_pad_daily.pro $

    CREATED BY:    David L. Mitchell

(See projects/maven/l2gen/mvn_swe_resample_pad_daily.pro)

## RUN_SWE_L2GEN

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

    NAME:
     run_swe_L2gen
    PURPOSE:
     Designed to run from a cronjob, sets up a lock file, and
     processes. It the lock file exists, no processing
    CALLING SEQUENCE:
     run_swe_l2gen, noffset_sec = noffset_sec
    INPUT:
     none
    OUTPUT:
     none
    KEYWORDS:
     none
    HISTORY:
     25-jun-2014, jmm, jimm@ssl.berkeley.edu
     $LastChangedBy: $
     $LastChangedDate: $
     $LastChangedRevision: $
     $URL: $

(See projects/maven/l2gen/run_swe_l2gen.pro)

## RUN_SWE_REPAD

[Previous Routine] [List of Routines]

    NAME:
     run_swe_repad
    PURPOSE:
     Designed to run from a cronjob, sets up a lock file, and
     processes. It the lock file exists, no processing
    CALLING SEQUENCE:
     run_swe_repad
    INPUT:
     none
    OUTPUT:
     none
    KEYWORDS:
     none
    HISTORY:
     13-Oct-2015, jmm, jimm@ssl.berkeley.edu
     $LastChangedBy: jimmpc1 $
     $LastChangedDate: 2017-09-05 11:35:05 -0700 (Tue, 05 Sep 2017) $
     $LastChangedRevision: 23885 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/l2gen/run_swe_repad.pro $

(See projects/maven/l2gen/run_swe_repad.pro)