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

Last modified: Wed Aug 27 18:18:07 2025.

# Directory Listing of Routines

# projects/maven/sta/l2util

- MVN_CALL_STA_L2GEN
- MVN_CALL_STA_L2L2
- MVN_STA_BKG_L2FILE_SAVE
  saves an STA L2 background cdf, overwrites old versions, no revisions
- MVN_STA_CMN_L2GEN.PRO[1]
  turn a MAVEN STA common block into a L2 CDF, but only including the
- MVN_STA_CMN_2A_L2GEN.PRO
  turn a MAVEN STA RATES common block into a L2 CDF.
- MVN_STA_CMN_CONCAT
  concatenates two MAVEN STA commonblick structures
- MVN_STA_CMN_D6_L2GEN.PRO
  turn a MAVEN STA RATES common block into a L2 CDF.
- MVN_STA_CMN_D7_L2GEN.PRO
  turn a MAVEN STA RATES common block into a L2 CDF.
- MVN_STA_CMN_D89A_L2GEN.PRO
  turn a MAVEN STA RATES common block into a L2 CDF.
- MVN_STA_CMN_DB_L2GEN.PRO
  turn a MAVEN STA RATES common block into a L2 CDF.
- MVN_STA_CMN_L2FILE_SAVE
  saves an STA L2 cdf, managing the revision number and md5 sum. The
- MVN_STA_CMN_L2GEN.PRO[2]
  turn a MAVEN STA common block into a L2 CDF.
- MVN_STA_CMN_L2READ
  Reads an L2 file and fills a common block structure.
- MVN_STA_CMN_L2VARARR
  Returns an array with common block variable names for the input
- MVN_STA_CMN_TCLIP
  applies a trange to a STATIC common block structure
- MVN_STA_IV1_1DAY
  reads in a start and end date, and reprocesses all of the days in
- MVN_STA_IV2_1DAY
  reads in a start and end date, and reprocesses all of the days in
- MVN_STA_IV3_1DAY
  reads in a start and end date, and reprocesses all of the days in
- MVN_STA_IV4_1DAY
  reads in a start and end date, and reprocesses all of the days in
- MVN_STA_IVALL_1DAY
  reads in a start and end date, and reprocesses all of the days in
- MVN_STA_IVALL_SAMEDAY
  reads in a start and end date, and reprocesses all of the days in
- MVN_STA_L2_FILEREVISION
  tracks the revision number for a STATIC L2 file
- MVN_STA_L2DAT_STRUCT
- MVN_STA_L2EFLUX
  Helper function for eflux calculations
- MVN_STA_L2GEN
  Generates MAVEN STA L2 files
- MVN_STA_L2GEN_1DAY
  reads in a start and end date, and reprocesses all of the days in
- MVN_STA_L2L2_1DAY
  reads in a start and end date, and reprocesses all of the days in
- MVN_STA_L2SCPOT
  Wrapper for mvn_sta_scpot_load that insures that c0 and c6 data have
- MVN_STA_SETUP_IV1PROCESS
- MVN_STA_SETUP_IV2PROCESS
- MVN_STA_SETUP_IV3PROCESS
- MVN_STA_SETUP_IV4PROCESS
- MVN_STA_SETUP_IVALLPROCESS
- MVN_STA_SETUP_REPROCESS
- RERUN_STA_L2GEN
  Designed to run from a cronjob, after the original L2 processing,
- RUN_STA_IVALL
  Reads in a start date, and process a day, if that day is more than
- RUN_STA_L2GEN
  Designed to run from a cronjob, sets up a lock file, and

# Routine Descriptions

## MVN_CALL_STA_L2GEN

[Next Routine] [List of Routines]

    NAME:
     mvn_call_sta_l2gen
    CALLING SEQUENCE:
     mvn_call_sta_l2gen
    INPUT:
     None -- the default is to read in a file
             /disks/data/maven/data/sci/sta/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.
     out_dir = the directory in which you write the data, default is './'
     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_sta_l2gen.pro)
     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.
    HISTORY:
    Hacked from thm_all_l1l2_gen, 17-Apr-2014, jmm
     $LastChangedBy: jimm $
     $LastChangedDate: 2020-08-18 09:53:10 -0700 (Tue, 18 Aug 2020) $
     $LastChangedRevision: 29040 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/sta/l2util/mvn_call_sta_l2gen.pro $

(See projects/maven/sta/l2util/mvn_call_sta_l2gen.pro)

## MVN_CALL_STA_L2L2

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

    NAME:
     mvn_call_sta_l2l2
    CALLING SEQUENCE:
     mvn_call_sta_l2l2
    INPUT:
     None -- the default is to read in a file
             /disks/data/maven/data/sci/sta/l2/most_recent_l2_processed.txt
             and process the files 3, 10, 30, 60 days before
    KEYWORDS:
     days_in = An array of dates, e.g., ['2009-01-30','2009-02-01'] to
               process.
     out_dir = the directory in which you write the data, default is './'
    HISTORY:
    Hacked from mvn_call_sta_l2gen, 2016-10-18, jmm, jimm@ssl.berkeley.edu
     $LastChangedBy: jimm $
     $LastChangedDate: 2019-11-18 09:08:17 -0800 (Mon, 18 Nov 2019) $
     $LastChangedRevision: 28028 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/sta/l2util/mvn_call_sta_l2l2.pro $

(See projects/maven/sta/l2util/mvn_call_sta_l2l2.pro)

## MVN_STA_BKG_L2FILE_SAVE

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

    NAME:
     mvn_sta_bkg_l2file_save
    PURPOSE:
     saves an STA L2 background cdf, overwrites old versions, no revisions
     or md5 sums or links, just the file
    CALLING SEQUENCE:
     mvn_sta_bkg_l2file_save, otp_struct, fullfile0, no_compression =
                              no_compression, iv_level=iv_level
    INPUT:
     otp_struct = the structure to output in CDF_LOAD_VARS format.
     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:
     no_compression = if set, skip the compression step
     temp_dir = if set, output files into subdirectories of this dir,
                then move to final destination. The default is
                '/mydisks/home/maven/', don't forget the slash
    HISTORY:
     22-jul-2014, jmm, jimm@ssl.berkeley.edu
     $LastChangedBy: jimm $
     $LastChangedDate: 2023-09-26 17:09:08 -0700 (Tue, 26 Sep 2023) $
     $LastChangedRevision: 32136 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/sta/l2util/mvn_sta_bkg_l2file_save.pro $

(See projects/maven/sta/l2util/mvn_sta_bkg_l2file_save.pro)

