;******************************************************************************
20040929, in papco_util, new routine:

;******************************************************************************
;* FUNCTION:     papco_file_unzip
;*
;* DESCRIPTION:  checks if the file is zipped. If yes, unzips the file.
;*               works on uniz spawn to gunzip 
;*
;* KEYWORDS:     VERBOSE  - give verbose diagnostic output
;*
;* INPUTS:       file - name of file. Routine looks for "file.gz"
;*
;* OUTPUT:       0 - file not found, zipped or unzipped
;*               1 - file found and was zipped, has been unzipped
;*               2 - file found and was not zipped
;*
;* HISTORY:      written September 2004, Reiner Friedel
;******************************************************************************

;******************************************************************************
20040929, in papco_util, new routine:

;******************************************************************************
;* FUNCTION:     papco_file_template
;*
;* DESCRIPTION:  given a path/file template, return the full path to a file. 
;*               This is to accomodate different directory structures
;*               for data at different sites.
;*
;*               Recognized strings in template are replaced:
;*                    $yyyy - four digit year
;*                      $YY - two digit year
;*                      $dd - day of month
;*                      $mm - month of year
;*                     $doy - day of year
;*                   $MONTH - month name with same capitalization as input
;*                            ($MONTH/$Month/$month), truncated at CMONTH_LEN
;*                   $SATID - satellite name from SATID if set
;*                    $INST - instrument name from INST if set
;*                     $VER - version number from VER if set    
;*                     $EXT - file extension from EXT if set
;*                    
;* KEYWORDS:     VERBOSE  - give verbose diagnostic output
;*               MJDT - use this for the date, default is mjdt_start
;*               CMONTH_LEN - use this for length of month string
;*               SATID - use this for satellite string              
;*               INST - use this for instrument string
;*               VERSION - use this for version string
;*               EXT - use this for the file extension
;*
;* INPUTS:       template string, e.g. /data/GPS_$SATID/$yyyy/ 
;*
;* OUTPUT:       filename with recognized strings replaced 
;*
;* HISTORY:      written September 2004, Reiner Friedel
;******************************************************************************