**GLOBAL SIGMA GUESS PROCESSING IN T.C. RELOCATION AND PREPBUFR**

**(HERE ONLY DEALING WITH CENTER TIME WHICH IS MULTIPLE OF 3-HOURS)**

(DRAFT: 11-07-2006)

**[IF RELOCATION RUNS (nam, ndas, gfs, gdas)]{.underline}**:

execute model script extropcy_qc_reloc.sh.sms

-   execute ush script tropcy_relocate.sh

    -   if sgm3prep does not exist in \$DATA, obtain via getges.sh

    -   if sgesprep does not exist in \$DATA, obtain via getges.sh

        -   store pathname in\
            \${COMSP}sgesprep_pre-relocate_pathname.\$tmmark and in
            \${COMSP}sgesprep_pathname.\$tmmark

    -   if sgp3prep does not exist in \$DATA, obtain via getges.sh

    -   IF NO TCVITALS RECORDS

        -   exit with RC = 0 and echo\
            \"NO RECORDS to process\" into new file
            \${COMSP}tropcy_relocation_status.\$tmmark

    -   IF TCVITALS RECORDS PRESENT

        -   continue with relocation

            -   sgm3prep, sgesprep and sgp3prep input to
                RELOCATE_MV_NVORTEX

            -   sgm3prep.relocate, sgesprep.relocate, sgp3prep.relocate
                output from RELOCATE_MV_NVORTEX

        -   successful completion of relocation

            -   move sgm3prep.relocate, sgesprep.relocate and
                sgp3prep.relocate to sgm3prep, sgesprep and sgp3prep,
                respectively

            -   remove \${COMSP}sgesprep_pathname.\$tmmark

-   if sgm3prep exists, copy to \${COMSP}sgm3prep\${qual_last}

-   if sgesprep exists, copy to \${COMSP}sgesprep\${qual_last}

-   if sgp3prep exists, copy to \${COMSP}sgp3prep\${qual_last}

-   if \${COMSP}tropcy_relocation_status.\$tmmark DOES NOT exist, echo\
    "RECORDS PROCESSED\" into it

    -   (if it does exist, then it contains "NO RECORDS to process" --
        see above)

**[PREPBUFR PROCESSING (all networks):]{.underline}**

execute one of the model scripts exglobal_makeprepbufr.sh.sms,
exrtma_makeprepbufr.sh.sms, exnam_makeprepbufr.sh.sms or
exruc2_prep.sh.sms

-   execute ush script prepobs_makeprepbufr.sh

    -   variable "relo_rec" set to "no" (default)

    -   variable "RELOCATION_HAS_RUN" set to "NO" (default)

    -   if \${COMSP}tropcy_relocation_status.\$tmmark exists and
        contains string "RECORDS PROCESSED\", set "relo_rec" to "yes" to
        signal to PREP job that previous t.c. relocation job ran and
        relocated at least one storm

    -   if \${COMSP}tropcy_relocation_status.\$tmmark exists, set
        variable "RELOCATION_HAS_RUN" to "YES" to signal to PREP job
        that previous t.c. relocation job ran and may or may not have
        relocated any storms

    -   if "RELOCATION_HAS_RUN" is "NO" (i.e., in ruc, cdas, rtma) and
        we want to encode global sigma first guess at center time into
        PREPBUFR file

        -   for gfs and gdas only, use getges.sh to get sgm3prep and
            sgp3prep

            -   (normally should not happen since previous t.c.
                relocation job runs in gfs and gdas, but just in case
                need to do this because the gfs and gdas SSI needs the
                guess for 3-hr prior to and 3-hr after center time in
                analysis)

    -   if "RELOCATION_HAS_RUN" is "YES" (i.e., in nam, ndas, gfs, gdas)

        -   copy \${COMSP}sgm3prep\${qual_last} to sgm3prep

        -   copy \${COMSP}sgesprep\${qual_last} to sgesprep

        -   copy \${COMSP}sgp3prep\${qual_last} to sgp3prep

    -   if we want to encode first guess at center time into PREPBUFR
        file

        -   if sgesprep exists (either copied into \$DATA by user prior
            to execution of this script, or copied into \$DATA because
            previous t.c. relocation job ran (see just above)

            -   if "RELOCATION_HAS_RUN" is "YES"

                -   echo \"\${COMSP}sgesprep\${qual_last}\" to new file
                    sgesprep_pathname (assuming
                    \${COMSP}sgesprep\${qual_last} exists and it should)

            -   otherwise

                -   echo \"\$DATA/sgesprep\" to new file
                    sgesprep_pathname (this is case of user copying file
                    into working directory prior to execution of this
                    script)

        -   if sgesprep DOES NOT exist (normally because previous t.c.
            relocation job did not run (e.g., in ruc, rtma, cdas)

            -   obtain via getges.sh

            -   store pathname in sgesprep_pathname

        -   set variable SGES to full path to sgesprep file (had been
            /dev/null)

    -   SGES is read by PREPOBS_PREPDATA program and by SYNDAT_SYNDATA
        program (and also by PREPOBS_PREVENTS in cdas network)

-   *ALL BELOW SKIPPED IN RTMA NETWORK*

-   gfs, gdas only: if sgm3prep exists but
    \$COMOUT/\${RUN}.\${cycle}.sgm3prep doesn't

    -   cp sgm3prep to \$COMOUT/\${RUN}.\${cycle}.sgm3prep

    -   (previous tropical cyclone relocation job must not have run)

-   gfs, gdas only: if sgp3prep exists but
    \$COMOUT/\${RUN}.\${cycle}.sgp3prep doesn't

    -   cp sgp3prep to \$COMOUT/\${RUN}.\${cycle}.sgp3prep

    -   (previous tropical cyclone relocation job must not have run)

-   if sgesprep exists but \$COMOUT/\${RUN}.\${cycle}.sgesprep doesn't

    -   cp sgesprep to \$COMOUT/\${RUN}.\${cycle}.sgesprep

    -   (previous tropical cyclone relocation job must not have run)

-   if user requested that global sigma guess at center time be encoded
    into PREPBUFR file

    -   if \$COMOUT/\${RUN}.\${cycle}.sgesprep_pathname.\$tmmark does
        not exist, copy file sgesprep_pathname to it

        -   sgesprep_pathname will either contain either the path to the
            getges guess (if previous t. c. relocation job did not run)
            or it will contain the path to the modified sgesprep guess
            (if previous t. c. relocation job did run and it did modify
            the guess

    -   if \$COMOUT/\${RUN}.\${cycle}.sgesprep_pathname.\$tmmark already
        exists, do nothing

        -   it was created in previous t.c. relocation job because
            either there was an error or no tcvitals records were
            present - in this case the path points to the original
            getges global sigma guess (since the guess was not modified
            by relocation)