## MVN_STA_CMN_2A_L2GEN.PRO

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

    NAME:
     mvn_sta_cmn_2a_l2gen.pro
    PURPOSE:
     turn a MAVEN STA RATES common block into a L2 CDF.
    CALLING SEQUENCE:
     mvn_sta_cmn_2a_l2gen, cmn_dat
    INPUT:
     cmn_dat = a structure with the data:
       PROJECT_NAME    STRING    'MAVEN'
       SPACECRAFT      STRING    '0'
       DATA_NAME       STRING    'Housekeeping'
       APID            STRING    '2a'
       QUALITY_FLAG    INT       Array[2700]
       TIME            DOUBLE    Array[2700]
       NHKP            INT             99
       CALIB_CONSTANTS DOUBLE    Array[8, 99]
       HKP_LABELS      STRING    Array[99]
       HKP_RAW         INT       Array[2700, 99]
       HKP             FLOAT     Array[2700, 99]

     All of this has to go into the CDF, also Epoch, tt200, MET time
     variables; some of the names are changed to titles given in the SIS
     Data is changed from double to float prior to output
    KEYWORDS:
     otp_struct = this is the structure that is passed into
                  cdf_save_vars to creat the file
     directory = Set this keyword to direct the output into this
                 directory; the default is to populate the MAVEN STA
                 database. /disks/data/maven/pfp/sta/l2
     no_compression = if set, do not compress the CDF file
    HISTORY:
     16-jun-2014, jmm, hacked from mvn_sta_cmn_l2gen.pro
     $LastChangedBy: jimm $
     $LastChangedDate: 2015-10-21 15:41:49 -0700 (Wed, 21 Oct 2015) $
     $LastChangedRevision: 19131 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/sta/l2util/mvn_sta_cmn_2a_l2gen.pro $

(See projects/maven/sta/l2util/mvn_sta_cmn_2a_l2gen.pro)

## MVN_STA_CMN_CONCAT

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

    NAME:
     mvn_sta_cmn_concat
    PURPOSE:
     concatenates two MAVEN STA commonblick structures
    CALLING SEQUENCE:
     dat = mvn_sta_cmn_concat(dat1, dat2)
    INPUT:
     dat1, dat2 = two MAVEN STA data structures: e.g.,
       PROJECT_NAME    STRING    'MAVEN'
       SPACECRAFT      STRING    '0'
       DATA_NAME       STRING    'C6 Energy-Mass'
       APID            STRING    'C6'
       UNITS_NAME      STRING    'counts'
       UNITS_PROCEDURE STRING    'mvn_sta_convert_units'
       VALID           INT       Array[21600]
       QUALITY_FLAG    INT       Array[21600]
       TIME            DOUBLE    Array[21600]
       END_TIME        DOUBLE    Array[21600]
       DELTA_T         DOUBLE    Array[21600]
       INTEG_T         DOUBLE    Array[21600]
       MD              INT       Array[21600]
       MODE            INT       Array[21600]
       RATE            INT       Array[21600]
       SWP_IND         INT       Array[21600]
       MLUT_IND        INT       Array[21600]
       EFF_IND         INT       Array[21600]
       ATT_IND         INT       Array[21600]
       NENERGY         INT             32
       ENERGY          FLOAT     Array[9, 32, 64]
       DENERGY         FLOAT     Array[9, 32, 64]
       NBINS           INT              1
       BINS            INT       Array[1]
       NDEF            INT              1
       NANODE          INT              1
       THETA           FLOAT           0.00000
       DTHETA          FLOAT           90.0000
       PHI             FLOAT           0.00000
       DPHI            FLOAT           360.000
       DOMEGA          FLOAT           8.88577
       GF              FLOAT     Array[9, 32, 4]
       EFF             FLOAT     Array[128, 32, 64]
       GEOM_FACTOR     FLOAT       0.000195673
       NMASS           INT             64
       MASS            FLOAT         0.0104389
       MASS_ARR        FLOAT     Array[9, 32, 64]
       TOF_ARR         FLOAT     Array[5, 32, 64]
       TWT_ARR         FLOAT     Array[5, 32, 64]
       CHARGE          FLOAT           1.00000
       SC_POT          FLOAT     Array[21600]
       MAGF            FLOAT     Array[21600, 3]
       QUAT_SC         FLOAT     Array[21600, 4]
       QUAT_MSO        FLOAT     Array[21600, 4]
       BINS_SC         LONG      Array[21600]
       POS_SC_MSO      FLOAT     Array[21600, 3]
       BKG             FLOAT     Array[21600, 32, 64]
       DEAD            DOUBLE    Array[21600, 32, 64]
       DATA            DOUBLE    Array[21600, 32, 64]
    OUTPUT:
     dat = a single structure concatenated
    HISTORY:
     19-may-2014, jmm, jimm@ssl.berkeley.edu
     $LastChangedBy: jimm $
     $LastChangedDate: 2023-02-22 12:07:21 -0800 (Wed, 22 Feb 2023) $
     $LastChangedRevision: 31504 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/sta/l2util/mvn_sta_cmn_concat.pro $

(See projects/maven/sta/l2util/mvn_sta_cmn_concat.pro)

## MVN_STA_CMN_D6_L2GEN.PRO

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

    NAME:
     mvn_sta_cmn_d6_l2gen.pro
    PURPOSE:
     turn a MAVEN STA RATES common block into a L2 CDF.
    CALLING SEQUENCE:
     mvn_sta_cmn_d6_l2gen, cmn_dat
    INPUT:
     cmn_dat = a structure with the data:
      PROJECT_NAME    STRING    'MAVEN'
      SPACECRAFT      STRING    '0'
      DATA_NAME       STRING    'd6 events'
      APID            STRING    'd6'
      VALID           INT       Array[4926]
      QUALITY_FLAG    INT       Array[4926]
      TIME            DOUBLE    Array[4926]
      TDC_1           INT       Array[4926]
      TDC_2           INT       Array[4926]
      TDC_3           INT       Array[4926]
      TDC_4           INT       Array[4926]
      EVENT_CODE      INT       Array[4926]
      CYCLESTEP       INT       Array[4926]
      ENERGY          FLOAT     Array[4926]
      TDC1_CONV       FLOAT          0.171116
      TDC2_CONV       FLOAT          0.171116
      TDC3_CONV       FLOAT         0.0569395
      TDC4_CONV       FLOAT         0.0557491
      TDC1_OFFSET     FLOAT           16.0000
      TDC2_OFFSET     FLOAT           22.0000
      TDC3_OFFSET     FLOAT           3.00000
      TDC4_OFFSET     FLOAT         -0.500000
      AN_BIN_TDC3     INT       Array[16, 2]
      AN_BIN_TDC4     INT       Array[16, 2]
      MS_BIAS_OFFSET  INT       Array[16]
      EVCONVLUT       INT            255
      TIMERST         INT             10
     ? don't know yet, but this is written from the SIS assuming
     that everything is in the structure except for n_elements
     All of this has to go into the CDF, also Epoch, tt200, MET time
     variables; some of the names are changed to titles given in the SIS
     Data is changed from double to float prior to output
    KEYWORDS:
     otp_struct = this is the structure that is passed into
                  cdf_save_vars to create the file
     directory = Set this keyword to direct the output into this
                 directory; the default is to populate the MAVEN STA
                 database. /disks/data/maven/pfp/sta/l2
     no_compression = if set, do not compress the CDF file
    HISTORY:
     13-jun-2014, jmm, hacked from mvn_sta_cmn_l2gen.pro
     $LastChangedBy: jimm $
     $LastChangedDate: 2015-10-21 15:41:49 -0700 (Wed, 21 Oct 2015) $
     $LastChangedRevision: 19131 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/sta/l2util/mvn_sta_cmn_d6_l2gen.pro $

(See projects/maven/sta/l2util/mvn_sta_cmn_d6_l2gen.pro)

## MVN_STA_CMN_D7_L2GEN.PRO

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

    NAME:
     mvn_sta_cmn_d7_l2gen.pro
    PURPOSE:
     turn a MAVEN STA RATES common block into a L2 CDF.
    CALLING SEQUENCE:
     mvn_sta_cmn_d7_l2gen, cmn_dat
    INPUT:
     cmn_dat = a structure with the data:
       PROJECT_NAME    STRING    'MAVEN'
       SPACECRAFT      STRING    '0'
       DATA_NAME       STRING    'd7 fsthkp'
       APID            STRING    'd7'
       VALID           INT       Array[14336]
       QUALITY_FLAG    INT       Array[14336]
       TIME            DOUBLE    Array[14336]
       HKP_RAW         INT       Array[14336]
       HKP_CALIB       FLOAT     Array[14336]
       HKP_IND         LONG      Array[14336]
       NHKP            INT             24
       HKP_CONV        DOUBLE    Array[8, 24]
       HKP_LABELS      STRING    Array[24]
     ? don't know yet, but this is written from the SIS assuming
     that everything is in the structure except for n_elements
     All of this has to go into the CDF, also Epoch, tt200, MET time
     variables; some of the names are changed to titles given in the SIS
     Data is changed from double to float prior to output
    KEYWORDS:
     otp_struct = this is the structure that is passed into
                  cdf_save_vars to creat the file
     directory = Set this keyword to direct the output into this
                 directory; the default is to populate the MAVEN STA
                 database. /disks/data/maven/pfp/sta/l2
     no_compression = if set, do not compress the CDF file
    HISTORY:
     13-jun-2014, jmm, hacked from mvn_sta_cmn_l2gen.pro
     $LastChangedBy: jimm $
     $LastChangedDate: 2015-10-21 15:41:49 -0700 (Wed, 21 Oct 2015) $
     $LastChangedRevision: 19131 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/sta/l2util/mvn_sta_cmn_d7_l2gen.pro $

(See projects/maven/sta/l2util/mvn_sta_cmn_d7_l2gen.pro)

## MVN_STA_CMN_D89A_L2GEN.PRO

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

    NAME:
     mvn_sta_cmn_d89a_l2gen.pro
    PURPOSE:
     turn a MAVEN STA RATES common block into a L2 CDF.
    CALLING SEQUENCE:
     mvn_sta_cmn_d89a_l2gen, cmn_dat
    INPUT:
     cmn_dat = a structrue with the data:
       PROJECT_NAME    STRING    'MAVEN'
       SPACECRAFT      STRING    '0'
       DATA_NAME       STRING    'd9_12r64e'
       APID            STRING    'd9'
       VALID           INT       Array[675]
       QUALITY_FLAG    INT       Array[675]
       TIME            DOUBLE    Array[675]
       END_TIME        DOUBLE    Array[675]
       INTEG_T         DOUBLE    Array[675]
       EPROM_VER       INT       Array[675]
       HEADER          INT       Array[675]
       MODE            INT       Array[675]
       RATE            INT       Array[675]
       SWP_IND         INT       Array[675]
       ENERGY          FLOAT     Array[9, 64]
       NRATE           INT             12
       RATE_LABELS     STRING    Array[12]
       RATES           DOUBLE    Array[675, 12, 64]
     All of this has to go into the CDF, also Epoch, tt200, MET time
     variables; some of the names are changed to titles given in the SIS
     Data is changed from double to float prior to output
    KEYWORDS:
     otp_struct = this is the structure that is passed into
                  cdf_save_vars to creat the file
     directory = Set this keyword to direct the output into this
                 directory; the default is to populate the MAVEN STA
                 database. /disks/data/maven/pfp/sta/l2
     no_compression = if set, do not compress the CDF file
    HISTORY:
     13-jun-2014, jmm, hacked from mvn_sta_cmn_l2gen.pro
     22-Dec-2014, jmm, Added eprom_ver, header
     $LastChangedBy: jimm $
     $LastChangedDate: 2015-10-21 15:41:49 -0700 (Wed, 21 Oct 2015) $
     $LastChangedRevision: 19131 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/sta/l2util/mvn_sta_cmn_d89a_l2gen.pro $

(See projects/maven/sta/l2util/mvn_sta_cmn_d89a_l2gen.pro)

## MVN_STA_CMN_DB_L2GEN.PRO

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

    NAME:
     mvn_sta_cmn_db_l2gen.pro
    PURPOSE:
     turn a MAVEN STA RATES common block into a L2 CDF.
    CALLING SEQUENCE:
     mvn_sta_cmn_db_l2gen, cmn_dat
    INPUT:
     cmn_dat = a structrue with the data:
       PROJECT_NAME    STRING    'MAVEN'
       SPACECRAFT      STRING    '0'
       DATA_NAME       STRING    'db_1024m'
       APID            STRING    'db'
       VALID           INT       Array[1350]
       QUALITY_FLAG    INT       Array[1350]
       TIME            DOUBLE    Array[1350]
       END_TIME        DOUBLE    Array[1350]
       INTEG_T         DOUBLE    Array[1350]
       EPROM_VER       INT       Array[1350]
       HEADER          LONG      Array[1350]
       MODE            INT       Array[1350]
       RATE            INT       Array[1350]
       SWP_IND         INT       Array[1350]
       ENERGY          FLOAT     Array[9, 64]
       TOF             FLOAT     Array[1024]
       DATA            DOUBLE    Array[1350, 1024]
     All of this has to go into the CDF, also Epoch, tt200, MET time
     variables; some of the names are changed to titles given in the SIS
     Data is changed from double to float prior to output
    KEYWORDS:
     otp_struct = this is the structure that is passed into
                  cdf_save_vars to creat the file
     directory = Set this keyword to direct the output into this
                 directory; the default is to populate the MAVEN STA
                 database. /disks/data/maven/pfp/sta/l2
     no_compression = if set, do not compress the CDF file
    HISTORY:
     13-jun-2014, jmm, hacked from mvn_sta_cmn_l2gen.pro
     22-Dec-2014, jmm, Added eprom_ver, header
     $LastChangedBy: jimm $
     $LastChangedDate: 2015-10-21 15:41:49 -0700 (Wed, 21 Oct 2015) $
     $LastChangedRevision: 19131 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/sta/l2util/mvn_sta_cmn_db_l2gen.pro $

(See projects/maven/sta/l2util/mvn_sta_cmn_db_l2gen.pro)

## MVN_STA_CMN_L2FILE_SAVE

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

    NAME:
     mvn_sta_cmn_l2file_save
    PURPOSE:
     saves an STA L2 cdf, managing the revision number and md5 sum. The
     file will have the latest revision number, there will be a hard
     link to the revisioned file with no revision number, andan md5 sum
     for the uncompressed file. Also deletes old versions.
    CALLING SEQUENCE:
     mvn_sta_cmn_l2file_save, otp_struct, fullfile0, no_compression =
                              no_compression, iv1_process=iv1_Process
    INPUT:
     otp_struct = the structure to output in CDF_LOAD_VARS format.
     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:
     no_compression = if set, skip the compression step
     temp_dir = if set, output files into subdirectories of this dir,
                then move to final destination. The default is
                '/mydisks/home/maven/', don't forget the slash
    HISTORY:
     22-jul-2014, jmm, jimm@ssl.berkeley.edu
     $LastChangedBy: jimm $
     $LastChangedDate: 2020-08-18 09:53:10 -0700 (Tue, 18 Aug 2020) $
     $LastChangedRevision: 29040 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/sta/l2util/mvn_sta_cmn_l2file_save.pro $

(See projects/maven/sta/l2util/mvn_sta_cmn_l2file_save.pro)

## MVN_STA_CMN_L2GEN.PRO[1]

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

    NAME:
     mvn_sta_cmn_l2gen.pro
    PURPOSE:
     turn a MAVEN STA common block into a L2 CDF, but only including the
     background array.
    CALLING SEQUENCE:
     mvn_sta_cmn_l2gen, cmn_dat
    INPUT:
     cmn_dat = a structrue with the data:
     tags are:
       PROJECT_NAME    STRING    'MAVEN'
       SPACECRAFT      STRING    '0'
       DATA_NAME       STRING    'C6 Energy-Mass'
       APID            STRING    'C6'
       UNITS_NAME      STRING    'counts'
       UNITS_PROCEDURE STRING    'mvn_sta_convert_units'
       VALID           INT       Array[21600]
       QUALITY_FLAG    INT       Array[21600]
       TIME            DOUBLE    Array[21600]
       END_TIME        DOUBLE    Array[21600]
       DELTA_T         DOUBLE    Array[21600]
       INTEG_T         DOUBLE    Array[21600]
       EPROM_VER       INT       Array[21600]
       HEADER          LONG      Array[21600]
       MODE            INT       Array[21600]
       RATE            INT       Array[21600]
       SWP_IND         INT       Array[21600]
       MLUT_IND        INT       Array[21600]
       EFF_IND         INT       Array[21600]
       ATT_IND         INT       Array[21600]
       NENERGY         INT             32
       ENERGY          FLOAT     Array[9, 32, 64]
       DENERGY         FLOAT     Array[9, 32, 64]
       NBINS           INT              1
       BINS            INT       Array[1]
       NDEF            INT              1
       NANODE          INT              1
       THETA           FLOAT           0.00000
       DTHETA          FLOAT           90.0000
       PHI             FLOAT           0.00000
       DPHI            FLOAT           360.000
       DOMEGA          FLOAT           8.88577
       GF              FLOAT     Array[9, 32, 4]
       EFF             FLOAT     Array[128, 32, 64]
       GEOM_FACTOR     FLOAT       0.000195673
       DEAD1           FLOAT           420.000
       DEAD2           FLOAT           660.000
       DEAD3           FLOAT           460.000
       NMASS           INT             64
       MASS            FLOAT         0.0104389
       MASS_ARR        FLOAT     Array[9, 32, 64]
       TOF_ARR         FLOAT     Array[5, 32, 64]
       TWT_ARR         FLOAT     Array[5, 32, 64]
       CHARGE          FLOAT           1.00000
       SC_POT          FLOAT     Array[21600]
       MAGF            FLOAT     Array[21600, 3]
       QUAT_SC         FLOAT     Array[21600, 4]
       QUAT_MSO        FLOAT     Array[21600, 4]
       BINS_SC         LONG      Array[21600]
       POS_SC_MSO      FLOAT     Array[21600, 3]
       BKG             FLOAT     Array[21600, 32, 64]
       DEAD            FLOAT     Array[21600, 32, 64]
       DATA            DOUBLE    Array[21600, 32, 64]
     All of this (not DEAD or DATA or EFLUX)
     has to go into the CDF, also Epoch, tt200, MET time
     variables; some of the names are changed to titles given in the SIS
     Data is changed from double to float prior to output
     IV_LEVEL for background is added
    KEYWORDS:
     otp_struct = this is the structure that is passed into
                  cdf_save_vars to creat the file
     directory = Set this keyword to direct the output into this
                 directory; the default is to populate the MAVEN STA
                 database. /disks/data/maven/pfp/sta/l2
     no_compression = if set, do not compress the CDF file
     iv_level = New for 2020-08-24, setting this keyword runs a
                special L2 process that creates 'iv'+iv_level files, using a
                new background calculation. There will be multiple iv
                levels, and only the background values are saved in the
                file. THIS KEYWORD IS REQUIRED
    HISTORY:
     24-aug-2020, jmm, jimm@ssl.berkeley.edu, hacked from
     mvn_sta_cmn_l2gen.pro for cdf's with only the background calculation
     $LastChangedBy: jimm $
     $LastChangedDate: 2020-12-17 09:26:42 -0800 (Thu, 17 Dec 2020) $
     $LastChangedRevision: 29534 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/sta/l2util/mvn_sta_bkg_l2gen.pro $

(See projects/maven/sta/l2util/mvn_sta_bkg_l2gen.pro)

## MVN_STA_CMN_L2GEN.PRO[2]

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

    NAME:
     mvn_sta_cmn_l2gen.pro
    PURPOSE:
     turn a MAVEN STA common block into a L2 CDF.
    CALLING SEQUENCE:
     mvn_sta_cmn_l2gen, cmn_dat
    INPUT:
     cmn_dat = a structrue with the data:
     tags are:
       PROJECT_NAME    STRING    'MAVEN'
       SPACECRAFT      STRING    '0'
       DATA_NAME       STRING    'C6 Energy-Mass'
       APID            STRING    'C6'
       UNITS_NAME      STRING    'counts'
       UNITS_PROCEDURE STRING    'mvn_sta_convert_units'
       VALID           INT       Array[21600]
       QUALITY_FLAG    INT       Array[21600]
       TIME            DOUBLE    Array[21600]
       END_TIME        DOUBLE    Array[21600]
       DELTA_T         DOUBLE    Array[21600]
       INTEG_T         DOUBLE    Array[21600]
       EPROM_VER       INT       Array[21600]
       HEADER          LONG      Array[21600]
       MODE            INT       Array[21600]
       RATE            INT       Array[21600]
       SWP_IND         INT       Array[21600]
       MLUT_IND        INT       Array[21600]
       EFF_IND         INT       Array[21600]
       ATT_IND         INT       Array[21600]
       NENERGY         INT             32
       ENERGY          FLOAT     Array[9, 32, 64]
       DENERGY         FLOAT     Array[9, 32, 64]
       NBINS           INT              1
       BINS            INT       Array[1]
       NDEF            INT              1
       NANODE          INT              1
       THETA           FLOAT           0.00000
       DTHETA          FLOAT           90.0000
       PHI             FLOAT           0.00000
       DPHI            FLOAT           360.000
       DOMEGA          FLOAT           8.88577
       GF              FLOAT     Array[9, 32, 4]
       EFF             FLOAT     Array[128, 32, 64]
       GEOM_FACTOR     FLOAT       0.000195673
       DEAD1           FLOAT           420.000
       DEAD2           FLOAT           660.000
       DEAD3           FLOAT           460.000
       NMASS           INT             64
       MASS            FLOAT         0.0104389
       MASS_ARR        FLOAT     Array[9, 32, 64]
       TOF_ARR         FLOAT     Array[5, 32, 64]
       TWT_ARR         FLOAT     Array[5, 32, 64]
       CHARGE          FLOAT           1.00000
       SC_POT          FLOAT     Array[21600]
       MAGF            FLOAT     Array[21600, 3]
       QUAT_SC         FLOAT     Array[21600, 4]
       QUAT_MSO        FLOAT     Array[21600, 4]
       BINS_SC         LONG      Array[21600]
       POS_SC_MSO      FLOAT     Array[21600, 3]
       BKG             FLOAT     Array[21600, 32, 64]
       DEAD            FLOAT     Array[21600, 32, 64]
       DATA            DOUBLE    Array[21600, 32, 64]
     All of this has to go into the CDF, also Epoch, tt200, MET time
     variables; some of the names are changed to titles given in the SIS
     Data is changed from double to float prior to output
    KEYWORDS:
     otp_struct = this is the structure that is passed into
                  cdf_save_vars to creat the file
     directory = Set this keyword to direct the output into this
                 directory; the default is to populate the MAVEN STA
                 database. /disks/data/maven/pfp/sta/l2
     no_compression = if set, do not compress the CDF file
     iv_level = New for 2020-08-24, setting this keyword runs a
                special L2 process that creates 'iv'+iv_level files, using a
                new background calculation. There will be multiple iv
                levels, and only the background values are saved in the file
    HISTORY:
     28-apr-2014, jmm, jimm@ssl.berkeley.edu
     jun-2014, jmm added compression - no_compression
     10-jun-2014, jmm, added delete keyword,changed compression scheme
     11-jun-2014, changed filenaming no more R value
     18-jun-2014, added changes suggested by Bob McGuire, fixed epoch and
     tt200 attribute types
     7-7-2014, jmm, deleted no_cdfconvert option, added md5sum
     22-jul-2014, jmm, added revisoining
     2-oct-2014, jmm, ISTP compliance
     1-nov-2014, jmm, PDS compliance
     6-nov-2014, jmm, Corrects clock drift
     22-dec-2014, jmm, added eprom_ver and header
     25-aug-2020, jmm, Added iv_level
     $LastChangedBy: jimm $
     $LastChangedDate: 2020-12-17 09:26:42 -0800 (Thu, 17 Dec 2020) $
     $LastChangedRevision: 29534 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/sta/l2util/mvn_sta_cmn_l2gen.pro $

(See projects/maven/sta/l2util/mvn_sta_cmn_l2gen.pro)

## MVN_STA_CMN_L2READ

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

    NAME:
     mvn_sta_cmn_l2read
    PURPOSE:
     Reads an L2 file and fills a common block structure.
    CALLING SEQUENCE:
     cmn_dat = mvn_sta_cmn_l2read(filename, trange = trange)
    INPUT:
     filename = the input filename
    OUTPUT:
     cmn_dat = a structrue with the data:
     tags are:
       PROJECT_NAME    STRING    'MAVEN'
       SPACECRAFT      STRING    '0'
       DATA_NAME       STRING    'C6 Energy-Mass'
       APID            STRING    'C6'
       UNITS_NAME      STRING    'counts'
       UNITS_PROCEDURE STRING    'mvn_sta_convert_units'
       VALID           INT       Array[21600]
       QUALITY_FLAG    INT       Array[21600]
       TIME            DOUBLE    Array[21600]
       END_TIME        DOUBLE    Array[21600]
       DELTA_T         DOUBLE    Array[21600]
       INTEG_T         DOUBLE    Array[21600]
       MD              INT       Array[21600]
       MODE            INT       Array[21600]
       RATE            INT       Array[21600]
       SWP_IND         INT       Array[21600]
       MLUT_IND        INT       Array[21600]
       EFF_IND         INT       Array[21600]
       ATT_IND         INT       Array[21600]
       NENERGY         INT             32
       ENERGY          FLOAT     Array[9, 32, 64]
       DENERGY         FLOAT     Array[9, 32, 64]
       NBINS           INT              1
       BINS            INT       Array[1]
       NDEF            INT              1
       NANODE          INT              1
       THETA           FLOAT           0.00000
       DTHETA          FLOAT           90.0000
       PHI             FLOAT           0.00000
       DPHI            FLOAT           360.000
       DOMEGA          FLOAT           8.88577
       GF              FLOAT     Array[9, 32, 4]
       EFF             FLOAT     Array[128, 32, 64]
       GEOM_FACTOR     FLOAT       0.000195673
       NMASS           INT             64
       MASS            FLOAT         0.0104389
       MASS_ARR        FLOAT     Array[9, 32, 64]
       TOF_ARR         FLOAT     Array[5, 32, 64]
       TWT_ARR         FLOAT     Array[5, 32, 64]
       CHARGE          FLOAT           1.00000
       SC_POT          FLOAT     Array[21600]
       MAGF            FLOAT     Array[21600, 3]
       QUAT_SC         FLOAT     Array[21600, 4]
       QUAT_MSO        FLOAT     Array[21600, 4]
       BINS_SC         LONG      Array[21600]
       POS_SC_MSO      FLOAT     Array[21600, 3]
       BKG             FLOAT     Array[21600, 32, 64]
       DEAD            FLOAT     Array[21600, 32, 64]
       DATA            DOUBLE    Array[21600, 32, 64]
    KEYWORDS:
     trange = if set, then only input data for that time range, the first
              step would be to input the record times and then obtain a
              record range to input.
     cdf_info = the full structure from CDF_LOAD_VARS2, not everything in
                here ends up in the structure for the common blocks
     bkg_sub = if set, then load a background file, for the same apid
                and date, put background level into structure, and
                recalculate eflux for that apid
     iv_level = level of the background file, default is iv_level = 1
    HISTORY:
     2014-05-12, jmm, jimm@ssl.berkeley.edu
     $LastChangedBy: jimm $
     $LastChangedDate: 2023-09-20 10:54:46 -0700 (Wed, 20 Sep 2023) $
     $LastChangedRevision: 32110 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/sta/l2util/mvn_sta_cmn_l2read.pro $

(See projects/maven/sta/l2util/mvn_sta_cmn_l2read.pro)

## MVN_STA_CMN_L2VARARR

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

    NAME:
     mvn_sta_cmn_l2vararr
    PURPOSE:
     Returns an array with common block variable names for the input
     apid.
    CALLING SEQUENCE:
     vars = mvn_sta_cmn_l2vararr(apid)
    INPUT:
     apid = the app_id for the data type;
    OUTPUT:
     vars = a 3, N array with common block variable names for the input
     apid, with three columns, one is the common block name, the second is
     the name in the CDF file, the third is 'Y' or 'N' for record
     variance.
    HISTORY:
     16-jun-2014,jmm, jimm@ssl.berkeley.edu
     25-aug-2015, jmm, Added MET variable
     $LastChangedBy: jimm $
     $LastChangedDate: 2015-08-25 09:59:17 -0700 (Tue, 25 Aug 2015) $
     $LastChangedRevision: 18605 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/sta/l2util/mvn_sta_cmn_l2vararr.pro $

(See projects/maven/sta/l2util/mvn_sta_cmn_l2vararr.pro)

## MVN_STA_CMN_TCLIP

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

    NAME:
     mvn_sta_cmn_tclip
    PURPOSE:
     applies a trange to a STATIC common block structure
    CALLING SEQUENCE:
     dat = mvn_sta_cmn_tclip(dat, trange)
    INPUT:
     dat1 = a MAVEN STA data structure: e.g.,
       PROJECT_NAME    STRING    'MAVEN'
       SPACECRAFT      STRING    '0'
       DATA_NAME       STRING    'C6 Energy-Mass'
       APID            STRING    'C6'
       UNITS_NAME      STRING    'counts'
       UNITS_PROCEDURE STRING    'mvn_sta_convert_units'
       VALID           INT       Array[21600]
       QUALITY_FLAG    INT       Array[21600]
       TIME            DOUBLE    Array[21600]
       END_TIME        DOUBLE    Array[21600]
       DELTA_T         DOUBLE    Array[21600]
       INTEG_T         DOUBLE    Array[21600]
       MD              INT       Array[21600]
       MODE            INT       Array[21600]
       RATE            INT       Array[21600]
       SWP_IND         INT       Array[21600]
       MLUT_IND        INT       Array[21600]
       EFF_IND         INT       Array[21600]
       ATT_IND         INT       Array[21600]
       NENERGY         INT             32
       ENERGY          FLOAT     Array[9, 32, 64]
       DENERGY         FLOAT     Array[9, 32, 64]
       NBINS           INT              1
       BINS            INT       Array[1]
       NDEF            INT              1
       NANODE          INT              1
       THETA           FLOAT           0.00000
       DTHETA          FLOAT           90.0000
       PHI             FLOAT           0.00000
       DPHI            FLOAT           360.000
       DOMEGA          FLOAT           8.88577
       GF              FLOAT     Array[9, 32, 4]
       EFF             FLOAT     Array[128, 32, 64]
       GEOM_FACTOR     FLOAT       0.000195673
       NMASS           INT             64
       MASS            FLOAT         0.0104389
       MASS_ARR        FLOAT     Array[9, 32, 64]
       TOF_ARR         FLOAT     Array[5, 32, 64]
       TWT_ARR         FLOAT     Array[5, 32, 64]
       CHARGE          FLOAT           1.00000
       SC_POT          FLOAT     Array[21600]
       MAGF            FLOAT     Array[21600, 3]
       QUAT_SC         FLOAT     Array[21600, 4]
       QUAT_MSO        FLOAT     Array[21600, 4]
       BINS_SC         LONG      Array[21600]
       POS_SC_MSO      FLOAT     Array[21600, 3]
       BKG             FLOAT     Array[21600, 32, 64]
       DEAD            FLOAT     Array[21600, 32, 64]
       DATA            DOUBLE    Array[21600, 32, 64]
    OUTPUT:
     dat = structure with data only in the time range
    NOTES:
     Only will work if the reocrd varying arrays are 5D or less
    HISTORY:
     19-may-2014, jmm, jimm@ssl.berkeley.edu
     $LastChangedBy: jimm $
     $LastChangedDate: 2017-01-10 13:58:40 -0800 (Tue, 10 Jan 2017) $
     $LastChangedRevision: 22570 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/sta/l2util/mvn_sta_cmn_tclip.pro $

(See projects/maven/sta/l2util/mvn_sta_cmn_tclip.pro)

## MVN_STA_IV1_1DAY

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

    NAME:
    mvn_sta_iv1_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_sta_iv1_1day
    INPUT:
    start_time, end_time are input from files
    mvn_sta_iv1_1day_start_time.txt and
    mvn_sta_iv1_1day_end_time.txt.
    OUTPUT:
     Temporary Maven STA L2 files, round 1 of background creation
    HISTORY:
     2014-11-05, jmm, jimm@ssl.berkeley.edu

(See projects/maven/sta/l2util/mvn_sta_iv1_1day.pro)

## MVN_STA_IV2_1DAY

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

    NAME:
    mvn_sta_iv2_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_sta_iv2_1day
    INPUT:
    start_time, end_time are input from files
    mvn_sta_iv2_1day_start_time.txt and
    mvn_sta_iv2_1day_end_time.txt.
    OUTPUT:
     Temporary Maven STA L2 files, round 1 of background creation
    HISTORY:
     2020-10-19, jmm, jimm@ssl.berkeley.edu

(See projects/maven/sta/l2util/mvn_sta_iv2_1day.pro)

## MVN_STA_IV3_1DAY

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

    NAME:
    mvn_sta_iv3_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_sta_iv3_1day
    INPUT:
    start_time, end_time are input from files
    mvn_sta_iv3_1day_start_time.txt and
    mvn_sta_iv3_1day_end_time.txt.
    OUTPUT:
     Temporary Maven STA L2 files, round 1 of background creation
    HISTORY:
     2020-10-19, jmm, jimm@ssl.berkeley.edu

(See projects/maven/sta/l2util/mvn_sta_iv3_1day.pro)

## MVN_STA_IV4_1DAY

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

    NAME:
    mvn_sta_iv4_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_sta_iv4_1day
    INPUT:
    start_time, end_time are input from files
    mvn_sta_iv4_1day_start_time.txt and
    mvn_sta_iv4_1day_end_time.txt.
    OUTPUT:
     Temporary Maven STA L2 files, round 1 of background creation
    HISTORY:
     2020-10-19, jmm, jimm@ssl.berkeley.edu

(See projects/maven/sta/l2util/mvn_sta_iv4_1day.pro)

## MVN_STA_IVALL_1DAY

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

    NAME:
    mvn_sta_ivall_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, for iv1, then the previous
    day for iv2, then the previous day for iv3, then the previous day for
    iv4. This is done so that for each process both days on either side
    of the given day are processed.
    CALLING SEQUENCE:
     .run mvn_sta_iv4all1day
    INPUT:
    start_time, end_time are input from files
    mvn_sta_ivall_1day_start_time.txt and
    mvn_sta_ivall_1day_end_time.txt.
    OUTPUT:
     Temporary Maven STA L2 files, round 1 of background creation
    HISTORY:
     2020-10-19, jmm, jimm@ssl.berkeley.edu

(See projects/maven/sta/l2util/mvn_sta_ivall_1day.pro)

## MVN_STA_IVALL_SAMEDAY

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

    NAME:
    mvn_sta_ivall_sameday
    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, for iv1 to iv4
    CALLING SEQUENCE:
     .run mvn_sta_iv4all_sameday
    INPUT:
    start_time, end_time are input from files
    mvn_sta_ivall_sameday_start_time.txt and
    mvn_sta_ivall_sameday_end_time.txt.
    OUTPUT:
     Temporary Maven STA L2 files, round 1 of background creation
    HISTORY:
     2022-06-13, jmm, jimm@ssl.berkeley.edu

(See projects/maven/sta/l2util/mvn_sta_ivall_sameday.pro)

## MVN_STA_L2DAT_STRUCT

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

    Returns a single static data structure from the common blocks

(See projects/maven/sta/l2util/mvn_sta_l2dat_struct.pro)

## MVN_STA_L2EFLUX

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

    NAME:
     mvn_sta_l2eflux
    PURPOSE:
     Helper function for eflux calculations
    INPUT:
     cmn_dat = MAVEN STATIC data common block
    OUTPUT:
     cmn_dat = same common block with eflux variable added
    HISTORY:
     hacked from mvn_sta_cmn_l2gen, 2016-02-26, jmm,
     jimm@ssl.berkeley.edu
     $LastChangedBy: jimm $
     $LastChangedDate: 2020-12-17 09:32:27 -0800 (Thu, 17 Dec 2020) $
     $LastChangedRevision: 29537 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/sta/l2util/mvn_sta_l2eflux.pro $

(See projects/maven/sta/l2util/mvn_sta_l2eflux.pro)

## MVN_STA_L2GEN

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

    NAME:
     mvn_sta_l2gen
    PURPOSE:
     Generates MAVEN STA L2 files
    CALLING SEQUENCE:
     mvn_sta_l2gen, date = date, l0_input_file = l0_input_file, $
                    directory = directory
    INPUT:
     Either the date or input L0 file, via keyword:
    KEYWORDS:
     date = If set, the input date.
     l0_input_file = A filename for an input file, if this is set, the
                     date and time_range keywords are ignored.
     use_l2_files = If set, use current L2 files as input, and not
                    L0's -- for reprocessing
     lpw_only = if set return after the LPW save file is created
     skip_bins = for L2-L2 processing, skip_bins skips the
                 mvn_sta_sc_bins_load program which takes hours
                 for a full day's data
     iv_level = New for 2020-08-04, setting this keyword runs a
                special L2 process that creates 'iv'+iv_level files, using a
                new background calculation. There will be multiple iv levels
                and only the background values are saved in the file
    HISTORY:
     2014-05-14, jmm, jimm@ssl.berkeley.edu
     $LastChangedBy: jimm $
     $LastChangedDate: 2023-09-27 13:24:11 -0700 (Wed, 27 Sep 2023) $
     $LastChangedRevision: 32139 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/sta/l2util/mvn_sta_l2gen.pro $

(See projects/maven/sta/l2util/mvn_sta_l2gen.pro)

## MVN_STA_L2GEN_1DAY

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

    NAME:
    mvn_sta_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_sta_l2gen_1day
    INPUT:
    start_time, end_time are input from files
    mvn_sta_l2gen_1day_start_time.txt and
    mvn_sta_l2gen_1day_end_time.txt.
    OUTPUT:
     Maven STA L2 files
    HISTORY:
     2014-11-05, jmm, jimm@ssl.berkeley.edu

(See projects/maven/sta/l2util/mvn_sta_l2gen_1day.pro)

## MVN_STA_L2L2_1DAY

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

    NAME:
    mvn_sta_l2l2_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_sta_l2l2_1day
    INPUT:
    start_time, end_time are input from files
    mvn_sta_l2l2_1day_start_time.txt and
    mvn_sta_l2l2_1day_end_time.txt.
    OUTPUT:
     Maven STA L2 files
    HISTORY:
     2014-11-05, jmm, jimm@ssl.berkeley.edu

(See projects/maven/sta/l2util/mvn_sta_l2l2_1day.pro)

## MVN_STA_L2SCPOT

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

    NAME:
     mvn_sta_l2scpot
    PURPOSE:
     Wrapper for mvn_sta_scpot_load that insures that c0 and c6 data have
     the same number of times
    CALLING SEQUENCE:
     mvn_sta_l2scpot
    INPUT:
     the c6 and c0 data structures are assumed to have been loaded
    OUTPUT:
     none, the sc_pot tag is filled for all ap_ids using
     mvn_sta_scpot_load
    KEYWORDS:
     l0l2 = if set, then the input comes from L0 data.
    HISTORY:
     2017-04-10, jmm, jimm@ssl.berkeley.edu
     $LastChangedBy: jimm $
     $LastChangedDate: 2017-04-10 12:52:08 -0700 (Mon, 10 Apr 2017) $
     $LastChangedRevision: 23128 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/sta/l2util/mvn_sta_l2scpot.pro $

(See projects/maven/sta/l2util/mvn_sta_l2scpot.pro)

## MVN_STA_L2_FILEREVISION

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

    NAME:
     mvn_sta_l2_filerevision
    PURPOSE:
     tracks the revision number for a STATIC L2 file
    CALLING SEQUENCE:
     mvn_sta_l2_filerevision, fullfile, fullfile_rev, fullfile_del,$
                              dont_delete = dont_delete
    INPUT:
     fullfile = the filename, without revision number, e.g.,
    '/disks/data/maven/pfp/sta/l2/2014/07/mvn_sta_l2_db-1024m_20140707_v00.cdf'
    OUTPUT:
     fullfile_rev = the filename, current revision, e.g.,
    '/disks/data/maven/pfp/sta/l2/2014/07/mvn_sta_l2_db-1024m_20140707_v00_r00.cdf'
     fullfile_del =  files to be deleted
    HISTORY:
     22-jul-2014, jmm, jimm@ssl.berkeley.edu
     $LastChangedBy: jimm $
     $LastChangedDate: 2015-01-09 10:22:20 -0800 (Fri, 09 Jan 2015) $
     $LastChangedRevision: 16613 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/sta/l2util/mvn_sta_l2_filerevision.pro $

(See projects/maven/sta/l2util/mvn_sta_l2_filerevision.pro)

## MVN_STA_SETUP_IV1PROCESS

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

    time range equally. Run as muser
    sample crontab command
    # STA L2 Reprocess, 2015-08-31
    # 4,8,14,18,24,28,34,38,44,48,54,58 * * * * /bin/csh
    /home/muser/export_socware/idl_socware/projects/maven/l2gen/mvn_l2gen_multiprocess_b.csh
    mvn_sta_l2gen_1day 2 0 /mydisks/home/maven sta_l2_reprocess
    >/dev/null 2>&1
    # for l2l2
    # 4,8,14,18,24,28,34,38,44,48,54,58 * * * * /bin/csh /home/muser/export_socware/idl_socware/projects/maven/l2gen/mvn_l2gen_multiprocess_b.csh mvn_sta_l2l2_1day 2 0 /mydisks/home/maven sta_l2l2_reprocess >/dev/null 2>&1
    #

    ro mvn_sta_setup_iv1process, start_date = start_date, $ ;default is 2014-10-06
                                 end_date = end_date, $     ;default is now
                                 nproc = nproc             ;default is 3

(See projects/maven/sta/l2util/mvn_sta_setup_iv1process.pro)

## MVN_STA_SETUP_IV2PROCESS

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

    time range equally. Run as muser
    sample crontab command
    # STA L2 Reprocess, 2015-08-31
    # 4,8,14,18,24,28,34,38,44,48,54,58 * * * * /bin/csh
    /home/muser/export_socware/idl_socware/projects/maven/l2gen/mvn_l2gen_multiprocess_b.csh
    mvn_sta_l2gen_1day 2 0 /mydisks/home/maven sta_l2_reprocess
    >/dev/null 2>&1
    # for l2l2
    # 4,8,14,18,24,28,34,38,44,48,54,58 * * * * /bin/csh /home/muser/export_socware/idl_socware/projects/maven/l2gen/mvn_l2gen_multiprocess_b.csh mvn_sta_l2l2_1day 2 0 /mydisks/home/maven sta_l2l2_reprocess >/dev/null 2>&1
    #

    ro mvn_sta_setup_iv2process, start_date = start_date, $ ;default is 2014-10-06
                                 end_date = end_date, $     ;default is now
                                 nproc = nproc             ;default is 3

(See projects/maven/sta/l2util/mvn_sta_setup_iv2process.pro)

## MVN_STA_SETUP_IV3PROCESS

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

    time range equally. Run as muser
    sample crontab command
    # STA L2 Reprocess, 2015-08-31
    # 4,8,14,18,24,28,34,38,44,48,54,58 * * * * /bin/csh
    /home/muser/export_socware/idl_socware/projects/maven/l2gen/mvn_l2gen_multiprocess_b.csh
    mvn_sta_l2gen_1day 2 0 /mydisks/home/maven sta_l2_reprocess
    >/dev/null 2>&1
    # for l2l2
    # 4,8,14,18,24,28,34,38,44,48,54,58 * * * * /bin/csh /home/muser/export_socware/idl_socware/projects/maven/l2gen/mvn_l2gen_multiprocess_b.csh mvn_sta_l2l2_1day 2 0 /mydisks/home/maven sta_l2l2_reprocess >/dev/null 2>&1
    #

    ro mvn_sta_setup_iv3process, start_date = start_date, $ ;default is 2014-10-06
                                 end_date = end_date, $     ;default is now
                                 nproc = nproc             ;default is 3

(See projects/maven/sta/l2util/mvn_sta_setup_iv3process.pro)

## MVN_STA_SETUP_IV4PROCESS

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

    time range equally. Run as muser
    sample crontab command
    # STA L2 Reprocess, 2015-08-31
    # 4,8,14,18,24,28,34,38,44,48,54,58 * * * * /bin/csh
    /home/muser/export_socware/idl_socware/projects/maven/l2gen/mvn_l2gen_multiprocess_b.csh
    mvn_sta_l2gen_1day 2 0 /mydisks/home/maven sta_l2_reprocess
    >/dev/null 2>&1
    # for l2l2
    # 4,8,14,18,24,28,34,38,44,48,54,58 * * * * /bin/csh /home/muser/export_socware/idl_socware/projects/maven/l2gen/mvn_l2gen_multiprocess_b.csh mvn_sta_l2l2_1day 2 0 /mydisks/home/maven sta_l2l2_reprocess >/dev/null 2>&1
    #

    ro mvn_sta_setup_iv4process, start_date = start_date, $ ;default is 2014-10-06
                                 end_date = end_date, $     ;default is now
                                 nproc = nproc             ;default is 3

(See projects/maven/sta/l2util/mvn_sta_setup_iv4process.pro)

## MVN_STA_SETUP_IVALLPROCESS

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

    time range equally. Run as muser
    sample crontab command
    # STA L2 Reprocess, 2015-08-31
    # 4,8,14,18,24,28,34,38,44,48,54,58 * * * * /bin/csh
    /home/muser/export_socware/idl_socware/projects/maven/l2gen/mvn_l2gen_multiprocess_b.csh
    mvn_sta_l2gen_1day 2 0 /mydisks/home/maven sta_l2_reprocess
    >/dev/null 2>&1
    # for l2l2
    # 4,8,14,18,24,28,34,38,44,48,54,58 * * * * /bin/csh /home/muser/export_socware/idl_socware/projects/maven/l2gen/mvn_l2gen_multiprocess_b.csh mvn_sta_l2l2_1day 2 0 /mydisks/home/maven sta_l2l2_reprocess >/dev/null 2>&1
    #

    ro mvn_sta_setup_ivallprocess, start_date = start_date, $ ;default is 2014-10-06
                                   end_date = end_date, $     ;default is now
                                   nproc = nproc, $           ;default is 3
                                   same_day = same_day        ;if set reprocesses all levels for the same day

(See projects/maven/sta/l2util/mvn_sta_setup_ivallprocess.pro)

## MVN_STA_SETUP_REPROCESS

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

    time range equally. Run as muser
    sample crontab command
    # STA L2 Reprocess, 2015-08-31
    # 4,8,14,18,24,28,34,38,44,48,54,58 * * * * /bin/csh
    /home/muser/export_socware/idl_socware/projects/maven/l2gen/mvn_l2gen_multiprocess_b.csh
    mvn_sta_l2gen_1day 2 0 /mydisks/home/maven sta_l2_reprocess
    >/dev/null 2>&1
    # for l2l2
    # 4,8,14,18,24,28,34,38,44,48,54,58 * * * * /bin/csh /home/muser/export_socware/idl_socware/projects/maven/l2gen/mvn_l2gen_multiprocess_b.csh mvn_sta_l2l2_1day 2 0 /mydisks/home/maven sta_l2l2_reprocess >/dev/null 2>&1
    #

    ro mvn_sta_setup_reprocess, start_date = start_date, $ ;default is 2014-10-06
                                end_date = end_date, $     ;default is now
                                use_l2_files = use_l2_files, $ ;default is 0 - use L0
                                nproc = nproc                  ;default is 2

(See projects/maven/sta/l2util/mvn_sta_setup_reprocess.pro)

## RERUN_STA_L2GEN

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

    NAME:
    rerun_sta_L2gen
    PURPOSE:
    Designed to run from a cronjob, after the original L2 processing,
    reprocesses, using the current L2 files as input.
    CALLING SEQUENCE:
     run_sta_l2gen, noffset_sec = noffset_sec
    INPUT:
     none
    OUTPUT:
     none
    KEYWORDS:
     none
    HISTORY:
     20-oct-2014, jmm, jimm@ssl.berkeley.edu
     18-oct-2016, single call to mvn_call_l2l2, jmm
     $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/sta/l2util/rerun_sta_l2gen.pro $

(See projects/maven/sta/l2util/rerun_sta_l2gen.pro)

## RUN_STA_IVALL

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

    NAME:
    run_sta_ivall
    PURPOSE:
    Reads in a start date, and process a day, if that day is more than
    250 days ago
    This is a main program, designed to be called from a
    shell script. Processes 1 day at a time, for iv1, then the previous
    day for iv2, then the previous day for iv3, then the previous day for
    iv4. This is done so that for each process both days on either side
    of the given day are processed.
    CALLING SEQUENCE:
    run_sta_ivall
    INPUT:
    start_time, is input from file
    /disks/data/maven/data/sci/sta/iv1/mvn_sta_ivall_start_time.txt
    OUTPUT:
     Temporary Maven STA L2 files, round 1 of background creation
    HISTORY:
     2022-09-20, jmm, jimm@ssl.berkeley.edu

(See projects/maven/sta/l2util/run_sta_ivall.pro)

## RUN_STA_L2GEN

[Previous Routine] [List of Routines]

    NAME:
     run_sta_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_sta_l2gen, noffset_sec = noffset_sec
    INPUT:
     none
    OUTPUT:
     none
    KEYWORDS:
     none
    HISTORY:
     25-jun-2014, 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/sta/l2util/run_sta_l2gen.pro $

(See projects/maven/sta/l2util/run_sta_l2gen.pro)